Merge pull request #29470 from amcasey/InterfaceImplementations
Don't treat interfaces as implementations
This commit is contained in:
commit
3a2f6a3ed1
3 changed files with 26 additions and 1 deletions
|
@ -1682,7 +1682,8 @@ namespace ts.FindAllReferences.Core {
|
|||
|
||||
function isImplementation(node: Node): boolean {
|
||||
return !!(node.flags & NodeFlags.Ambient)
|
||||
|| (isVariableLike(node) ? hasInitializer(node)
|
||||
? !(isInterfaceDeclaration(node) || isTypeAliasDeclaration(node))
|
||||
: (isVariableLike(node) ? hasInitializer(node)
|
||||
: isFunctionLikeDeclaration(node) ? !!node.body
|
||||
: isClassLike(node) || isModuleOrEnumDeclaration(node));
|
||||
}
|
||||
|
|
12
tests/cases/fourslash/goToImplementationInterface_09.ts
Normal file
12
tests/cases/fourslash/goToImplementationInterface_09.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// Should go to object literals within cast expressions when invoked on interface
|
||||
|
||||
// @Filename: def.d.ts
|
||||
//// export interface Interface { P: number }
|
||||
|
||||
// @Filename: ref.ts
|
||||
//// import { Interface } from "./def";
|
||||
//// const c: I/*ref*/nterface = [|{ P: 2 }|];
|
||||
|
||||
verify.allRangesAppearInImplementationList("ref");
|
12
tests/cases/fourslash/goToImplementationTypeAlias_00.ts
Normal file
12
tests/cases/fourslash/goToImplementationTypeAlias_00.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// Should go to object literals within cast expressions when invoked on interface
|
||||
|
||||
// @Filename: def.d.ts
|
||||
//// export type TypeAlias = { P: number }
|
||||
|
||||
// @Filename: ref.ts
|
||||
//// import { TypeAlias } from "./def";
|
||||
//// const c: T/*ref*/ypeAlias = [|{ P: 2 }|];
|
||||
|
||||
verify.allRangesAppearInImplementationList("ref");
|
Loading…
Reference in a new issue