diff --git a/extensions/typescript-language-features/src/languageFeatures/completions.ts b/extensions/typescript-language-features/src/languageFeatures/completions.ts index a46835aa90773..708d7e028dd1b 100644 --- a/extensions/typescript-language-features/src/languageFeatures/completions.ts +++ b/extensions/typescript-language-features/src/languageFeatures/completions.ts @@ -188,7 +188,7 @@ class MyCompletionItem extends vscode.CompletionItem { ] }; const response = await client.interruptGetErr(() => client.execute('completionEntryDetails', args, requestToken.token)); - if (response.type !== 'response' || !response.body || !response.body.length) { + if (response.type !== 'response' || !response.body?.length) { return undefined; } @@ -766,7 +766,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider< dotAccessorContext = { range, text }; } } - isIncomplete = !!response.body.isIncomplete || (response as any).metadata && (response as any).metadata.isIncomplete; + isIncomplete = !!response.body.isIncomplete || (response.metadata as any)?.isIncomplete; entries = response.body.entries; metadata = response.metadata; diff --git a/extensions/typescript-language-features/src/task/taskProvider.ts b/extensions/typescript-language-features/src/task/taskProvider.ts index c1b1438560348..3cf0e3328fa09 100644 --- a/extensions/typescript-language-features/src/task/taskProvider.ts +++ b/extensions/typescript-language-features/src/task/taskProvider.ts @@ -53,7 +53,7 @@ class TscTaskProvider extends Disposable implements vscode.TaskProvider { public async provideTasks(token: vscode.CancellationToken): Promise { const folders = vscode.workspace.workspaceFolders; - if ((this.autoDetect === AutoDetect.off) || !folders || !folders.length) { + if ((this.autoDetect === AutoDetect.off) || !folders?.length) { return []; } diff --git a/extensions/typescript-language-features/src/utils/objects.ts b/extensions/typescript-language-features/src/utils/objects.ts index a31467bd8d664..88c5a435e1c88 100644 --- a/extensions/typescript-language-features/src/utils/objects.ts +++ b/extensions/typescript-language-features/src/utils/objects.ts @@ -9,6 +9,7 @@ export function equals(one: any, other: any): boolean { if (one === other) { return true; } + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain if (one === null || one === undefined || other === null || other === undefined) { return false; }