Skip to content

Commit 3a2f6a3

Browse files
authored
Merge pull request microsoft#29470 from amcasey/InterfaceImplementations
Don't treat interfaces as implementations
2 parents d38c616 + 737fda9 commit 3a2f6a3

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/services/findAllReferences.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,8 @@ namespace ts.FindAllReferences.Core {
16821682

16831683
function isImplementation(node: Node): boolean {
16841684
return !!(node.flags & NodeFlags.Ambient)
1685-
|| (isVariableLike(node) ? hasInitializer(node)
1685+
? !(isInterfaceDeclaration(node) || isTypeAliasDeclaration(node))
1686+
: (isVariableLike(node) ? hasInitializer(node)
16861687
: isFunctionLikeDeclaration(node) ? !!node.body
16871688
: isClassLike(node) || isModuleOrEnumDeclaration(node));
16881689
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// Should go to object literals within cast expressions when invoked on interface
4+
5+
// @Filename: def.d.ts
6+
//// export interface Interface { P: number }
7+
8+
// @Filename: ref.ts
9+
//// import { Interface } from "./def";
10+
//// const c: I/*ref*/nterface = [|{ P: 2 }|];
11+
12+
verify.allRangesAppearInImplementationList("ref");
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// Should go to object literals within cast expressions when invoked on interface
4+
5+
// @Filename: def.d.ts
6+
//// export type TypeAlias = { P: number }
7+
8+
// @Filename: ref.ts
9+
//// import { TypeAlias } from "./def";
10+
//// const c: T/*ref*/ypeAlias = [|{ P: 2 }|];
11+
12+
verify.allRangesAppearInImplementationList("ref");

0 commit comments

Comments
 (0)