File tree Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -2679,6 +2679,15 @@ namespace ts {
26792679 return links.target;
26802680 }
26812681
2682+ function tryResolveAlias(symbol: Symbol): Symbol | undefined {
2683+ const links = getSymbolLinks(symbol);
2684+ if (links.target !== resolvingSymbol) {
2685+ return resolveAlias(symbol);
2686+ }
2687+
2688+ return undefined;
2689+ }
2690+
26822691 /**
26832692 * Marks a symbol as type-only if its declaration is syntactically type-only.
26842693 * If it is not itself marked type-only, but resolves to a type-only alias
@@ -23934,12 +23943,26 @@ namespace ts {
2393423943 return getSpellingSuggestion(name, symbols, getCandidateName);
2393523944 function getCandidateName(candidate: Symbol) {
2393623945 const candidateName = symbolName(candidate);
23937- return !startsWith(candidateName, "\"") && candidate.flags & meaning ? candidateName : undefined;
23946+ if (startsWith(candidateName, "\"")) {
23947+ return undefined;
23948+ }
23949+
23950+ if (candidate.flags & meaning) {
23951+ return candidateName;
23952+ }
23953+
23954+ if (candidate.flags & SymbolFlags.Alias) {
23955+ const alias = tryResolveAlias(candidate);
23956+ if (alias && alias.flags & meaning) {
23957+ return candidateName;
23958+ }
23959+ }
23960+
23961+ return undefined;
2393823962 }
2393923963 }
2394023964
2394123965 function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined, isThisAccess: boolean) {
23942-
2394323966 const valueDeclaration = prop && (prop.flags & SymbolFlags.ClassMember) && prop.valueDeclaration;
2394423967 if (!valueDeclaration) {
2394523968 return;
Original file line number Diff line number Diff line change 1+ /// <reference path='fourslash.ts' />
2+
3+ // @Filename : a.ts
4+ ////export class SomeClass {}
5+
6+ // @Filename : b.ts
7+ ////import { SomeClass } from "./a";
8+ ////[|SomeClas|]
9+
10+ goTo . file ( "b.ts" )
11+
12+ verify . codeFixAvailable ( [
13+ { description : "Change spelling to 'SomeClass'" } ,
14+ { description : "Remove import from './a'" }
15+ ] ) ;
16+
17+ verify . codeFix ( {
18+ index : 0 ,
19+ description : [ ts . Diagnostics . Change_spelling_to_0 . message , "SomeClass" ] ,
20+ newRangeContent : "SomeClass"
21+ } ) ;
You can’t perform that action at this time.
0 commit comments