mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
| .. | ||
| event-kit-tests.ts | ||
| index.d.ts | ||
| README.md | ||
| tsconfig.json | ||
| tslint.json | ||
Event Kit Type Definitions
TypeScript type definitions for event-kit, which is published under the same name on NPM.
Usage Notes
Exports
The three classes exported from this module are: CompositeDisposable, Disposable, and Emitter.
import { CompositeDisposable, Disposable, Emitter } from "event-kit";
let subscriptions = new CompositeDisposable();
The EventKit Namespace
All types used by "event-kit" can be referenced from the EventKit namespace.
function example(disposable: EventKit.DisposableLike) {}
Exposing Private Methods and Properties
Declaration Merging can be used to augment any of the types used within Event Kit. As an example, if we wanted to reveal the private getEventNames method within the Emitter class, then we would create a file with the following contents:
// <<filename>>.d.ts
declare namespace EventKit {
interface Emitter {
getEventNames(): string[];
}
}
Once this file is either referenced or included within your project, then this new member function would be freely usable on instances of the Emitter class without TypeScript reporting errors.