Skip to content
Myr

Remove EventEmitter from TypeScript definition file (#1146)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Remove NodeJS.EventEmitter from TypeScript definition * Add symbol It is JavaScript not node and ok to include to match EventEmitter defintition

authored by John Gee · committed by GitHub · parent 68e584f · Browse files · 2 files+13 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+13 added−9 removed

  • other:+13 added−9 removed

2 files+13 added−9 removed

modified:typings/index.d.ts+12 added-3 removed
1// Type definitions for commander2// Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>34///<reference types="node" />54declare namespace commander {56 interface CommanderError extends Error {7 code: string;
14 unmodified lines
22 description: string;23 }24 type OptionConstructor = { new (flags: string, description?: string): Option };2528 interface Command extends NodeJS.EventEmitter {26 interface Command {27 [key: string]: any; // options as properties2829 args: string[];30
252 unmodified lines
283 /** 284 * Output help information and exit.285 */286 help(cb?: (str: string) => string): never;287288 /**289 * Add a listener (callback) for when events occur. (Implemented using EventEmitter.)290 * 291 * @example292 * program293 * .on('--help', () -> {294 * console.log('See web site for more information.');295 * });296 */297 on(event: string | symbol, listener: (...args: any[]) => void): Command;298 }299 type CommandConstructor = { new (name?: string): Command };300301
21 unmodified lines
modified:Readme.md+1 added-6 removed
603 unmodified lines
604```605606### TypeScript607608The Commander package includes its TypeScript Definition file, but also requires the node types which you need to install yourself. e.g.608The Commander package includes its TypeScript Definition file.609610```bash611npm install commander612npm install --save-dev @types/node613```614610If you use `ts-node` and git-style sub-commands written as `.ts` files, you need to call your program through node to get the sub-commands called correctly. e.g.611612```bash613node -r ts-node/register pm.ts
95 unmodified lines