Skip to content

Commit b754fc3

Browse files
TypeScript Botjasonlyu123
TypeScript Bot
andauthored
🤖 Pick PR #57778 (fix type import check for default-i...) into release-5.4 (#58116)
Co-authored-by: Lyu, Wei-Da <[email protected]>
1 parent 8eb3367 commit b754fc3

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

‎src/services/completions.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,8 @@ export function getCompletionEntriesFromSymbols(
26742674
}
26752675

26762676
function symbolAppearsToBeTypeOnly(symbol: Symbol): boolean {
2677-
return !(symbol.flags & SymbolFlags.Value) && (!isInJSFile(symbol.declarations?.[0]) || !!(symbol.flags & SymbolFlags.Type));
2677+
const flags = getCombinedLocalAndExportSymbolFlags(skipAlias(symbol, typeChecker));
2678+
return !(flags & SymbolFlags.Value) && (!isInJSFile(symbol.declarations?.[0]) || !!(flags & SymbolFlags.Type));
26782679
}
26792680
}
26802681

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @allowJs: true
4+
5+
// @Filename: /default.ts
6+
//// export default class TestDefaultClass {}
7+
8+
// @Filename: /defaultType.ts
9+
//// export default interface TestDefaultInterface {}
10+
11+
// @Filename: /reExport/toReExport.ts
12+
//// export class TestClassReExport {}
13+
//// export interface TestInterfaceReExport {}
14+
15+
// @Filename: /reExport/index.ts
16+
//// export { TestClassReExport, TestInterfaceReExport } from './toReExport';
17+
18+
// @Filename: /exportList.ts
19+
//// class TestClassExportList {};
20+
//// interface TestInterfaceExportList {};
21+
//// export { TestClassExportList, TestInterfaceExportList };
22+
23+
// @Filename: /baseline.ts
24+
//// export class TestClassBaseline {}
25+
//// export interface TestInterfaceBaseline {}
26+
27+
// @Filename: /a.js
28+
//// import /**/
29+
30+
verify.completions({
31+
marker: "",
32+
isNewIdentifierLocation: true,
33+
exact: [
34+
{
35+
name: "TestClassBaseline",
36+
insertText: "import { TestClassBaseline } from \"./baseline\";",
37+
source: "./baseline",
38+
},
39+
{
40+
name: "TestClassExportList",
41+
insertText: "import { TestClassExportList } from \"./exportList\";",
42+
source: "./exportList",
43+
},
44+
{
45+
name: "TestClassReExport",
46+
insertText: "import { TestClassReExport } from \"./reExport\";",
47+
source: "./reExport",
48+
},
49+
{
50+
name: "TestDefaultClass",
51+
insertText: "import TestDefaultClass from \"./default\";",
52+
source: "./default",
53+
},
54+
],
55+
preferences: {
56+
includeCompletionsForImportStatements: true,
57+
includeCompletionsWithInsertText: true,
58+
}
59+
});

0 commit comments

Comments
 (0)