mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Fixes goto definitions for type predicates
This commit is contained in:
@@ -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');
|
||||
Reference in New Issue
Block a user