mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Fixes goto definitions for type predicates
This commit is contained in:
parent
72aeb3c208
commit
2aceeea064
@ -11925,6 +11925,10 @@ namespace ts {
|
||||
return resolveEntityName(<EntityName>entityName, meaning);
|
||||
}
|
||||
|
||||
if (entityName.parent.kind === SyntaxKind.TypePredicate) {
|
||||
return resolveEntityName(<Identifier>entityName, /* meanings */ SymbolFlags.Variable);
|
||||
}
|
||||
|
||||
// Do we want to return undefined here?
|
||||
return undefined;
|
||||
}
|
||||
|
||||
16
tests/cases/fourslash/goToDefinitionTypePredicate.ts
Normal file
16
tests/cases/fourslash/goToDefinitionTypePredicate.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
//// /*classDeclaration*/class A {}
|
||||
//// function f(/*parameterDeclaration*/parameter: any): /*parameterName*/parameter is /*typeReference*/A {
|
||||
//// return typeof parameter === "string";
|
||||
//// }
|
||||
|
||||
goTo.marker('parameterName');
|
||||
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('parameterDeclaration');
|
||||
|
||||
goTo.marker('typeReference');
|
||||
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDeclaration');
|
||||
Loading…
x
Reference in New Issue
Block a user