Skip to content

Commit b8f5b53

Browse files
authored
fix(commands,list): do not use this in handler (#1494)
1 parent eeade9a commit b8f5b53

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/cli/lib/commands/doc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const doc: DocCommandType = {
2727
if (!argv.term) {
2828
const answer = await PromptSession.chooseTerm();
2929
argv.term = answer;
30-
await this.handler(argv);
30+
await doc.handler(argv);
3131
} else if (!Util.isAlphanumericExt(argv.term)) {
3232
return Util.error(`The search term '${argv.term}' is not valid.` + "\n" +
3333
"Name should start with a letter and can also contain numbers, dashes and spaces.",

packages/cli/lib/commands/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const command: CommandType = {
4040
const templatesByGroup = [];
4141
const controlGroups: string[] = [];
4242

43-
const framework: Framework = this.templateManager.getFrameworkById(argv.framework);
43+
const framework: Framework = command.templateManager.getFrameworkById(argv.framework);
4444
if (!framework) {
4545
return Util.error("Wrong framework provided", "red");
4646
}

packages/cli/lib/commands/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface CommandType extends CommandModule<{}, any> {
7070
templateManager?: TemplateManager;
7171

7272
/** Handler function that will be called by yargs after the command line has been parsed. */
73-
handler(argv: ArgumentsCamelCase<PositionalArgs>);
73+
handler(/** do not use `this` in handler */this: void, argv: ArgumentsCamelCase<PositionalArgs>);
7474
}
7575

7676
export interface NewCommandType extends CommandType {

0 commit comments

Comments
 (0)