diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d770dd04ce0..cc5d7b0cdd6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11244,7 +11244,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { result.aliasTypeArguments = length(args) ? args : undefined; } } - result.objectFlags |= getObjectFlags(type) & ObjectFlags.JSLiteral; // Propagate JSLiteral flag + result.objectFlags |= getPropagatingFlagsOfTypes([type]) | getObjectFlags(type) & (ObjectFlags.JSLiteral | ObjectFlags.ArrayLiteral | ObjectFlags.ObjectLiteral); if (result.symbol && result.symbol.flags & SymbolFlags.Class && type === getDeclaredTypeOfClassOrInterface(result.symbol)) { result.objectFlags |= ObjectFlags.IsClassInstanceClone; // Propagate the knowledge that this type is equivalent to the symbol's class instance type } diff --git a/tests/baselines/reference/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols b/tests/baselines/reference/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols new file mode 100644 index 00000000000..a1315293681 --- /dev/null +++ b/tests/baselines/reference/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols @@ -0,0 +1,78 @@ +//// [tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts] //// + +=== eslint.config.js === +const eslintReact = require('./eslint-plugin-react.js'); +>eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) +>require : Symbol(require) +>'./eslint-plugin-react.js' : Symbol("eslint-plugin-react", Decl(eslint-plugin-react.js, 0, 0)) + +const tseslint = require('./typescript-eslint.js'); +>tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) +>require : Symbol(require) +>'./typescript-eslint.js' : Symbol(tseslint, Decl(typescript-eslint.js, 0, 0)) + +tseslint.config(eslintReact) +>tseslint.config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18)) +>tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) +>config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18)) +>eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) + +=== eslint-plugin-react.js === +const deprecatedRules = { +>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 0, 5)) + + "jsx-sort-default-props": true +>"jsx-sort-default-props" : Symbol("jsx-sort-default-props", Decl(eslint-plugin-react.js, 0, 25)) +} + +const allRules = { +>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) + + 'no-unsafe': true +>'no-unsafe' : Symbol('no-unsafe', Decl(eslint-plugin-react.js, 4, 18)) +} + +module.exports = { +>module.exports : Symbol(module.exports, Decl(eslint-plugin-react.js, 0, 0)) +>module : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) +>exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) + + plugins: { +>plugins : Symbol(plugins, Decl(eslint-plugin-react.js, 8, 18)) + + react: { +>react : Symbol(react, Decl(eslint-plugin-react.js, 9, 12)) + + deprecatedRules, +>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 10, 12)) + + rules: allRules, +>rules : Symbol(rules, Decl(eslint-plugin-react.js, 11, 22)) +>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) + + }, + }, +}; + +=== typescript-eslint.js === +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } +>config : Symbol(config, Decl(typescript-eslint.js, 0, 0)) +>configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) + +module.exports = { config }; +>module.exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0)) +>module : Symbol(module, Decl(typescript-eslint.js, 11, 31)) +>exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0)) +>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) + diff --git a/tests/baselines/reference/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types b/tests/baselines/reference/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types new file mode 100644 index 00000000000..bb999fc07a9 --- /dev/null +++ b/tests/baselines/reference/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types @@ -0,0 +1,130 @@ +//// [tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts] //// + +=== eslint.config.js === +const eslintReact = require('./eslint-plugin-react.js'); +>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : +>require : any +>'./eslint-plugin-react.js' : "./eslint-plugin-react.js" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +const tseslint = require('./typescript-eslint.js'); +>tseslint : typeof tseslint +> : ^^^^^^^^^^^^^^^ +>require('./typescript-eslint.js') : typeof tseslint +> : ^^^^^^^^^^^^^^^ +>require : any +>'./typescript-eslint.js' : "./typescript-eslint.js" +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +tseslint.config(eslintReact) +>tseslint.config(eslintReact) : void +> : ^^^^ +>tseslint.config : (...configs: tseslint.Config[]) => void +> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>tseslint : typeof tseslint +> : ^^^^^^^^^^^^^^^ +>config : (...configs: tseslint.Config[]) => void +> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +=== eslint-plugin-react.js === +const deprecatedRules = { +>deprecatedRules : { "jsx-sort-default-props": boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ "jsx-sort-default-props": true} : { "jsx-sort-default-props": boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + "jsx-sort-default-props": true +>"jsx-sort-default-props" : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ +} + +const allRules = { +>allRules : { 'no-unsafe': boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ 'no-unsafe': true} : { 'no-unsafe': boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ + + 'no-unsafe': true +>'no-unsafe' : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ +} + +module.exports = { +>module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module : { exports: { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : ^^^^^^^^^^^ ^^^ +>{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^ + + plugins: { +>plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^ + + react: { +>react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; } +> : ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^ + + deprecatedRules, +>deprecatedRules : { "jsx-sort-default-props": boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + rules: allRules, +>rules : { 'no-unsafe': boolean; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ +>allRules : { 'no-unsafe': boolean; } +> : + + }, + }, +}; + +=== typescript-eslint.js === +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } +>config : (...configs: Config[]) => void +> : ^^^^ ^^ ^^^^^ +>configs : Config[] +> : ^^^^^^^^ + +module.exports = { config }; +>module.exports = { config } : typeof module.exports +> : ^^^^^^^^^^^^^^^^^^^^^ +>module.exports : typeof module.exports +> : ^^^^^^^^^^^^^^^^^^^^^ +>module : { exports: typeof module.exports; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>exports : typeof module.exports +> : ^^^^^^^^^^^^^^^^^^^^^ +>{ config } : { config: (...configs: Config[]) => void; } +> : ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ +>config : (...configs: Config[]) => void +> : ^^^^ ^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/typedefCrossModule2.symbols b/tests/baselines/reference/typedefCrossModule2.symbols index eaa4500f834..777c174d0ea 100644 --- a/tests/baselines/reference/typedefCrossModule2.symbols +++ b/tests/baselines/reference/typedefCrossModule2.symbols @@ -16,7 +16,9 @@ var bb; var bbb = new mod.Baz(); >bbb : Symbol(bbb, Decl(use.js, 5, 3)) +>mod.Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18)) === mod1.js === // error diff --git a/tests/baselines/reference/typedefCrossModule2.types b/tests/baselines/reference/typedefCrossModule2.types index 1f8ed13711e..146815e95f2 100644 --- a/tests/baselines/reference/typedefCrossModule2.types +++ b/tests/baselines/reference/typedefCrossModule2.types @@ -2,10 +2,10 @@ === use.js === var mod = require('./mod1.js'); ->mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->require('./mod1.js') : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>require('./mod1.js') : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >require : any > : ^^^ >'./mod1.js' : "./mod1.js" @@ -22,16 +22,16 @@ var bb; > : ^^^^^^ var bbb = new mod.Baz(); ->bbb : any +>bbb : Baz > : ^^^ ->new mod.Baz() : any +>new mod.Baz() : Baz > : ^^^ ->mod.Baz : any -> : ^^^ ->mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Baz : any -> : ^^^ +>mod.Baz : typeof Baz +> : ^^^^^^^^^^ +>mod : { Baz: typeof Baz; Bar: typeof mod.Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof mod.Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>Baz : typeof Baz +> : ^^^^^^^^^^ === mod1.js === // error @@ -47,8 +47,8 @@ exports.Bar = class { } > : ^^^^^^^^^^ >exports.Bar : typeof Bar > : ^^^^^^^^^^ ->exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Bar : typeof Bar > : ^^^^^^^^^^ >class { } : typeof Bar @@ -56,14 +56,14 @@ exports.Bar = class { } /** @typedef {number} Baz */ module.exports = { ->module.exports = { Baz: class { }} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module.exports = { Baz: class { }} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ Baz: class { }} : { Baz: typeof Baz; } > : ^^^^^^^^^^^^^^^^^^^^ @@ -89,8 +89,8 @@ exports.Quid = 2; > : ^ >exports.Quid : 2 > : ^ ->exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Quid : 2 > : ^ >2 : 2 @@ -98,14 +98,14 @@ exports.Quid = 2; /** @typedef {number} Quack */ module.exports = { ->module.exports = { Quack: 2} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; } | { Quack: number; Bar: typeof Bar; Quid: 2; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module.exports = { Quack: 2} : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module.exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>module : { exports: { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>exports : { Baz: typeof Baz; Bar: typeof Bar; Quid: 2; Quack?: undefined; } | { Quack: number; Bar: typeof Bar; Quid: 2; Baz?: undefined; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ Quack: 2} : { Quack: number; } > : ^^^^^^^^^^^^^^^^^^ diff --git a/tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts b/tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts new file mode 100644 index 00000000000..384ef003812 --- /dev/null +++ b/tests/cases/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.ts @@ -0,0 +1,49 @@ +// @strict: true +// @allowJs: true +// @checkJs: true +// @noEmit: true + +// https://github.com/microsoft/TypeScript/issues/57460 + +// @filename: eslint-plugin-react.js + +const deprecatedRules = { + "jsx-sort-default-props": true +} + +const allRules = { + 'no-unsafe': true +} + +module.exports = { + plugins: { + react: { + deprecatedRules, + rules: allRules, + }, + }, +}; + +// @Filename: typescript-eslint.js + +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } + +module.exports = { config }; + +// @Filename: eslint.config.js + +const eslintReact = require('./eslint-plugin-react.js'); +const tseslint = require('./typescript-eslint.js'); + +tseslint.config(eslintReact)