Add asserts to type only symbols meaning exclusion (#43382)

Fixes #42180
This commit is contained in:
Michael サイトー 中村 Bashurov
2021-04-06 01:29:51 +03:00
committed by GitHub
parent ffe925ddd5
commit 3b06ef1a73
2 changed files with 11 additions and 2 deletions

View File

@@ -1659,8 +1659,9 @@ namespace ts.Completions {
function isContextTokenValueLocation(contextToken: Node) {
return contextToken &&
contextToken.kind === SyntaxKind.TypeOfKeyword &&
(contextToken.parent.kind === SyntaxKind.TypeQuery || isTypeOfExpression(contextToken.parent));
((contextToken.kind === SyntaxKind.TypeOfKeyword &&
(contextToken.parent.kind === SyntaxKind.TypeQuery || isTypeOfExpression(contextToken.parent))) ||
(contextToken.kind === SyntaxKind.AssertsKeyword && contextToken.parent.kind === SyntaxKind.TypePredicate));
}
function isContextTokenTypeLocation(contextToken: Node): boolean {

View File

@@ -0,0 +1,8 @@
/// <reference path="fourslash.ts" />
////declare function assert(argument1: any): asserts a/**/
verify.completions({
marker: "",
includes: { name: "argument1" }
});