diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 89fe743c47..b3933a9f28 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -5417,7 +5417,7 @@ func (c *Checker) checkExternalModuleExports(node *ast.Node) { exportEqualsSymbol := moduleSymbol.Exports[ast.InternalSymbolNameExportEquals] if exportEqualsSymbol != nil && c.hasExportedMembers(moduleSymbol) { declaration := core.OrElse(c.getDeclarationOfAliasSymbol(exportEqualsSymbol), exportEqualsSymbol.ValueDeclaration) - if declaration != nil && !isTopLevelInExternalModuleAugmentation(declaration) { + if declaration != nil && !isTopLevelInExternalModuleAugmentation(declaration) && !ast.IsInJSFile(declaration) { c.error(declaration, diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements) } } diff --git a/internal/transformers/declarations/transform.go b/internal/transformers/declarations/transform.go index 0702913b00..11c549ef42 100644 --- a/internal/transformers/declarations/transform.go +++ b/internal/transformers/declarations/transform.go @@ -1498,6 +1498,9 @@ func (tx *DeclarationTransformer) ensureModifierFlags(node *ast.Node) ast.Modifi mask ^= ast.ModifierFlagsAmbient additions = ast.ModifierFlagsNone } + if tx.shouldSuppressExport(node) { + mask ^= ast.ModifierFlagsExport + } return maskModifierFlags(tx.host, node, mask, additions) } @@ -1796,3 +1799,22 @@ func (tx *DeclarationTransformer) transformJSDocOptionalType(input *ast.JSDocOpt tx.EmitContext().SetOriginal(replacement, input.AsNode()) return replacement } + +func (tx *DeclarationTransformer) shouldSuppressExport(node *ast.Node) bool { + if node.Kind == ast.KindJSTypeAliasDeclaration && ast.IsSourceFile(node.Parent) && ast.IsExternalOrCommonJSModule(node.Parent.AsSourceFile()) { + sourceFile := node.Parent.AsSourceFile() + exports := []*ast.Node{ + sourceFile.CommonJSModuleIndicator, + sourceFile.ExternalModuleIndicator, + } + for _, export := range exports { + if export == nil { + continue + } + if ast.IsAnyExportAssignment(export) && export.AsExportAssignment().IsExportEquals { + return true + } + } + } + return false +} diff --git a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt b/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt deleted file mode 100644 index 855d7577c6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -something.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== file.ts (0 errors) ==== - class Foo { - x: number; - } - - declare global { - var module: any; // Just here to remove unrelated error from test - } - - export = Foo; -==== something.js (1 errors) ==== - /** @typedef {typeof import("./file")} Foo */ - - /** @typedef {(foo: Foo) => string} FooFun */ - - module.exports = /** @type {FooFun} */(void 0); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt deleted file mode 100644 index 267621261d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ /dev/null @@ -1,61 +0,0 @@ -input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== input.js (1 errors) ==== - /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ - - /** - * @template P - * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ - - /** - * @type {StatelessComponent} - */ - const MyComponent = () => /* @type {any} */(null); - - MyComponent.defaultProps = { - color: "red" - }; - - const MyComponent2 = () => null; - - /** - * @type {MyComponentProps} - */ - MyComponent2.defaultProps = { - color: "red" - } - - /** - * @type {StatelessComponent} - */ - const check = MyComponent2; - - /** - * - * @param {{ props: MyComponentProps }} p - */ - function expectLiteral(p) {} - - function foo() { - /** - * @type {MyComponentProps} - */ - this.props = { color: "red" }; - - expectLiteral(this); - } - - /** - * @type {MyComponentProps} - */ - module.exports = { - ~~~~~~~~~~~~~~~~~~ - color: "red" - ~~~~~~~~~~~~~~~~ - } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - expectLiteral({ props: module.exports }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt index 824d5e4f6f..9da858c20f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt @@ -1,8 +1,7 @@ -index.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== /** * @typedef Options * @property {string} opt @@ -12,8 +11,6 @@ index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. * @param {Options} options */ module.exports = function loader(options) {} - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~~~~~~~ !!! error TS7006: Parameter 'options' implicitly has an 'any' type. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js index bf182d3b0a..c7ef110972 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js @@ -34,7 +34,7 @@ module.exports = function loader(options) { }; //// [index.d.ts] -export type Options = { +type Options = { opt: string; }; declare const _default: (options: any) => void; diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff index b9cfac184e..c79e0a9e9a 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.js.diff @@ -25,8 +25,7 @@ -} -declare function _exports(options: Options): void; -export = _exports; --type Options = { -+export type Options = { + type Options = { opt: string; }; +declare const _default: (options: any) => void; diff --git a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.errors.txt b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.errors.txt index 8a5ba320ee..cfb6ee5c17 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsExportAssignmentNonMutableLocation.errors.txt @@ -1,18 +1,13 @@ -file.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. file.js(8,9): error TS2339: Property 'customSymbol2' does not exist on type 'typeof import("file")'. -==== file.js (2 errors) ==== +==== file.js (1 errors) ==== const customSymbol = Symbol("custom"); // This is a common pattern in Node’s built-in modules: module.exports = { - ~~~~~~~~~~~~~~~~~~ customSymbol, - ~~~~~~~~~~~~~~~~~ }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. exports.customSymbol2 = Symbol("custom"); ~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt index ab5aaf3bad..ff1ff140e5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt @@ -1,14 +1,11 @@ /x.js(1,16): error TS2339: Property 'x' does not exist on type 'typeof import("/y")'. -/x.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== /x.js (2 errors) ==== +==== /x.js (1 errors) ==== module.exports.x = 1; ~ !!! error TS2339: Property 'x' does not exist on type 'typeof import("/y")'. module.exports = require("./y.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ==== /y.d.ts (0 errors) ==== export declare type x = 1; diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt deleted file mode 100644 index 3d859304e6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt +++ /dev/null @@ -1,45 +0,0 @@ -typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== eslint.config.js (0 errors) ==== - const eslintReact = require('./eslint-plugin-react.js'); - const tseslint = require('./typescript-eslint.js'); - - tseslint.config(eslintReact) - -==== eslint-plugin-react.js (0 errors) ==== - const deprecatedRules = { - "jsx-sort-default-props": true - } - - const allRules = { - 'no-unsafe': true - } - - module.exports = { - plugins: { - react: { - deprecatedRules, - rules: allRules, - }, - }, - }; - -==== typescript-eslint.js (1 errors) ==== - /** - * @typedef {{ rules: Record }} Plugin - */ - - /** - * @typedef {{ plugins: Record }} Config - */ - - /** - * @type {(...configs: Config[]) => void} - */ - function config(...configs) { } - - module.exports = { config }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.errors.txt b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.errors.txt index 6f9d8230e4..b1e743578d 100644 --- a/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/pushTypeGetTypeOfAlias.errors.txt @@ -1,12 +1,9 @@ -bar.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. bar.js(2,9): error TS2339: Property 'blah' does not exist on type 'typeof import("bar")'. bar.js(2,24): error TS2339: Property 'someProp' does not exist on type 'typeof import("bar")'. -==== bar.js (3 errors) ==== +==== bar.js (2 errors) ==== module.exports = function () {}; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. exports.blah = exports.someProp; ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'typeof import("bar")'. diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt index 5a59e1a49e..d1c4231be8 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt @@ -1,15 +1,12 @@ -mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. -==== mod1.js (1 errors) ==== +==== mod1.js (0 errors) ==== /** @callback Con - some kind of continuation * @param {object | undefined} error * @return {any} I don't even know what this should return */ module.exports = C - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. function C() { this.p = 1 } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt index 9702659e53..b39702fb73 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt @@ -1,5 +1,4 @@ bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. -commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. @@ -12,15 +11,13 @@ commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on var diddy = funky(1) -==== commonJSAliasedExport.js (2 errors) ==== +==== commonJSAliasedExport.js (1 errors) ==== const donkey = (ast) => ast; function funky(declaration) { return false; } module.exports = donkey; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.funky = funky; ~~~~~ !!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. diff --git a/testdata/baselines/reference/submodule/conformance/conflictingCommonJSES2015Exports.errors.txt b/testdata/baselines/reference/submodule/conformance/conflictingCommonJSES2015Exports.errors.txt index 57cc9ec89f..c5ec548dbf 100644 --- a/testdata/baselines/reference/submodule/conformance/conflictingCommonJSES2015Exports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/conflictingCommonJSES2015Exports.errors.txt @@ -1,12 +1,9 @@ -bug24934.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. use.js(1,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. -==== bug24934.js (1 errors) ==== +==== bug24934.js (0 errors) ==== export function abc(a, b, c) { return 5; } module.exports = { abc }; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ==== use.js (1 errors) ==== import { abc } from './bug24934'; ~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt index cbb4b6d57d..d948e00fe7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt @@ -1,8 +1,7 @@ -cls.js(7,1): error TS2309: An export assignment cannot be used in a module with other exported elements. cls.js(8,16): error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. -==== cls.js (2 errors) ==== +==== cls.js (1 errors) ==== const Bar = require("./bar"); const Strings = { a: "A", @@ -10,8 +9,6 @@ cls.js(8,16): error TS2339: Property 'Strings' does not exist on type 'typeof Fo }; class Foo extends Bar {} module.exports = Foo; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Strings = Strings; ~~~~~~~ !!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt index 40716a87f1..8bae0a2d6b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt @@ -1,8 +1,7 @@ -source.js(15,1): error TS2309: An export assignment cannot be used in a module with other exported elements. source.js(16,16): error TS2339: Property 'Strings' does not exist on type 'typeof Handler'. -==== source.js (2 errors) ==== +==== source.js (1 errors) ==== class Handler { static get OPTIONS() { return 1; @@ -18,8 +17,6 @@ source.js(16,16): error TS2339: Property 'Strings' does not exist on type 'typeo } module.exports = Handler; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Strings = Strings ~~~~~~~ !!! error TS2339: Property 'Strings' does not exist on type 'typeof Handler'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.errors.txt index 1c5461dbd3..4154f9c5a5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCrossfileMerge.errors.txt @@ -1,13 +1,10 @@ -index.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(4,16): error TS2339: Property 'memberName' does not exist on type '() => void'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== const m = require("./exporter"); module.exports = m.default; - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.memberName = "thing"; ~~~~~~~~~~ !!! error TS2339: Property 'memberName' does not exist on type '() => void'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt index f3dcd0a4a2..49e902cb62 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt @@ -1,25 +1,15 @@ -index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== module.exports = class { - ~~~~~~~~~~~~~~~~~~~~~~~~ /** - ~~~~~~~ * @param {number} p - ~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~ constructor(p) { - ~~~~~~~~~~~~~~~~~~~~ this.t = 12 + p; - ~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Sub = class { ~~~ !!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt index ffdd928e4d..f61d723750 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt @@ -1,8 +1,7 @@ -index.js(7,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(12,16): error TS2339: Property 'Another' does not exist on type 'typeof Q'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== class A { member = new Q(); } @@ -10,16 +9,10 @@ index.js(12,16): error TS2339: Property 'Another' does not exist on type 'typeof x = 42; } module.exports = class Q { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ constructor() { - ~~~~~~~~~~~~~~~~~~~ this.x = new A(); - ~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Another = Q; ~~~~~~~ !!! error TS2339: Property 'Another' does not exist on type 'typeof Q'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt index 46f3413868..1169e490a9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt @@ -1,16 +1,13 @@ -index.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(8,16): error TS2339: Property 'additional' does not exist on type 'Foo'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== class Foo { static stat = 10; member = 10; } module.exports = new Foo(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.additional = 20; ~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt index bdcd1428a7..5ca2a58629 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt @@ -1,19 +1,14 @@ -jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. jsDeclarationsExportAssignedConstructorFunctionWithSub.js(7,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. -==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (3 errors) ==== +==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (2 errors) ==== /** * @param {number} p */ module.exports = function (p) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this.t = 12 + p; - ~~~~~~~~~~~~~~~~~~~~ } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Sub = function() { ~~~ !!! error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt index c381a8cc32..75ab29434e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt @@ -1,27 +1,18 @@ -index.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. index.js(12,16): error TS2339: Property 'Strings' does not exist on type '{ thing: string; also: string; desc: { item: string; }; }'. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== const Strings = { a: "A", b: "B" }; module.exports = { - ~~~~~~~~~~~~~~~~~~ thing: "ok", - ~~~~~~~~~~~~~~~~ also: "ok", - ~~~~~~~~~~~~~~~ desc: { - ~~~~~~~~~~~ item: "ok" - ~~~~~~~~~~~~~~~~~~ } - ~~~~~ }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Strings = Strings; ~~~~~~~ !!! error TS2339: Property 'Strings' does not exist on type '{ thing: string; also: string; desc: { item: string; }; }'. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt index 3c8079cefa..2c5fb6cd92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt @@ -1,16 +1,13 @@ -cls.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. cls.js(7,16): error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. -==== cls.js (2 errors) ==== +==== cls.js (1 errors) ==== const Strings = { a: "A", b: "B" }; class Foo {} module.exports = Foo; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Strings = Strings; ~~~~~~~ !!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index 3331f7cf27..2b4385d035 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -2,9 +2,7 @@ context.js(4,14): error TS1340: Module './timer' does not refer to a type, but i context.js(5,14): error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? context.js(6,31): error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. -context.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? -hook.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ==== timer.js (0 errors) ==== @@ -15,7 +13,7 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit this.timeout = timeout; } module.exports = Timer; -==== hook.js (2 errors) ==== +==== hook.js (1 errors) ==== /** * @typedef {(arg: import("./context")) => void} HookHandler ~~~~~~~~~~~~~~~~~~~ @@ -28,10 +26,8 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit this.handle = handle; } module.exports = Hook; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== context.js (5 errors) ==== +==== context.js (4 errors) ==== /** * Imports * @@ -88,6 +84,4 @@ hook.js(10,1): error TS2309: An export assignment cannot be used in a module wit } } module.exports = Context; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js index 8038dc5993..5c670a0f0d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js @@ -147,18 +147,18 @@ module.exports = Hook; //// [timer.d.ts] export = Timer; //// [context.d.ts] -export type Timer = import("./timer"); -export type Hook = import("./hook"); -export type HookHandler = import("./hook").HookHandler; -export type Input = { +type Timer = import("./timer"); +type Hook = import("./hook"); +type HookHandler = import("./hook").HookHandler; +type Input = { timer: Timer; hook: Hook; }; -export type State = { +type State = { timer: Timer; hook: Hook; }; export = Context; //// [hook.d.ts] -export type HookHandler = (arg: import("./context")) => void; +type HookHandler = (arg: import("./context")) => void; export = Hook; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff index 6f918307d3..23dedde69b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff @@ -46,18 +46,7 @@ - timeout: number; -} //// [context.d.ts] -+export type Timer = import("./timer"); -+export type Hook = import("./hook"); -+export type HookHandler = import("./hook").HookHandler; -+export type Input = { -+ timer: Timer; -+ hook: Hook; -+}; -+export type State = { -+ timer: Timer; -+ hook: Hook; -+}; - export = Context; +-export = Context; -/** - * Imports - * @@ -129,32 +118,32 @@ -/** - * Imports - */ --type Timer = import("./timer"); + type Timer = import("./timer"); -/** - * Imports - */ --type Hook = import("./hook"); + type Hook = import("./hook"); -/** - * Imports - */ --type HookHandler = import("./hook").HookHandler; + type HookHandler = import("./hook").HookHandler; -/** - * Input type definition - */ --type Input = { -- timer: Timer; -- hook: Hook; --}; + type Input = { + timer: Timer; + hook: Hook; + }; -/** - * State type definition - */ --type State = { -- timer: Timer; -- hook: Hook; --}; + type State = { + timer: Timer; + hook: Hook; + }; ++export = Context; //// [hook.d.ts] -+export type HookHandler = (arg: import("./context")) => void; - export = Hook; +-export = Hook; -/** - * @typedef {(arg: import("./context")) => void} HookHandler - */ @@ -175,4 +164,5 @@ -declare namespace Hook { - export { HookHandler }; -} --type HookHandler = (arg: import("./context")) => void; \ No newline at end of file + type HookHandler = (arg: import("./context")) => void; ++export = Hook; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt deleted file mode 100644 index 0b7c06dc92..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -source.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== source.js (1 errors) ==== - module.exports = MyClass; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - function MyClass() {} - MyClass.staticMethod = function() {} - MyClass.prototype.method = function() {} - MyClass.staticProperty = 123; - - /** - * Callback to be invoked when test execution is complete. - * - * @callback DoneCB - * @param {number} failures - Number of failures that occurred. - */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js index 25aba9ecba..9474d9fdd1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js @@ -34,10 +34,33 @@ MyClass.staticProperty = 123; //// [source.d.ts] export = MyClass; -export type DoneCB = (failures: number) ; +type DoneCB = (failures: number) ; /** * Callback to be invoked when test execution is complete. * * @callback DoneCB * @param {number} failures - Number of failures that occurred. */ + + +//// [DtsFileErrors] + + +out/source.d.ts(1,10): error TS2304: Cannot find name 'MyClass'. +out/source.d.ts(2,34): error TS1005: '=>' expected. + + +==== out/source.d.ts (2 errors) ==== + export = MyClass; + ~~~~~~~ +!!! error TS2304: Cannot find name 'MyClass'. + type DoneCB = (failures: number) ; + ~ +!!! error TS1005: '=>' expected. + /** + * Callback to be invoked when test execution is complete. + * + * @callback DoneCB + * @param {number} failures - Number of failures that occurred. + */ + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff index a39243d2a7..e8683e5d6d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff @@ -23,7 +23,7 @@ -} -declare function staticMethod(): void; -declare var staticProperty: number; -+export type DoneCB = (failures: number) ; ++type DoneCB = (failures: number) ; /** * Callback to be invoked when test execution is complete. - */ @@ -31,4 +31,27 @@ + * + * @callback DoneCB + * @param {number} failures - Number of failures that occurred. -+ */ \ No newline at end of file ++ */ ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/source.d.ts(1,10): error TS2304: Cannot find name 'MyClass'. ++out/source.d.ts(2,34): error TS1005: '=>' expected. ++ ++ ++==== out/source.d.ts (2 errors) ==== ++ export = MyClass; ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'MyClass'. ++ type DoneCB = (failures: number) ; ++ ~ ++!!! error TS1005: '=>' expected. ++ /** ++ * Callback to be invoked when test execution is complete. ++ * ++ * @callback DoneCB ++ * @param {number} failures - Number of failures that occurred. ++ */ ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index e25ccebe0d..927cd65fb6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -7,10 +7,9 @@ file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. file2.js(6,11): error TS2315: Type 'Object' is not generic. file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. -file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== file2.js (4 errors) ==== +==== file2.js (3 errors) ==== const {myTypes} = require('./file.js'); /** @@ -45,8 +44,6 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi } module.exports = {testFn, testFnTypes}; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ==== file.js (6 errors) ==== /** * @namespace myTypes diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js index 55d6a0df23..37991a3807 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js @@ -69,7 +69,7 @@ export type myTypes = myTypes.typeB | Function; /** @typedef {myTypes.typeB|Function} myTypes.typeC */ export var myTypes = myTypes; //// [file2.d.ts] -export type testFnTypes = boolean | myTypes.typeC; +type testFnTypes = boolean | myTypes.typeC; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js.diff index ff18b56816..c029b48751 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.js.diff @@ -39,7 +39,7 @@ +/** @typedef {myTypes.typeB|Function} myTypes.typeC */ +export var myTypes = myTypes; //// [file2.d.ts] -+export type testFnTypes = boolean | myTypes.typeC; ++type testFnTypes = boolean | myTypes.typeC; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ /** * @function testFn diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt deleted file mode 100644 index 324fb0ae0d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt +++ /dev/null @@ -1,58 +0,0 @@ -mixed.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== index.js (0 errors) ==== - export {}; // flag file as module - /** - * @typedef {string | number | symbol} PropName - */ - - /** - * Callback - * - * @callback NumberToStringCb - * @param {number} a - * @returns {string} - */ - - /** - * @template T - * @typedef {T & {name: string}} MixinName - */ - - /** - * Identity function - * - * @template T - * @callback Identity - * @param {T} x - * @returns {T} - */ - -==== mixed.js (1 errors) ==== - /** - * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType - */ - /** - * @param {number} x - * @returns {SomeType} - */ - function doTheThing(x) { - return {x: ""+x}; - } - class ExportedThing { - z = "ok" - } - module.exports = { - ~~~~~~~~~~~~~~~~~~ - doTheThing, - ~~~~~~~~~~~~~~~ - ExportedThing, - ~~~~~~~~~~~~~~~~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - class LocalThing { - y = "ok" - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js index 1a5751e01d..971750baa2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js @@ -132,7 +132,7 @@ export type Identity = (x: T) => T; * @returns {T} */ //// [mixed.d.ts] -export type SomeType = { +type SomeType = { x: string; } | number | LocalThing | ExportedThing; /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff index 58e622dd4b..c1878b199d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.js.diff @@ -67,8 +67,11 @@ + * @returns {T} + */ //// [mixed.d.ts] - export type SomeType = { +-export type SomeType = { ++type SomeType = { x: string; + } | number | LocalThing | ExportedThing; + /** @@= skipped -39, +52 lines =@@ * @param {number} x * @returns {SomeType} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt index 23837dfb7d..95221ff45f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt @@ -1,9 +1,7 @@ -conn.js(11,1): error TS2309: An export assignment cannot be used in a module with other exported elements. usage.js(11,37): error TS2694: Namespace 'Conn' has no exported member 'Whatever'. -usage.js(16,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== conn.js (1 errors) ==== +==== conn.js (0 errors) ==== /** * @typedef {string | number} Whatever */ @@ -15,10 +13,8 @@ usage.js(16,1): error TS2309: An export assignment cannot be used in a module wi } module.exports = Conn; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== usage.js (2 errors) ==== +==== usage.js (1 errors) ==== /** * @typedef {import("./conn")} Conn */ @@ -37,10 +33,6 @@ usage.js(16,1): error TS2309: An export assignment cannot be used in a module wi } module.exports = { - ~~~~~~~~~~~~~~~~~~ Wrap - ~~~~~~~~ }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js index 4d67274d17..06071f1ade 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js @@ -69,10 +69,10 @@ module.exports = { //// [conn.d.ts] -export type Whatever = string | number; +type Whatever = string | number; export = Conn; //// [usage.d.ts] -export type Conn = import("./conn"); +type Conn = import("./conn"); /** * @typedef {import("./conn")} Conn */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff index e597ed2ed7..2a3aa10149 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.js.diff @@ -29,8 +29,7 @@ //// [conn.d.ts] -+export type Whatever = string | number; - export = Conn; +-export = Conn; -/** - * @typedef {string | number} Whatever - */ @@ -41,9 +40,11 @@ -declare namespace Conn { - export { Whatever }; -} --type Whatever = string | number; + type Whatever = string | number; ++export = Conn; //// [usage.d.ts] - export type Conn = import("./conn"); +-export type Conn = import("./conn"); ++type Conn = import("./conn"); /** * @typedef {import("./conn")} Conn */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt deleted file mode 100644 index 4c105d6974..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -LazySet.js(13,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== index.js (0 errors) ==== - const LazySet = require("./LazySet"); - - /** @type {LazySet} */ - const stringSet = undefined; - stringSet.addAll(stringSet); - - -==== LazySet.js (1 errors) ==== - // Comment out this JSDoc, and note that the errors index.js go away. - /** - * @typedef {Object} SomeObject - */ - class LazySet { - /** - * @param {LazySet} iterable - */ - addAll(iterable) {} - [Symbol.iterator]() {} - } - - module.exports = LazySet; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 0bb4eb949a..f7d9883fd3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,10 +1,8 @@ index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. -index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. module.js(24,12): error TS2315: Type 'Object' is not generic. -module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); /** @typedef {import('./module.js').TaskGroup} TaskGroup */ @@ -28,9 +26,7 @@ module.js(27,1): error TS2309: An export assignment cannot be used in a module w } module.exports = MainThreadTasks; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== module.js (2 errors) ==== +==== module.js (1 errors) ==== /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ /** @@ -60,11 +56,6 @@ module.js(27,1): error TS2309: An export assignment cannot be used in a module w const taskNameToGroup = {}; module.exports = { - ~~~~~~~~~~~~~~~~~~ taskGroups, - ~~~~~~~~~~~~~~~ taskNameToGroup, - ~~~~~~~~~~~~~~~~~~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js index 3bef7dea8d..065851e860 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js @@ -107,8 +107,8 @@ module.exports = MainThreadTasks; //// [module.d.ts] -export type TaskGroupIds = 'parseHTML' | 'styleLayout'; -export type TaskGroup = { +type TaskGroupIds = 'parseHTML' | 'styleLayout'; +type TaskGroup = { id: TaskGroupIds; label: string; traceEventNames: string[]; @@ -128,13 +128,13 @@ declare const _default: { }; export = _default; //// [index.d.ts] -export type TaskGroup = import('./module.js').TaskGroup; -export type TaskNode = { +type TaskGroup = import('./module.js').TaskGroup; +type TaskNode = { children: TaskNode[]; parent: TaskNode | undefined; group: TaskGroup; }; -export type PriorTaskData = { +type PriorTaskData = { timers: Map; }; export = MainThreadTasks; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff index 014dd8fd76..9522ac6466 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.js.diff @@ -28,8 +28,9 @@ //// [module.d.ts] -export type TaskGroupIds = "parseHTML" | "styleLayout"; -+export type TaskGroupIds = 'parseHTML' | 'styleLayout'; - export type TaskGroup = { +-export type TaskGroup = { ++type TaskGroupIds = 'parseHTML' | 'styleLayout'; ++type TaskGroup = { id: TaskGroupIds; label: string; traceEventNames: string[]; @@ -86,15 +87,12 @@ - export { TaskGroup, TaskNode, PriorTaskData }; -} -type TaskGroup = import("./module.js").TaskGroup; --type TaskNode = { -+export type TaskGroup = import('./module.js').TaskGroup; -+export type TaskNode = { ++type TaskGroup = import('./module.js').TaskGroup; + type TaskNode = { children: TaskNode[]; parent: TaskNode | undefined; - group: TaskGroup; - }; --type PriorTaskData = { -+export type PriorTaskData = { +@@= skipped -57, +35 lines =@@ + type PriorTaskData = { timers: Map; }; +export = MainThreadTasks; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt deleted file mode 100644 index d5614f6c67..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== MC.js (1 errors) ==== - const MW = require("./MW"); - - /** @typedef {number} Cictema */ - - module.exports = class MC { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - watch() { - ~~~~~~~~~~~ - return new MW(this); - ~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~ - }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - -==== MW.js (1 errors) ==== - /** @typedef {import("./MC")} MC */ - - class MW { - /** - * @param {MC} compiler the compiler - */ - constructor(compiler) { - this.compiler = compiler; - } - } - - module.exports = MW; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt index 38ff7cb972..c417b8fb00 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@ -1,27 +1,19 @@ -MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? -MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MC.js (1 errors) ==== +==== MC.js (0 errors) ==== const MW = require("./MW"); /** @typedef {number} Meyerhauser */ /** @class */ module.exports = function MC() { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @type {any} */ - ~~~~~~~~~~~~~~~~~~~~~~ var x = {} - ~~~~~~~~~~~~~~ return new MW(x); - ~~~~~~~~~~~~~~~~~~~~~ }; - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MW.js (2 errors) ==== +==== MW.js (1 errors) ==== /** @typedef {import("./MC")} MC */ ~~~~~~~~~~~~~~ !!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? @@ -36,6 +28,4 @@ MW.js(12,1): error TS2309: An export assignment cannot be used in a module with } module.exports = MW; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.errors.txt index ac0068ee74..82c52e07fa 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias4.errors.txt @@ -1,13 +1,10 @@ -bug24024.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. bug24024.js(4,16): error TS2339: Property 'D' does not exist on type 'typeof C'. -==== bug24024.js (2 errors) ==== +==== bug24024.js (1 errors) ==== // #24024 var wat = require('./bug24024') module.exports = class C {} - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.D = class D { } ~ !!! error TS2339: Property 'D' does not exist on type 'typeof C'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt index e5b61208a5..da2cccfc30 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt @@ -1,8 +1,7 @@ Eloquent.js(5,1): error TS1231: An export assignment must be at the top level of a file or module declaration. -Eloquent.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== Eloquent.js (2 errors) ==== +==== Eloquent.js (1 errors) ==== // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript (function() { exports.bigOak = 1 @@ -10,7 +9,5 @@ Eloquent.js(5,1): error TS2309: An export assignment cannot be used in a module module.exports = exports ~~~~~~ !!! error TS1231: An export assignment must be at the top level of a file or module declaration. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. })() \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt index 6eb423476b..eb7526088a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt @@ -1,9 +1,8 @@ bug28014.js(1,9): error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. bug28014.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -bug28014.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== bug28014.js (3 errors) ==== +==== bug28014.js (2 errors) ==== exports.version = 1 ~~~~~~~ !!! error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. @@ -11,8 +10,6 @@ bug28014.js(3,1): error TS2309: An export assignment cannot be used in a module module.exports = alias ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ==== importer.js (0 errors) ==== import('./bug28014') diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.errors.txt index 279d2ef30a..78eaef2a8a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasUnknown.errors.txt @@ -1,13 +1,10 @@ -bug27025.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. bug27025.js(1,25): error TS2339: Property 'nonprop' does not exist on type 'Window & typeof globalThis'. bug27025.js(2,9): error TS2339: Property 'foo' does not exist on type 'typeof import("bug27025")'. bug27025.js(2,15): error TS2304: Cannot find name 'bar'. -==== bug27025.js (4 errors) ==== +==== bug27025.js (3 errors) ==== module.exports = window.nonprop; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~~~~~~~ !!! error TS2339: Property 'nonprop' does not exist on type 'Window & typeof globalThis'. exports.foo = bar; diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.errors.txt index a505beb7ed..2a2e1fbe94 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment4.errors.txt @@ -1,12 +1,9 @@ async.js(1,9): error TS2339: Property 'default' does not exist on type 'typeof import("async")'. -async.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== async.js (2 errors) ==== +==== async.js (1 errors) ==== exports.default = { m: 1, a: 1 } ~~~~~~~ !!! error TS2339: Property 'default' does not exist on type 'typeof import("async")'. module.exports = exports['default']; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt index 817b5b7b5b..865967e7d2 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt @@ -1,8 +1,7 @@ -axios.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. axios.js(10,16): error TS2339: Property 'default' does not exist on type 'Axios'. -==== axios.js (2 errors) ==== +==== axios.js (1 errors) ==== class Axios { constructor() { } @@ -12,8 +11,6 @@ axios.js(10,16): error TS2339: Property 'default' does not exist on type 'Axios' // none of the 3 references should have a use-before-def error axios.m() module.exports = axios; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.default = axios; ~~~~~~~ !!! error TS2339: Property 'default' does not exist on type 'Axios'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 88bbc580cf..201e26c41e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -14,32 +14,22 @@ main.js(6,28): error TS2694: Namespace '"mod".export=' has no exported member 'b main.js(7,28): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. main.js(8,28): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. main.js(20,35): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -mod.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== mod.js (1 errors) ==== +==== mod.js (0 errors) ==== class Thing { x = 1 } class AnotherThing { y = 2 } function foo() { return 3 } function bar() { return 4 } /** @typedef {() => number} buz */ module.exports = { - ~~~~~~~~~~~~~~~~~~ Thing, - ~~~~~~~~~~ AnotherThing, - ~~~~~~~~~~~~~~~~~ foo, - ~~~~~~~~ qux: bar, - ~~~~~~~~~~~~~ baz() { return 5 }, - ~~~~~~~~~~~~~~~~~~~~~~~ literal: "", - ~~~~~~~~~~~~~~~~ } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ==== main.js (8 errors) ==== /** * @param {import("./mod").Thing} a diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt index 3867a2f253..061af490ed 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt @@ -1,12 +1,9 @@ -axios.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. axios.js(3,16): error TS2339: Property 'default' does not exist on type '{}'. -==== axios.js (2 errors) ==== +==== axios.js (1 errors) ==== var axios = {} module.exports = axios // both assignments should be ok - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.default = axios ~~~~~~~ !!! error TS2339: Property 'default' does not exist on type '{}'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt index c062fa89da..12914a15e5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt @@ -1,5 +1,4 @@ a.js(4,6): error TS2339: Property 'f' does not exist on type '() => void'. -mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. @@ -14,11 +13,9 @@ mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (2 errors) ==== +==== mod1.js (1 errors) ==== /// module.exports = function () { } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. /** @param {number} a */ module.exports.f = function (a) { } ~ diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt index 7d5e2c2c91..08f3bfbc82 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt @@ -1,5 +1,4 @@ a.js(4,6): error TS2339: Property 'f' does not exist on type '1'. -mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. @@ -14,11 +13,9 @@ mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (2 errors) ==== +==== mod1.js (1 errors) ==== /// module.exports = 1 - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.f = function () { } ~ !!! error TS2339: Property 'f' does not exist on type '1'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt index 0048e20c35..5417ce1b38 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt @@ -1,6 +1,5 @@ a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. -mod1.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. mod1.js(8,1): error TS2322: Type 'string' is not assignable to type 'number'. mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. @@ -18,22 +17,16 @@ mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ j ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (4 errors) ==== +==== mod1.js (3 errors) ==== /// module.exports.bothBefore = 'string' ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'number'. module.exports = { - ~~~~~~~~~~~~~~~~~~ justExport: 1, - ~~~~~~~~~~~~~~~~~~ bothBefore: 2, - ~~~~~~~~~~~~~~~~~~ bothAfter: 3, - ~~~~~~~~~~~~~~~~~ } - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.bothAfter = 'string' ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt index 040e68925d..92baa7666c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt @@ -1,6 +1,5 @@ a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. -mod1.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. mod1.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. @@ -18,7 +17,7 @@ mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (4 errors) ==== +==== mod1.js (3 errors) ==== /// module.exports.bothBefore = 'string' ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -27,8 +26,6 @@ mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ A.bothBefore = 2 A.bothAfter = 3 module.exports = A - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. function A() { this.p = 1 } diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt index cec769759b..1007bdc830 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt @@ -1,17 +1,14 @@ -mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. use.js(1,29): error TS2694: Namespace 'C' has no exported member 'Both'. ==== commonjs.d.ts (0 errors) ==== declare var module: { exports: any}; -==== mod1.js (1 errors) ==== +==== mod1.js (0 errors) ==== /// /** @typedef {{ type: "a", x: 1 }} A */ /** @typedef {{ type: "b", y: 1 }} B */ /** @typedef {A | B} Both */ module.exports = C - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. function C() { this.p = 1 } diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index d48c75aeb1..f9a71119fa 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -2,7 +2,6 @@ mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. mod1.js(10,1): error TS2300: Duplicate identifier 'export='. -mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. mod1.js(23,1): error TS2300: Duplicate identifier 'export='. mod1.js(24,5): error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. @@ -22,7 +21,7 @@ use.js(4,12): error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); -==== mod1.js (8 errors) ==== +==== mod1.js (7 errors) ==== // error /** @typedef {number} Foo */ @@ -39,16 +38,12 @@ use.js(4,12): error TS2503: Cannot find namespace 'mod'. /** @typedef {number} Baz */ module.exports = { - ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ Baz: class { } ~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~ } ~ !!! error TS2300: Duplicate identifier 'export='. - ~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. // ok diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt deleted file mode 100644 index cb8b1e13b1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -mod2.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== mod2.js (1 errors) ==== - /** @typedef {number} Foo */ - const ns = {}; - ns.Foo = class {} - module.exports = ns; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt deleted file mode 100644 index a7d9cbb9a3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -mod3.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== mod3.js (1 errors) ==== - /** @typedef {number} Foo */ - class Bar { } - module.exports = { Foo: Bar }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff deleted file mode 100644 index af290d6fc7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.checkJsTypeDefNoUnusedLocalMarked.errors.txt -+++ new.checkJsTypeDefNoUnusedLocalMarked.errors.txt -@@= skipped -0, +0 lines =@@ -- -+something.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== file.ts (0 errors) ==== -+ class Foo { -+ x: number; -+ } -+ -+ declare global { -+ var module: any; // Just here to remove unrelated error from test -+ } -+ -+ export = Foo; -+==== something.js (1 errors) ==== -+ /** @typedef {typeof import("./file")} Foo */ -+ -+ /** @typedef {(foo: Foo) => string} FooFun */ -+ -+ module.exports = /** @type {FooFun} */(void 0); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff deleted file mode 100644 index 6569dcf3a6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ /dev/null @@ -1,65 +0,0 @@ ---- old.expandoFunctionContextualTypesJs.errors.txt -+++ new.expandoFunctionContextualTypesJs.errors.txt -@@= skipped -0, +0 lines =@@ -- -+input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== input.js (1 errors) ==== -+ /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ -+ -+ /** -+ * @template P -+ * @typedef {{ (): any; defaultProps?: Partial

}} StatelessComponent */ -+ -+ /** -+ * @type {StatelessComponent} -+ */ -+ const MyComponent = () => /* @type {any} */(null); -+ -+ MyComponent.defaultProps = { -+ color: "red" -+ }; -+ -+ const MyComponent2 = () => null; -+ -+ /** -+ * @type {MyComponentProps} -+ */ -+ MyComponent2.defaultProps = { -+ color: "red" -+ } -+ -+ /** -+ * @type {StatelessComponent} -+ */ -+ const check = MyComponent2; -+ -+ /** -+ * -+ * @param {{ props: MyComponentProps }} p -+ */ -+ function expectLiteral(p) {} -+ -+ function foo() { -+ /** -+ * @type {MyComponentProps} -+ */ -+ this.props = { color: "red" }; -+ -+ expectLiteral(this); -+ } -+ -+ /** -+ * @type {MyComponentProps} -+ */ -+ module.exports = { -+ ~~~~~~~~~~~~~~~~~~ -+ color: "red" -+ ~~~~~~~~~~~~~~~~ -+ } -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ expectLiteral({ props: module.exports }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff index 6b73aa246f..c67d7cf39f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff @@ -2,11 +2,10 @@ +++ new.jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + /** + * @typedef Options + * @property {string} opt @@ -16,8 +15,6 @@ + * @param {Options} options + */ + module.exports = function loader(options) {} -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~~~~~~~ +!!! error TS7006: Parameter 'options' implicitly has an 'any' type. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.errors.txt.diff index e08d3cffc5..f32a999cef 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportAssignmentNonMutableLocation.errors.txt.diff @@ -2,21 +2,16 @@ +++ new.jsExportAssignmentNonMutableLocation.errors.txt @@= skipped -0, +0 lines =@@ - -+file.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +file.js(8,9): error TS2339: Property 'customSymbol2' does not exist on type 'typeof import("file")'. + + -+==== file.js (2 errors) ==== ++==== file.js (1 errors) ==== + const customSymbol = Symbol("custom"); + + // This is a common pattern in Node’s built-in modules: + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + customSymbol, -+ ~~~~~~~~~~~~~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + + exports.customSymbol2 = Symbol("custom"); + ~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt.diff index 9692f66f57..3b0dbe524e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExportMemberMergedWithModuleAugmentation3.errors.txt.diff @@ -3,16 +3,13 @@ @@= skipped -0, +0 lines =@@ - +/x.js(1,16): error TS2339: Property 'x' does not exist on type 'typeof import("/y")'. -+/x.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== /x.js (2 errors) ==== ++==== /x.js (1 errors) ==== + module.exports.x = 1; + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof import("/y")'. + module.exports = require("./y.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + +==== /y.d.ts (0 errors) ==== + export declare type x = 1; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff deleted file mode 100644 index b30aabfac8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt -+++ new.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt -@@= skipped -0, +0 lines =@@ -- -+typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== eslint.config.js (0 errors) ==== -+ const eslintReact = require('./eslint-plugin-react.js'); -+ const tseslint = require('./typescript-eslint.js'); -+ -+ tseslint.config(eslintReact) -+ -+==== eslint-plugin-react.js (0 errors) ==== -+ const deprecatedRules = { -+ "jsx-sort-default-props": true -+ } -+ -+ const allRules = { -+ 'no-unsafe': true -+ } -+ -+ module.exports = { -+ plugins: { -+ react: { -+ deprecatedRules, -+ rules: allRules, -+ }, -+ }, -+ }; -+ -+==== typescript-eslint.js (1 errors) ==== -+ /** -+ * @typedef {{ rules: Record }} Plugin -+ */ -+ -+ /** -+ * @typedef {{ plugins: Record }} Config -+ */ -+ -+ /** -+ * @type {(...configs: Config[]) => void} -+ */ -+ function config(...configs) { } -+ -+ module.exports = { config }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/pushTypeGetTypeOfAlias.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/pushTypeGetTypeOfAlias.errors.txt.diff index 482670b5fb..ed8a36a6ac 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/pushTypeGetTypeOfAlias.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/pushTypeGetTypeOfAlias.errors.txt.diff @@ -3,18 +3,12 @@ @@= skipped -0, +0 lines =@@ -bar.js(2,1): error TS2303: Circular definition of import alias 'blah'. -bar.js(2,24): error TS2339: Property 'someProp' does not exist on type '{ (): void; blah: any; }'. -- -- --==== bar.js (2 errors) ==== -+bar.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +bar.js(2,9): error TS2339: Property 'blah' does not exist on type 'typeof import("bar")'. +bar.js(2,24): error TS2339: Property 'someProp' does not exist on type 'typeof import("bar")'. -+ -+ -+==== bar.js (3 errors) ==== + + + ==== bar.js (2 errors) ==== module.exports = function () {}; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. exports.blah = exports.someProp; - ~~~~~~~~~~~~ -!!! error TS2303: Circular definition of import alias 'blah'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff index b3e507b55d..7e0b3df97e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff @@ -2,18 +2,15 @@ +++ new.callbackCrossModule.errors.txt @@= skipped -0, +0 lines =@@ - -+mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. + + -+==== mod1.js (1 errors) ==== ++==== mod1.js (0 errors) ==== + /** @callback Con - some kind of continuation + * @param {object | undefined} error + * @return {any} I don't even know what this should return + */ + module.exports = C -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + function C() { + this.p = 1 + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff index 18e8e7a09d..4cd5e08ee0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff @@ -3,7 +3,6 @@ @@= skipped -0, +0 lines =@@ - +bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. -+commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. + + @@ -16,15 +15,13 @@ + var diddy = funky(1) + + -+==== commonJSAliasedExport.js (2 errors) ==== ++==== commonJSAliasedExport.js (1 errors) ==== + const donkey = (ast) => ast; + + function funky(declaration) { + return false; + } + module.exports = donkey; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.funky = funky; + ~~~~~ +!!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/conflictingCommonJSES2015Exports.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/conflictingCommonJSES2015Exports.errors.txt.diff index 2d20070de6..de9b53349f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/conflictingCommonJSES2015Exports.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/conflictingCommonJSES2015Exports.errors.txt.diff @@ -2,18 +2,18 @@ +++ new.conflictingCommonJSES2015Exports.errors.txt @@= skipped -0, +0 lines =@@ -bug24934.js(2,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+bug24934.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +- +- +-==== bug24934.js (1 errors) ==== +use.js(1,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export. - - - ==== bug24934.js (1 errors) ==== ++ ++ ++==== bug24934.js (0 errors) ==== export function abc(a, b, c) { return 5; } module.exports = { abc }; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -==== use.js (0 errors) ==== -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. +==== use.js (1 errors) ==== import { abc } from './bug24934'; + ~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff index a6219f736e..c5f26f59c8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff @@ -2,11 +2,10 @@ +++ new.jsDeclarationsClassExtendsVisibility.errors.txt @@= skipped -0, +0 lines =@@ - -+cls.js(7,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +cls.js(8,16): error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. + + -+==== cls.js (2 errors) ==== ++==== cls.js (1 errors) ==== + const Bar = require("./bar"); + const Strings = { + a: "A", @@ -14,8 +13,6 @@ + }; + class Foo extends Bar {} + module.exports = Foo; -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Strings = Strings; + ~~~~~~~ +!!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff index ce30c8bd44..cca1f98efc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff @@ -2,11 +2,10 @@ +++ new.jsDeclarationsClassStatic.errors.txt @@= skipped -0, +0 lines =@@ - -+source.js(15,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +source.js(16,16): error TS2339: Property 'Strings' does not exist on type 'typeof Handler'. + + -+==== source.js (2 errors) ==== ++==== source.js (1 errors) ==== + class Handler { + static get OPTIONS() { + return 1; @@ -22,8 +21,6 @@ + } + + module.exports = Handler; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Strings = Strings + ~~~~~~~ +!!! error TS2339: Property 'Strings' does not exist on type 'typeof Handler'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.errors.txt.diff index 19a2e2639e..22a8dc576d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCrossfileMerge.errors.txt.diff @@ -2,19 +2,13 @@ +++ new.jsDeclarationsCrossfileMerge.errors.txt @@= skipped -0, +0 lines =@@ -index.js(4,1): error TS6232: Declaration augments declaration in another file. This cannot be serialized. -- -- --==== index.js (1 errors) ==== -+index.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(4,16): error TS2339: Property 'memberName' does not exist on type '() => void'. -+ -+ -+==== index.js (2 errors) ==== - const m = require("./exporter"); + + + ==== index.js (1 errors) ==== +@@= skipped -5, +5 lines =@@ module.exports = m.default; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.memberName = "thing"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS6232: Declaration augments declaration in another file. This cannot be serialized. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff index 2fed47c399..babf0f48e5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt.diff @@ -2,28 +2,18 @@ +++ new.jsDeclarationsExportAssignedClassExpressionAnonymousWithSub.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + module.exports = class { -+ ~~~~~~~~~~~~~~~~~~~~~~~~ + /** -+ ~~~~~~~ + * @param {number} p -+ ~~~~~~~~~~~~~~~~~~~~~~~~ + */ -+ ~~~~~~~ + constructor(p) { -+ ~~~~~~~~~~~~~~~~~~~~ + this.t = 12 + p; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ + } -+ ~~~~~ + } -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Sub = class { + ~~~ +!!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt.diff index 4d83551202..71ae148ae8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt.diff @@ -2,11 +2,10 @@ +++ new.jsDeclarationsExportAssignedClassExpressionShadowing.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(7,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(12,16): error TS2339: Property 'Another' does not exist on type 'typeof Q'. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + class A { + member = new Q(); + } @@ -14,16 +13,10 @@ + x = 42; + } + module.exports = class Q { -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ + constructor() { -+ ~~~~~~~~~~~~~~~~~~~ + this.x = new A(); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~ + } -+ ~~~~~ + } -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Another = Q; + ~~~~~~~ +!!! error TS2339: Property 'Another' does not exist on type 'typeof Q'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt.diff index 92551a8926..fc339f03f6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedClassInstance3.errors.txt.diff @@ -2,19 +2,16 @@ +++ new.jsDeclarationsExportAssignedClassInstance3.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(8,16): error TS2339: Property 'additional' does not exist on type 'Foo'. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + class Foo { + static stat = 10; + member = 10; + } + + module.exports = new Foo(); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + + module.exports.additional = 20; + ~~~~~~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff index fd12f89044..58c52619b4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedConstructorFunctionWithSub.errors.txt.diff @@ -3,16 +3,12 @@ @@= skipped -0, +0 lines =@@ -jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS9005: Declaration emit for this file requires using private name 'Sub'. An explicit type annotation may unblock declaration emit. -jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS9005: Declaration emit for this file requires using private name 'exports'. An explicit type annotation may unblock declaration emit. -- -- --==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (2 errors) ==== -+jsDeclarationsExportAssignedConstructorFunctionWithSub.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +jsDeclarationsExportAssignedConstructorFunctionWithSub.js(7,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. +jsDeclarationsExportAssignedConstructorFunctionWithSub.js(10,16): error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. -+ -+ -+==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (3 errors) ==== - /** + + + ==== jsDeclarationsExportAssignedConstructorFunctionWithSub.js (2 errors) ==== +@@= skipped -6, +6 lines =@@ * @param {number} p */ module.exports = function (p) { @@ -20,12 +16,8 @@ -!!! error TS9005: Declaration emit for this file requires using private name 'Sub'. An explicit type annotation may unblock declaration emit. - ~~~~~~ -!!! error TS9005: Declaration emit for this file requires using private name 'exports'. An explicit type annotation may unblock declaration emit. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this.t = 12 + p; -+ ~~~~~~~~~~~~~~~~~~~~ } -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.Sub = function() { + ~~~ +!!! error TS2339: Property 'Sub' does not exist on type '(p: any) => void'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt.diff index b5e42cf6f2..5e2d623c8a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt.diff @@ -2,30 +2,21 @@ +++ new.jsDeclarationsExportAssignmentExpressionPlusSecondary.errors.txt @@= skipped -0, +0 lines =@@ - -+index.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +index.js(12,16): error TS2339: Property 'Strings' does not exist on type '{ thing: string; also: string; desc: { item: string; }; }'. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + const Strings = { + a: "A", + b: "B" + }; + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + thing: "ok", -+ ~~~~~~~~~~~~~~~~ + also: "ok", -+ ~~~~~~~~~~~~~~~ + desc: { -+ ~~~~~~~~~~~ + item: "ok" -+ ~~~~~~~~~~~~~~~~~~ + } -+ ~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Strings = Strings; + ~~~~~~~ +!!! error TS2339: Property 'Strings' does not exist on type '{ thing: string; also: string; desc: { item: string; }; }'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff index 6ee3dfba79..514fa4500d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff @@ -2,19 +2,16 @@ +++ new.jsDeclarationsExportSubAssignments.errors.txt @@= skipped -0, +0 lines =@@ - -+cls.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +cls.js(7,16): error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. + + -+==== cls.js (2 errors) ==== ++==== cls.js (1 errors) ==== + const Strings = { + a: "A", + b: "B" + }; + class Foo {} + module.exports = Foo; -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.Strings = Strings; + ~~~~~~~ +!!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index be95625d15..5d7694f456 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -6,9 +6,7 @@ +context.js(5,14): error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? +context.js(6,31): error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. +context.js(34,14): error TS2350: Only a void function can be called with the 'new' keyword. -+context.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./context')'? -+hook.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== timer.js (0 errors) ==== @@ -19,7 +17,7 @@ + this.timeout = timeout; + } + module.exports = Timer; -+==== hook.js (2 errors) ==== ++==== hook.js (1 errors) ==== + /** + * @typedef {(arg: import("./context")) => void} HookHandler + ~~~~~~~~~~~~~~~~~~~ @@ -32,10 +30,8 @@ + this.handle = handle; + } + module.exports = Hook; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== context.js (5 errors) ==== ++==== context.js (4 errors) ==== + /** + * Imports + * @@ -92,6 +88,4 @@ + } + } + module.exports = Context; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff deleted file mode 100644 index bf29d0665d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsDeclarationsFunctionPrototypeStatic.errors.txt -+++ new.jsDeclarationsFunctionPrototypeStatic.errors.txt -@@= skipped -0, +0 lines =@@ -- -+source.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== source.js (1 errors) ==== -+ module.exports = MyClass; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ function MyClass() {} -+ MyClass.staticMethod = function() {} -+ MyClass.prototype.method = function() {} -+ MyClass.staticProperty = 123; -+ -+ /** -+ * Callback to be invoked when test execution is complete. -+ * -+ * @callback DoneCB -+ * @param {number} failures - Number of failures that occurred. -+ */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index 516be88695..e1c0b8a4c9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -11,10 +11,9 @@ +file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. -+file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== file2.js (4 errors) ==== ++==== file2.js (3 errors) ==== + const {myTypes} = require('./file.js'); + + /** @@ -49,8 +48,6 @@ + } + + module.exports = {testFn, testFnTypes}; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. +==== file.js (6 errors) ==== + /** + * @namespace myTypes diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.errors.txt.diff deleted file mode 100644 index 87be54e949..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.errors.txt.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- old.jsDeclarationsTypeAliases.errors.txt -+++ new.jsDeclarationsTypeAliases.errors.txt -@@= skipped -0, +0 lines =@@ -- -+mixed.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== index.js (0 errors) ==== -+ export {}; // flag file as module -+ /** -+ * @typedef {string | number | symbol} PropName -+ */ -+ -+ /** -+ * Callback -+ * -+ * @callback NumberToStringCb -+ * @param {number} a -+ * @returns {string} -+ */ -+ -+ /** -+ * @template T -+ * @typedef {T & {name: string}} MixinName -+ */ -+ -+ /** -+ * Identity function -+ * -+ * @template T -+ * @callback Identity -+ * @param {T} x -+ * @returns {T} -+ */ -+ -+==== mixed.js (1 errors) ==== -+ /** -+ * @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType -+ */ -+ /** -+ * @param {number} x -+ * @returns {SomeType} -+ */ -+ function doTheThing(x) { -+ return {x: ""+x}; -+ } -+ class ExportedThing { -+ z = "ok" -+ } -+ module.exports = { -+ ~~~~~~~~~~~~~~~~~~ -+ doTheThing, -+ ~~~~~~~~~~~~~~~ -+ ExportedThing, -+ ~~~~~~~~~~~~~~~~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ class LocalThing { -+ y = "ok" -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff index 63315a780b..6cc343d713 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff @@ -2,12 +2,10 @@ +++ new.jsDeclarationsTypedefAndImportTypes.errors.txt @@= skipped -0, +0 lines =@@ - -+conn.js(11,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +usage.js(11,37): error TS2694: Namespace 'Conn' has no exported member 'Whatever'. -+usage.js(16,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== conn.js (1 errors) ==== ++==== conn.js (0 errors) ==== + /** + * @typedef {string | number} Whatever + */ @@ -19,10 +17,8 @@ + } + + module.exports = Conn; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== usage.js (2 errors) ==== ++==== usage.js (1 errors) ==== + /** + * @typedef {import("./conn")} Conn + */ @@ -41,10 +37,6 @@ + } + + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + Wrap -+ ~~~~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff deleted file mode 100644 index cbea1dc733..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.jsDeclarationsTypedefAndLatebound.errors.txt -+++ new.jsDeclarationsTypedefAndLatebound.errors.txt -@@= skipped -0, +0 lines =@@ -- -+LazySet.js(13,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== index.js (0 errors) ==== -+ const LazySet = require("./LazySet"); -+ -+ /** @type {LazySet} */ -+ const stringSet = undefined; -+ stringSet.addAll(stringSet); -+ -+ -+==== LazySet.js (1 errors) ==== -+ // Comment out this JSDoc, and note that the errors index.js go away. -+ /** -+ * @typedef {Object} SomeObject -+ */ -+ class LazySet { -+ /** -+ * @param {LazySet} iterable -+ */ -+ addAll(iterable) {} -+ [Symbol.iterator]() {} -+ } -+ -+ module.exports = LazySet; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index a95ad05e93..35d157d7f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -3,12 +3,10 @@ @@= skipped -0, +0 lines =@@ - +index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. -+index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +module.js(24,12): error TS2315: Type 'Object' is not generic. -+module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== index.js (2 errors) ==== ++==== index.js (1 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ @@ -32,9 +30,7 @@ + } + + module.exports = MainThreadTasks; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== module.js (2 errors) ==== ++==== module.js (1 errors) ==== + /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + + /** @@ -64,11 +60,6 @@ + const taskNameToGroup = {}; + + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + taskGroups, -+ ~~~~~~~~~~~~~~~ + taskNameToGroup, -+ ~~~~~~~~~~~~~~~~~~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file ++ }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff deleted file mode 100644 index 9e66ced279..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.jsdocTypeReferenceToImportOfClassExpression.errors.txt -+++ new.jsdocTypeReferenceToImportOfClassExpression.errors.txt -@@= skipped -0, +0 lines =@@ -- -+MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== MC.js (1 errors) ==== -+ const MW = require("./MW"); -+ -+ /** @typedef {number} Cictema */ -+ -+ module.exports = class MC { -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ watch() { -+ ~~~~~~~~~~~ -+ return new MW(this); -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+ } -+ ~~~ -+ }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+==== MW.js (1 errors) ==== -+ /** @typedef {import("./MC")} MC */ -+ -+ class MW { -+ /** -+ * @param {MC} compiler the compiler -+ */ -+ constructor(compiler) { -+ this.compiler = compiler; -+ } -+ } -+ -+ module.exports = MW; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff index b9969a5cd3..9bfe5f4620 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff @@ -2,30 +2,22 @@ +++ new.jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@= skipped -0, +0 lines =@@ - -+MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? -+MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== MC.js (1 errors) ==== ++==== MC.js (0 errors) ==== + const MW = require("./MW"); + + /** @typedef {number} Meyerhauser */ + + /** @class */ + module.exports = function MC() { -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** @type {any} */ -+ ~~~~~~~~~~~~~~~~~~~~~~ + var x = {} -+ ~~~~~~~~~~~~~~ + return new MW(x); -+ ~~~~~~~~~~~~~~~~~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== MW.js (2 errors) ==== ++==== MW.js (1 errors) ==== + /** @typedef {import("./MC")} MC */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? @@ -40,6 +32,4 @@ + } + + module.exports = MW; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.errors.txt.diff index e6471bf1ea..9b74652d01 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias4.errors.txt.diff @@ -2,16 +2,13 @@ +++ new.moduleExportAlias4.errors.txt @@= skipped -0, +0 lines =@@ - -+bug24024.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +bug24024.js(4,16): error TS2339: Property 'D' does not exist on type 'typeof C'. + + -+==== bug24024.js (2 errors) ==== ++==== bug24024.js (1 errors) ==== + // #24024 + var wat = require('./bug24024') + module.exports = class C {} -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.D = class D { } + ~ +!!! error TS2339: Property 'D' does not exist on type 'typeof C'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff index 2d9f3d0eb6..be233df93b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff @@ -3,10 +3,9 @@ @@= skipped -0, +0 lines =@@ - +Eloquent.js(5,1): error TS1231: An export assignment must be at the top level of a file or module declaration. -+Eloquent.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== Eloquent.js (2 errors) ==== ++==== Eloquent.js (1 errors) ==== + // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript + (function() { + exports.bigOak = 1 @@ -14,7 +13,5 @@ + module.exports = exports + ~~~~~~ +!!! error TS1231: An export assignment must be at the top level of a file or module declaration. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + })() + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff index c186069997..7471989c0c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff @@ -4,10 +4,9 @@ - +bug28014.js(1,9): error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. +bug28014.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -+bug28014.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== bug28014.js (3 errors) ==== ++==== bug28014.js (2 errors) ==== + exports.version = 1 + ~~~~~~~ +!!! error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. @@ -15,8 +14,6 @@ + module.exports = alias + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + +==== importer.js (0 errors) ==== + import('./bug28014') diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasUnknown.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasUnknown.errors.txt.diff index e1ea6b3fb7..821bb0c4dd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasUnknown.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasUnknown.errors.txt.diff @@ -1,17 +1,14 @@ --- old.moduleExportAliasUnknown.errors.txt +++ new.moduleExportAliasUnknown.errors.txt @@= skipped -0, +0 lines =@@ -+bug27025.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements. bug27025.js(1,25): error TS2339: Property 'nonprop' does not exist on type 'Window & typeof globalThis'. +bug27025.js(2,9): error TS2339: Property 'foo' does not exist on type 'typeof import("bug27025")'. bug27025.js(2,15): error TS2304: Cannot find name 'bar'. -==== bug27025.js (2 errors) ==== -+==== bug27025.js (4 errors) ==== ++==== bug27025.js (3 errors) ==== module.exports = window.nonprop; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ~~~~~~~ !!! error TS2339: Property 'nonprop' does not exist on type 'Window & typeof globalThis'. exports.foo = bar; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.errors.txt.diff index 25cc88f045..3b6bd1bce6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment4.errors.txt.diff @@ -3,14 +3,11 @@ @@= skipped -0, +0 lines =@@ - +async.js(1,9): error TS2339: Property 'default' does not exist on type 'typeof import("async")'. -+async.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== async.js (2 errors) ==== ++==== async.js (1 errors) ==== + exports.default = { m: 1, a: 1 } + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type 'typeof import("async")'. + module.exports = exports['default']; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff index e0db10a68c..8b8d3aa80d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff @@ -2,11 +2,10 @@ +++ new.moduleExportAssignment5.errors.txt @@= skipped -0, +0 lines =@@ - -+axios.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +axios.js(10,16): error TS2339: Property 'default' does not exist on type 'Axios'. + + -+==== axios.js (2 errors) ==== ++==== axios.js (1 errors) ==== + class Axios { + constructor() { + } @@ -16,8 +15,6 @@ + // none of the 3 references should have a use-before-def error + axios.m() + module.exports = axios; -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.default = axios; + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type 'Axios'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff index db60a68388..6c35c2034b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff @@ -15,36 +15,13 @@ +main.js(7,28): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. +main.js(8,28): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. main.js(20,35): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. -- -- --==== mod.js (0 errors) ==== -+mod.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== mod.js (1 errors) ==== - class Thing { x = 1 } - class AnotherThing { y = 2 } - function foo() { return 3 } - function bar() { return 4 } - /** @typedef {() => number} buz */ - module.exports = { -+ ~~~~~~~~~~~~~~~~~~ - Thing, -+ ~~~~~~~~~~ - AnotherThing, -+ ~~~~~~~~~~~~~~~~~ - foo, -+ ~~~~~~~~ - qux: bar, -+ ~~~~~~~~~~~~~ + + +@@= skipped -19, +27 lines =@@ baz() { return 5 }, -+ ~~~~~~~~~~~~~~~~~~~~~~~ literal: "", -+ ~~~~~~~~~~~~~~~~ } -==== main.js (1 errors) ==== -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. +==== main.js (8 errors) ==== /** * @param {import("./mod").Thing} a @@ -71,7 +48,7 @@ */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length -@@= skipped -48, +80 lines =@@ +@@= skipped -29, +43 lines =@@ return a.length + b.length + c() + d() + e() + f() + g.length } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff index adfb2521e4..cc7ceabb34 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff @@ -2,15 +2,12 @@ +++ new.moduleExportPropertyAssignmentDefault.errors.txt @@= skipped -0, +0 lines =@@ - -+axios.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +axios.js(3,16): error TS2339: Property 'default' does not exist on type '{}'. + + -+==== axios.js (2 errors) ==== ++==== axios.js (1 errors) ==== + var axios = {} + module.exports = axios // both assignments should be ok -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.default = axios + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type '{}'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff index 78ce2117dc..f692d0aaf8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff @@ -3,12 +3,11 @@ @@= skipped -0, +0 lines =@@ -a.js(4,6): error TS2554: Expected 1 arguments, but got 0. +a.js(4,6): error TS2339: Property 'f' does not exist on type '() => void'. -+mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. ==== a.js (1 errors) ==== -@@= skipped -6, +8 lines =@@ +@@= skipped -6, +7 lines =@@ mod1() mod1.f() // error, not enough arguments ~ @@ -20,11 +19,9 @@ declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (0 errors) ==== -+==== mod1.js (2 errors) ==== ++==== mod1.js (1 errors) ==== /// module.exports = function () { } -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. /** @param {number} a */ module.exports.f = function (a) { } + ~ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff index fe3efec848..a952772d00 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff @@ -4,12 +4,11 @@ -a.js(4,6): error TS2339: Property 'f' does not exist on type 'number'. -mod1.js(3,16): error TS2339: Property 'f' does not exist on type 'number'. +a.js(4,6): error TS2339: Property 'f' does not exist on type '1'. -+mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. ==== a.js (1 errors) ==== -@@= skipped -7, +8 lines =@@ +@@= skipped -7, +7 lines =@@ mod1.toFixed(12) mod1.f() // error, 'f' is not a property on 'number' ~ @@ -18,13 +17,8 @@ ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; - declare function require(name: string): any; --==== mod1.js (1 errors) ==== -+==== mod1.js (2 errors) ==== - /// +@@= skipped -10, +10 lines =@@ module.exports = 1 -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.f = function () { } ~ -!!! error TS2339: Property 'f' does not exist on type 'number'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff index 6982a01c04..d9d65e4abb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff @@ -10,7 +10,6 @@ -==== a.js (2 errors) ==== +a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. +mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. -+mod1.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(8,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + @@ -35,22 +34,16 @@ declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (0 errors) ==== -+==== mod1.js (4 errors) ==== ++==== mod1.js (3 errors) ==== /// module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. module.exports = { -+ ~~~~~~~~~~~~~~~~~~ justExport: 1, -+ ~~~~~~~~~~~~~~~~~~ bothBefore: 2, -+ ~~~~~~~~~~~~~~~~~~ bothAfter: 3, -+ ~~~~~~~~~~~~~~~~~ } -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff index 57078c0343..2da9322706 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff @@ -14,7 +14,6 @@ -==== a.js (2 errors) ==== +a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. +mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. -+mod1.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + @@ -37,7 +36,9 @@ ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; -@@= skipped -28, +21 lines =@@ + declare function require(name: string): any; +-==== mod1.js (4 errors) ==== ++==== mod1.js (3 errors) ==== /// module.exports.bothBefore = 'string' ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -51,8 +52,6 @@ - ~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. module.exports = A -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. function A() { this.p = 1 } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff index 09af25bcff..82ad30d9ba 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff @@ -2,20 +2,17 @@ +++ new.typedefCrossModule.errors.txt @@= skipped -0, +0 lines =@@ - -+mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +use.js(1,29): error TS2694: Namespace 'C' has no exported member 'Both'. + + +==== commonjs.d.ts (0 errors) ==== + declare var module: { exports: any}; -+==== mod1.js (1 errors) ==== ++==== mod1.js (0 errors) ==== + /// + /** @typedef {{ type: "a", x: 1 }} A */ + /** @typedef {{ type: "b", y: 1 }} B */ + /** @typedef {A | B} Both */ + module.exports = C -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + function C() { + this.p = 1 + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index 0a4e1b8385..4ef5bffb62 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -12,7 +12,6 @@ +mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. +mod1.js(10,1): error TS2300: Duplicate identifier 'export='. -+mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. +mod1.js(23,1): error TS2300: Duplicate identifier 'export='. +mod1.js(24,5): error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. @@ -33,7 +32,7 @@ var bbb = new mod.Baz(); -==== mod1.js (4 errors) ==== -+==== mod1.js (8 errors) ==== ++==== mod1.js (7 errors) ==== // error /** @typedef {number} Foo */ @@ -55,23 +54,19 @@ -!!! error TS2300: Duplicate identifier 'Baz'. -!!! related TS6203 mod1.js:11:5: 'Baz' was also declared here. module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ Baz: class { } - ~~~ -!!! error TS2300: Duplicate identifier 'Baz'. -!!! related TS6203 mod1.js:9:23: 'Baz' was also declared here. -+ ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ } + ~ +!!! error TS2300: Duplicate identifier 'export='. -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. // ok -@@= skipped -42, +56 lines =@@ +@@= skipped -42, +51 lines =@@ /** @typedef {number} Quid */ exports.Quid = 2; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff index 36296f2c15..ae9af08179 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff @@ -6,21 +6,16 @@ - - -==== mod2.js (2 errors) ==== -+mod2.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== mod2.js (1 errors) ==== - /** @typedef {number} Foo */ +- /** @typedef {number} Foo */ - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod2.js:3:4: 'Foo' was also declared here. - const ns = {}; - ns.Foo = class {} +- const ns = {}; +- ns.Foo = class {} - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod2.js:1:23: 'Foo' was also declared here. - module.exports = ns; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file +- module.exports = ns; +- +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff index d4e73b5e61..063060311b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff @@ -6,20 +6,15 @@ - - -==== mod3.js (2 errors) ==== -+mod3.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== mod3.js (1 errors) ==== - /** @typedef {number} Foo */ +- /** @typedef {number} Foo */ - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod3.js:3:20: 'Foo' was also declared here. - class Bar { } - module.exports = { Foo: Bar }; +- class Bar { } +- module.exports = { Foo: Bar }; - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -!!! related TS6203 mod3.js:1:23: 'Foo' was also declared here. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. - - \ No newline at end of file +- +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js b/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js index 4d14d0d880..258b759c0f 100644 --- a/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js +++ b/testdata/baselines/reference/tsbuild/javascriptProjectEmit/loads-js-based-projects-and-emits-them-correctly.js @@ -106,25 +106,16 @@ import { Nominal } from '../common/nominal'; tsgo --b ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: -common/nominal.js:5:1 - error TS2309: An export assignment cannot be used in a module with other exported elements. - -5 module.exports = {}; -  ~~~~~~~~~~~~~~~~~~~ - sub-project/index.js:1:10 - error TS2305: Module '"../../lib/common/nominal"' has no exported member 'Nominal'. 1 import { Nominal } from '../common/nominal';    ~~~~~~~ -Found 2 errors in 2 files. - -Errors Files - 1 common/nominal.js:5 - 1 sub-project/index.js:1 +Found 1 error in sub-project/index.js:1 //// [/home/src/workspaces/lib/common/nominal.d.ts] *new* -export type Nominal = T & { +type Nominal = T & { [Symbol.species]: Name; }; declare const _default: {}; @@ -145,7 +136,7 @@ export = {}; module.exports = {}; //// [/home/src/workspaces/lib/common/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../../solution/common/nominal.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n readonly species: symbol;\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19075dfba5b2d593b761ed8d8cd526f-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};","signature":"de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n","impliedNodeFormat":1}],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"semanticDiagnosticsPerFile":[[2,[{"pos":80,"end":99,"code":2309,"category":1,"message":"An export assignment cannot be used in a module with other exported elements."}]]],"latestChangedDtsFile":"./nominal.d.ts"} +{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","../../solution/common/nominal.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n readonly species: symbol;\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19075dfba5b2d593b761ed8d8cd526f-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};","signature":"74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n","impliedNodeFormat":1}],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"latestChangedDtsFile":"./nominal.d.ts"} //// [/home/src/workspaces/lib/common/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -177,11 +168,11 @@ module.exports = {}; { "fileName": "../../solution/common/nominal.js", "version": "a19075dfba5b2d593b761ed8d8cd526f-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};", - "signature": "de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", + "signature": "74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", "impliedNodeFormat": "CommonJS", "original": { "version": "a19075dfba5b2d593b761ed8d8cd526f-/**\n * @template T, Name\n * @typedef {T & {[Symbol.species]: Name}} Nominal\n */\nmodule.exports = {};", - "signature": "de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", + "signature": "74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", "impliedNodeFormat": 1 } } @@ -195,22 +186,8 @@ module.exports = {}; "rootDir": "../../solution", "skipLibCheck": true }, - "semanticDiagnosticsPerFile": [ - [ - "../../solution/common/nominal.js", - [ - { - "pos": 80, - "end": 99, - "code": 2309, - "category": 1, - "message": "An export assignment cannot be used in a module with other exported elements." - } - ] - ] - ], "latestChangedDtsFile": "./nominal.d.ts", - "size": 1606 + "size": 1427 } //// [/home/src/workspaces/lib/sub-project-2/index.d.ts] *new* declare const variable: { @@ -238,7 +215,7 @@ function getVar() { } //// [/home/src/workspaces/lib/sub-project-2/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../common/nominal.d.ts","../sub-project/index.d.ts","../../solution/sub-project-2/index.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n readonly species: symbol;\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n","225285a996cc5c4120877a377890d79e-import { Nominal } from '../common/nominal';\nexport type MyNominal = Nominal;\n/**\n * @typedef {Nominal} MyNominal\n */ \n",{"version":"db2a90e082fd17d65127bda69975a727-import { MyNominal } from '../sub-project/index';\n\nconst variable = {\n key: /** @type {MyNominal} */('value'),\n};\n\n/**\n * @return {keyof typeof variable}\n */\nexport function getVar() {\n return 'key';\n}","signature":"f2cd6630b2dfa04d1fc92179f15d1647-declare const variable: {\n key: Nominal;\n};\n/**\n * @return {keyof typeof variable}\n */\nexport declare function getVar(): keyof typeof variable;\nexport {};\n","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"referencedMap":[[3,1],[4,2]],"latestChangedDtsFile":"./index.d.ts"} +{"version":"FakeTSVersion","root":[4],"fileNames":["lib.d.ts","../common/nominal.d.ts","../sub-project/index.d.ts","../../solution/sub-project-2/index.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n readonly species: symbol;\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n","225285a996cc5c4120877a377890d79e-import { Nominal } from '../common/nominal';\nexport type MyNominal = Nominal;\n/**\n * @typedef {Nominal} MyNominal\n */ \n",{"version":"db2a90e082fd17d65127bda69975a727-import { MyNominal } from '../sub-project/index';\n\nconst variable = {\n key: /** @type {MyNominal} */('value'),\n};\n\n/**\n * @return {keyof typeof variable}\n */\nexport function getVar() {\n return 'key';\n}","signature":"f2cd6630b2dfa04d1fc92179f15d1647-declare const variable: {\n key: Nominal;\n};\n/**\n * @return {keyof typeof variable}\n */\nexport declare function getVar(): keyof typeof variable;\nexport {};\n","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"referencedMap":[[3,1],[4,2]],"latestChangedDtsFile":"./index.d.ts"} //// [/home/src/workspaces/lib/sub-project-2/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -271,8 +248,8 @@ function getVar() { }, { "fileName": "../common/nominal.d.ts", - "version": "de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", - "signature": "de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", + "version": "74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", + "signature": "74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", "impliedNodeFormat": "CommonJS" }, { @@ -319,7 +296,7 @@ function getVar() { ] }, "latestChangedDtsFile": "./index.d.ts", - "size": 2085 + "size": 2078 } //// [/home/src/workspaces/lib/sub-project/index.d.ts] *new* import { Nominal } from '../common/nominal'; @@ -337,7 +314,7 @@ const nominal_1 = require("../common/nominal"); */ //// [/home/src/workspaces/lib/sub-project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[3],"fileNames":["lib.d.ts","../common/nominal.d.ts","../../solution/sub-project/index.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n readonly species: symbol;\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n",{"version":"00b7836eaf1e026f7764b7be6efcc8f5-import { Nominal } from '../common/nominal';\n\n/**\n * @typedef {Nominal} MyNominal\n */","signature":"225285a996cc5c4120877a377890d79e-import { Nominal } from '../common/nominal';\nexport type MyNominal = Nominal;\n/**\n * @typedef {Nominal} MyNominal\n */ \n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":9,"end":16,"code":2305,"category":1,"message":"Module '\"../../lib/common/nominal\"' has no exported member 'Nominal'."}]]],"latestChangedDtsFile":"./index.d.ts"} +{"version":"FakeTSVersion","root":[3],"fileNames":["lib.d.ts","../common/nominal.d.ts","../../solution/sub-project/index.js"],"fileInfos":[{"version":"24b4796cd50d1a9aabad1583878c494d-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n readonly species: symbol;\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n",{"version":"00b7836eaf1e026f7764b7be6efcc8f5-import { Nominal } from '../common/nominal';\n\n/**\n * @typedef {Nominal} MyNominal\n */","signature":"225285a996cc5c4120877a377890d79e-import { Nominal } from '../common/nominal';\nexport type MyNominal = Nominal;\n/**\n * @typedef {Nominal} MyNominal\n */ \n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"allowJs":true,"checkJs":true,"composite":true,"declaration":true,"outDir":"..","rootDir":"../../solution","skipLibCheck":true},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":9,"end":16,"code":2305,"category":1,"message":"Module '\"../../lib/common/nominal\"' has no exported member 'Nominal'."}]]],"latestChangedDtsFile":"./index.d.ts"} //// [/home/src/workspaces/lib/sub-project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -369,8 +346,8 @@ const nominal_1 = require("../common/nominal"); }, { "fileName": "../common/nominal.d.ts", - "version": "de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", - "signature": "de751e2539eb6f12413f7067ad0a0ef5-export type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", + "version": "74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", + "signature": "74a20392be7348a7d2cb91d2b6dd20c2-type Nominal = T & {\n [Symbol.species]: Name;\n};\ndeclare const _default: {};\nexport = _default;\n", "impliedNodeFormat": "CommonJS" }, { @@ -419,7 +396,7 @@ const nominal_1 = require("../common/nominal"); ] ], "latestChangedDtsFile": "./index.d.ts", - "size": 1877 + "size": 1870 } common/tsconfig.json::