Merge pull request #29470 from amcasey/InterfaceImplementations

Don't treat interfaces as implementations
This commit is contained in:
Andrew Casey 2019-01-18 16:28:49 -08:00 committed by GitHub
commit 3a2f6a3ed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View file

@ -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));
}

View 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");

View 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");