Skip to content

Commit c6d8a09

Browse files
committed
Add support for Partial in the command manager
The command manager types didn't fully support commands defined with `Partial` because it deduced that the command function was `undefined` when the function was not defined. However, if the command is not present, the command registration will not be called. This fixes the types by specifying that the command definition will never be `undefined`.
1 parent e74a2e4 commit c6d8a09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

extensions/ql-vscode/src/packages/commands/CommandManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class CommandManager<
3030
constructor(
3131
private readonly commandRegister: <T extends CommandName>(
3232
commandName: T,
33-
fn: Commands[T],
33+
fn: NonNullable<Commands[T]>,
3434
) => Disposable,
3535
private readonly commandExecute: <T extends CommandName>(
3636
commandName: T,
@@ -43,7 +43,7 @@ export class CommandManager<
4343
*/
4444
register<T extends CommandName>(
4545
commandName: T,
46-
definition: Commands[T],
46+
definition: NonNullable<Commands[T]>,
4747
): void {
4848
this.commands.push(this.commandRegister(commandName, definition));
4949
}

0 commit comments

Comments
 (0)