Require more explicit strict null typing for executeCommand

Fixes #136906

Some commands never return undefined, so the current typings are incorrect. Instead we should require the caller to pass in `| undefined` if undefined can be returned
This commit is contained in:
Matt Bierner 2021-11-15 14:19:12 -08:00
parent c8a321ae17
commit bb764173a3
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -8598,10 +8598,10 @@ declare module 'vscode' {
*
* @param command Identifier of the command to execute.
* @param rest Parameters passed to the command function.
* @return A thenable that resolves to the returned value of the given command. `undefined` when
* @return A thenable that resolves to the returned value of the given command. Returns `undefined` when
* the command handler function doesn't return anything.
*/
export function executeCommand<T>(command: string, ...rest: any[]): Thenable<T | undefined>;
export function executeCommand<T = unknown>(command: string, ...rest: any[]): Thenable<T>;
/**
* Retrieve the list of all available commands. Commands starting with an underscore are