@jaenster/events
TypeScript icon, indicating that this package has built-in type declarations

0.9.7 • Public • Published

EventTS

import {EventTS} from "@jaenster/events-ts";

interface Foo {
    on<S = this>(event: "bar", cb: (this: S, a: string) => any);
}

class Foo extends EventTS {
    z: string = '';
}

const foo = new Foo;

foo.on('bar', function () {
    // `this` is typed
    if (this.z.length) {
        // something
    }
})

Readme

Keywords

none

Package Sidebar

Install

npm i @jaenster/events

Weekly Downloads

1

Version

0.9.7

License

MIT

Unpacked Size

1.51 kB

Total Files

2

Last publish

Collaborators

  • jaenster