Skip to content
Myr

set `this`context (#2197)

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

authored by Matthias Keckl · committed by GitHub · parent 8641554 · Browse files · 2 files+5 added−1 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+5 added−1 removed

  • other:+5 added−1 removed

2 files+5 added−1 removed

modified:typings/index.d.ts+1 added-1 removed
542 unmodified lines
543 * ```544 *545 * @returns `this` command for chaining546 */547 action(fn: (...args: any[]) => void | Promise<void>): this;547 action(fn: (this: this, ...args: any[]) => void | Promise<void>): this;548549 /**550 * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.551 *
418 unmodified lines
modified:typings/index.test-d.ts+4 added
146 unmodified lines
147148// action149expectType<commander.Command>(program.action(() => {}));150expectType<commander.Command>(program.action(async () => {}));151program152 .action(function () {153 expectType<typeof program>(this)154 })155156// option157expectType<commander.Command>(program.option('-a,--alpha'));158expectType<commander.Command>(program.option('-p, --peppers', 'Add peppers'));
548 unmodified lines