Skip to content

Commit 6afd0fb

Browse files
authored
Fix crash when serializing default export in error (#61582)
1 parent 069de74 commit 6afd0fb

File tree

3 files changed

+93
-1
lines changed

3 files changed

+93
-1
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6156,7 +6156,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
61566156
},
61576157
isOptionalParameter,
61586158
isUndefinedIdentifierExpression(node: Identifier) {
6159-
Debug.assert(isExpressionNode(node));
61606159
return getSymbolAtLocation(node) === undefinedSymbol;
61616160
},
61626161
isEntityNameVisible(context, entityName, shouldComputeAliasToMakeVisible) {
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/index.ts(7,7): error TS2322: Type '{ default: { configs: { 'stage-0': PluginConfig; }; }; configs: { 'stage-0': PluginConfig; }; }' is not assignable to type 'Plugin'.
2+
Types of property 'configs' are incompatible.
3+
Type '{ 'stage-0': PluginConfig; }' is not assignable to type 'Record<string, { parser: string | null; }>'.
4+
Property ''stage-0'' is incompatible with index signature.
5+
Type 'PluginConfig' is not assignable to type '{ parser: string | null; }'.
6+
Types of property 'parser' are incompatible.
7+
Type 'string | null | undefined' is not assignable to type 'string | null'.
8+
Type 'undefined' is not assignable to type 'string | null'.
9+
10+
11+
==== /node_modules/eslint-plugin-import-x/package.json (0 errors) ====
12+
{
13+
"name": "eslint-plugin-import-x",
14+
"version": "1.0.0",
15+
"main": "index.cjs"
16+
}
17+
18+
==== /node_modules/eslint-plugin-import-x/index.d.cts (0 errors) ====
19+
declare const eslintPluginImportX: typeof import("./lib/index.js");
20+
export = eslintPluginImportX;
21+
22+
==== /node_modules/eslint-plugin-import-x/lib/index.d.ts (0 errors) ====
23+
interface PluginConfig {
24+
parser?: string | null;
25+
}
26+
declare const configs: {
27+
'stage-0': PluginConfig;
28+
};
29+
declare const _default: {
30+
configs: {
31+
'stage-0': PluginConfig;
32+
};
33+
};
34+
export default _default;
35+
export { configs };
36+
37+
==== /index.ts (1 errors) ====
38+
import * as pluginImportX from 'eslint-plugin-import-x'
39+
40+
interface Plugin {
41+
configs?: Record<string, { parser: string | null }>
42+
}
43+
44+
const p: Plugin = pluginImportX;
45+
~
46+
!!! error TS2322: Type '{ default: { configs: { 'stage-0': PluginConfig; }; }; configs: { 'stage-0': PluginConfig; }; }' is not assignable to type 'Plugin'.
47+
!!! error TS2322: Types of property 'configs' are incompatible.
48+
!!! error TS2322: Type '{ 'stage-0': PluginConfig; }' is not assignable to type 'Record<string, { parser: string | null; }>'.
49+
!!! error TS2322: Property ''stage-0'' is incompatible with index signature.
50+
!!! error TS2322: Type 'PluginConfig' is not assignable to type '{ parser: string | null; }'.
51+
!!! error TS2322: Types of property 'parser' are incompatible.
52+
!!! error TS2322: Type 'string | null | undefined' is not assignable to type 'string | null'.
53+
!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'.
54+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// @strict: true
2+
// @module: nodenext
3+
// @noEmit: true
4+
// @noTypesAndSymbols: true
5+
6+
// @Filename: /node_modules/eslint-plugin-import-x/package.json
7+
{
8+
"name": "eslint-plugin-import-x",
9+
"version": "1.0.0",
10+
"main": "index.cjs"
11+
}
12+
13+
// @Filename: /node_modules/eslint-plugin-import-x/index.d.cts
14+
declare const eslintPluginImportX: typeof import("./lib/index.js");
15+
export = eslintPluginImportX;
16+
17+
// @Filename: /node_modules/eslint-plugin-import-x/lib/index.d.ts
18+
interface PluginConfig {
19+
parser?: string | null;
20+
}
21+
declare const configs: {
22+
'stage-0': PluginConfig;
23+
};
24+
declare const _default: {
25+
configs: {
26+
'stage-0': PluginConfig;
27+
};
28+
};
29+
export default _default;
30+
export { configs };
31+
32+
// @Filename: /index.ts
33+
import * as pluginImportX from 'eslint-plugin-import-x'
34+
35+
interface Plugin {
36+
configs?: Record<string, { parser: string | null }>
37+
}
38+
39+
const p: Plugin = pluginImportX;

0 commit comments

Comments
 (0)