Skip to content

Commit fb1b26c

Browse files
authored
Propagate object flags related to object and array literals onto module.exports types (#57467)
1 parent fd23885 commit fb1b26c

6 files changed

+292
-33
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11244,7 +11244,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1124411244
result.aliasTypeArguments = length(args) ? args : undefined;
1124511245
}
1124611246
}
11247-
result.objectFlags |= getObjectFlags(type) & ObjectFlags.JSLiteral; // Propagate JSLiteral flag
11247+
result.objectFlags |= getPropagatingFlagsOfTypes([type]) | getObjectFlags(type) & (ObjectFlags.JSLiteral | ObjectFlags.ArrayLiteral | ObjectFlags.ObjectLiteral);
1124811248
if (result.symbol && result.symbol.flags & SymbolFlags.Class && type === getDeclaredTypeOfClassOrInterface(result.symbol)) {
1124911249
result.objectFlags |= ObjectFlags.IsClassInstanceClone; // Propagate the knowledge that this type is equivalent to the symbol's class instance type
1125011250
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//// [tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts] ////
2+
3+
=== eslint.config.js ===
4+
const eslintReact = require('./eslint-plugin-react.js');
5+
>eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5))
6+
>require : Symbol(require)
7+
>'./eslint-plugin-react.js' : Symbol("eslint-plugin-react", Decl(eslint-plugin-react.js, 0, 0))
8+
9+
const tseslint = require('./typescript-eslint.js');
10+
>tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5))
11+
>require : Symbol(require)
12+
>'./typescript-eslint.js' : Symbol(tseslint, Decl(typescript-eslint.js, 0, 0))
13+
14+
tseslint.config(eslintReact)
15+
>tseslint.config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18))
16+
>tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5))
17+
>config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18))
18+
>eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5))
19+
20+
=== eslint-plugin-react.js ===
21+
const deprecatedRules = {
22+
>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 0, 5))
23+
24+
"jsx-sort-default-props": true
25+
>"jsx-sort-default-props" : Symbol("jsx-sort-default-props", Decl(eslint-plugin-react.js, 0, 25))
26+
}
27+
28+
const allRules = {
29+
>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5))
30+
31+
'no-unsafe': true
32+
>'no-unsafe' : Symbol('no-unsafe', Decl(eslint-plugin-react.js, 4, 18))
33+
}
34+
35+
module.exports = {
36+
>module.exports : Symbol(module.exports, Decl(eslint-plugin-react.js, 0, 0))
37+
>module : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1))
38+
>exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1))
39+
40+
plugins: {
41+
>plugins : Symbol(plugins, Decl(eslint-plugin-react.js, 8, 18))
42+
43+
react: {
44+
>react : Symbol(react, Decl(eslint-plugin-react.js, 9, 12))
45+
46+
deprecatedRules,
47+
>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 10, 12))
48+
49+
rules: allRules,
50+
>rules : Symbol(rules, Decl(eslint-plugin-react.js, 11, 22))
51+
>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5))
52+
53+
},
54+
},
55+
};
56+
57+
=== typescript-eslint.js ===
58+
/**
59+
* @typedef {{ rules: Record<string, boolean> }} Plugin
60+
*/
61+
62+
/**
63+
* @typedef {{ plugins: Record<string, Plugin> }} Config
64+
*/
65+
66+
/**
67+
* @type {(...configs: Config[]) => void}
68+
*/
69+
function config(...configs) { }
70+
>config : Symbol(config, Decl(typescript-eslint.js, 0, 0))
71+
>configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16))
72+
73+
module.exports = { config };
74+
>module.exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0))
75+
>module : Symbol(module, Decl(typescript-eslint.js, 11, 31))
76+
>exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0))
77+
>config : Symbol(config, Decl(typescript-eslint.js, 13, 18))
78+
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
//// [tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts] ////
2+
3+
=== eslint.config.js ===
4+
const eslintReact = require('./eslint-plugin-react.js');
5+
>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
6+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7+
>require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
8+
> :
9+
>require : any
10+
>'./eslint-plugin-react.js' : "./eslint-plugin-react.js"
11+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
const tseslint = require('./typescript-eslint.js');
14+
>tseslint : typeof tseslint
15+
> : ^^^^^^^^^^^^^^^
16+
>require('./typescript-eslint.js') : typeof tseslint
17+
> : ^^^^^^^^^^^^^^^
18+
>require : any
19+
>'./typescript-eslint.js' : "./typescript-eslint.js"
20+
> : ^^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
tseslint.config(eslintReact)
23+
>tseslint.config(eslintReact) : void
24+
> : ^^^^
25+
>tseslint.config : (...configs: tseslint.Config[]) => void
26+
> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+
>tseslint : typeof tseslint
28+
> : ^^^^^^^^^^^^^^^
29+
>config : (...configs: tseslint.Config[]) => void
30+
> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31+
>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
32+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
34+
=== eslint-plugin-react.js ===
35+
const deprecatedRules = {
36+
>deprecatedRules : { "jsx-sort-default-props": boolean; }
37+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
>{ "jsx-sort-default-props": true} : { "jsx-sort-default-props": boolean; }
39+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
"jsx-sort-default-props": true
42+
>"jsx-sort-default-props" : boolean
43+
> : ^^^^^^^
44+
>true : true
45+
> : ^^^^
46+
}
47+
48+
const allRules = {
49+
>allRules : { 'no-unsafe': boolean; }
50+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
51+
>{ 'no-unsafe': true} : { 'no-unsafe': boolean; }
52+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
53+
54+
'no-unsafe': true
55+
>'no-unsafe' : boolean
56+
> : ^^^^^^^
57+
>true : true
58+
> : ^^^^
59+
}
60+
61+
module.exports = {
62+
>module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
63+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64+
>module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
65+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66+
>module : { exports: { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }; }
67+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68+
>exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
69+
> : ^^^^^^^^^^^ ^^^
70+
>{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }
71+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^
72+
73+
plugins: {
74+
>plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }
75+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76+
>{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }
77+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^
78+
79+
react: {
80+
>react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }
81+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82+
>{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }
83+
> : ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^
84+
85+
deprecatedRules,
86+
>deprecatedRules : { "jsx-sort-default-props": boolean; }
87+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88+
89+
rules: allRules,
90+
>rules : { 'no-unsafe': boolean; }
91+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
92+
>allRules : { 'no-unsafe': boolean; }
93+
> :
94+
95+
},
96+
},
97+
};
98+
99+
=== typescript-eslint.js ===
100+
/**
101+
* @typedef {{ rules: Record<string, boolean> }} Plugin
102+
*/
103+
104+
/**
105+
* @typedef {{ plugins: Record<string, Plugin> }} Config
106+
*/
107+
108+
/**
109+
* @type {(...configs: Config[]) => void}
110+
*/
111+
function config(...configs) { }
112+
>config : (...configs: Config[]) => void
113+
> : ^^^^ ^^ ^^^^^
114+
>configs : Config[]
115+
> : ^^^^^^^^
116+
117+
module.exports = { config };
118+
>module.exports = { config } : typeof module.exports
119+
> : ^^^^^^^^^^^^^^^^^^^^^
120+
>module.exports : typeof module.exports
121+
> : ^^^^^^^^^^^^^^^^^^^^^
122+
>module : { exports: typeof module.exports; }
123+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124+
>exports : typeof module.exports
125+
> : ^^^^^^^^^^^^^^^^^^^^^
126+
>{ config } : { config: (...configs: Config[]) => void; }
127+
> : ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
128+
>config : (...configs: Config[]) => void
129+
> : ^^^^ ^^^^^^^^^^^^^^^^^^^
130+

tests/baselines/reference/typedefCrossModule2.symbols

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ var bb;
1616

1717
var bbb = new mod.Baz();
1818
>bbb : Symbol(bbb, Decl(use.js, 5, 3))
19+
>mod.Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18))
1920
>mod : Symbol(mod, Decl(use.js, 0, 3))
21+
>Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18))
2022

2123
=== mod1.js ===
2224
// error

tests/baselines/reference/typedefCrossModule2.types

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
=== use.js ===
44
var mod = require('./mod1.js');
5-
>mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; }
6-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7-
>require('./mod1.js') : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; }
8-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+
>mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; Baz?: undefined; }
6+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7+
>require('./mod1.js') : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; Baz?: undefined; }
8+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99
>require : any
1010
> : ^^^
1111
>'./mod1.js' : "./mod1.js"
@@ -22,16 +22,16 @@ var bb;
2222
> : ^^^^^^
2323

2424
var bbb = new mod.Baz();
25-
>bbb : any
25+
>bbb : Baz
2626
> : ^^^
27-
>new mod.Baz() : any
27+
>new mod.Baz() : Baz
2828
> : ^^^
29-
>mod.Baz : any
30-
> : ^^^
31-
>mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; }
32-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33-
>Baz : any
34-
> : ^^^
29+
>mod.Baz : typeof Baz
30+
> : ^^^^^^^^^^
31+
>mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; Baz?: undefined; }
32+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
>Baz : typeof Baz
34+
> : ^^^^^^^^^^
3535

3636
=== mod1.js ===
3737
// error
@@ -47,23 +47,23 @@ exports.Bar = class { }
4747
> : ^^^^^^^^^^
4848
>exports.Bar : typeof Bar
4949
> : ^^^^^^^^^^
50-
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
51-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50+
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
51+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5252
>Bar : typeof Bar
5353
> : ^^^^^^^^^^
5454
>class { } : typeof Bar
5555
> : ^^^^^^^^^^
5656

5757
/** @typedef {number} Baz */
5858
module.exports = {
59-
>module.exports = { Baz: class { }} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
60-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61-
>module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
62-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63-
>module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }; }
64-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65-
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
66-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59+
>module.exports = { Baz: class { }} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
60+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61+
>module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
62+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63+
>module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }; }
64+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65+
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
66+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6767
>{ Baz: class { }} : { Baz: typeof Baz; }
6868
> : ^^^^^^^^^^^^^^^^^^^^
6969

@@ -89,23 +89,23 @@ exports.Quid = 2;
8989
> : ^
9090
>exports.Quid : 2
9191
> : ^
92-
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
93-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92+
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
93+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9494
>Quid : 2
9595
> : ^
9696
>2 : 2
9797
> : ^
9898

9999
/** @typedef {number} Quack */
100100
module.exports = {
101-
>module.exports = { Quack: 2} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
102-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103-
>module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
104-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105-
>module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }; }
106-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107-
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }
108-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101+
>module.exports = { Quack: 2} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
102+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103+
>module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
104+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105+
>module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }; }
106+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107+
>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }
108+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109109
>{ Quack: 2} : { Quack: number; }
110110
> : ^^^^^^^^^^^^^^^^^^
111111

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// @strict: true
2+
// @allowJs: true
3+
// @checkJs: true
4+
// @noEmit: true
5+
6+
// https://github.com/microsoft/TypeScript/issues/57460
7+
8+
// @filename: eslint-plugin-react.js
9+
10+
const deprecatedRules = {
11+
"jsx-sort-default-props": true
12+
}
13+
14+
const allRules = {
15+
'no-unsafe': true
16+
}
17+
18+
module.exports = {
19+
plugins: {
20+
react: {
21+
deprecatedRules,
22+
rules: allRules,
23+
},
24+
},
25+
};
26+
27+
// @Filename: typescript-eslint.js
28+
29+
/**
30+
* @typedef {{ rules: Record<string, boolean> }} Plugin
31+
*/
32+
33+
/**
34+
* @typedef {{ plugins: Record<string, Plugin> }} Config
35+
*/
36+
37+
/**
38+
* @type {(...configs: Config[]) => void}
39+
*/
40+
function config(...configs) { }
41+
42+
module.exports = { config };
43+
44+
// @Filename: eslint.config.js
45+
46+
const eslintReact = require('./eslint-plugin-react.js');
47+
const tseslint = require('./typescript-eslint.js');
48+
49+
tseslint.config(eslintReact)

0 commit comments

Comments
 (0)