Skip to content

Commit 3b06ef1

Browse files
Add asserts to type only symbols meaning exclusion (#43382)
Fixes #42180
1 parent ffe925d commit 3b06ef1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/services/completions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,8 +1659,9 @@ namespace ts.Completions {
16591659

16601660
function isContextTokenValueLocation(contextToken: Node) {
16611661
return contextToken &&
1662-
contextToken.kind === SyntaxKind.TypeOfKeyword &&
1663-
(contextToken.parent.kind === SyntaxKind.TypeQuery || isTypeOfExpression(contextToken.parent));
1662+
((contextToken.kind === SyntaxKind.TypeOfKeyword &&
1663+
(contextToken.parent.kind === SyntaxKind.TypeQuery || isTypeOfExpression(contextToken.parent))) ||
1664+
(contextToken.kind === SyntaxKind.AssertsKeyword && contextToken.parent.kind === SyntaxKind.TypePredicate));
16641665
}
16651666

16661667
function isContextTokenTypeLocation(contextToken: Node): boolean {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////declare function assert(argument1: any): asserts a/**/
4+
5+
verify.completions({
6+
marker: "",
7+
includes: { name: "argument1" }
8+
});

0 commit comments

Comments
 (0)