File tree 2 files changed +46
-2
lines changed 2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -2679,6 +2679,15 @@ namespace ts {
2679
2679
return links.target;
2680
2680
}
2681
2681
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
+
2682
2691
/**
2683
2692
* Marks a symbol as type-only if its declaration is syntactically type-only.
2684
2693
* If it is not itself marked type-only, but resolves to a type-only alias
@@ -23934,12 +23943,26 @@ namespace ts {
23934
23943
return getSpellingSuggestion(name, symbols, getCandidateName);
23935
23944
function getCandidateName(candidate: Symbol) {
23936
23945
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;
23938
23962
}
23939
23963
}
23940
23964
23941
23965
function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined, isThisAccess: boolean) {
23942
-
23943
23966
const valueDeclaration = prop && (prop.flags & SymbolFlags.ClassMember) && prop.valueDeclaration;
23944
23967
if (!valueDeclaration) {
23945
23968
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