From 6f540b2279801ddcffe6944c08c230d552d19d0e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:10:23 -0700 Subject: [PATCH 1/5] Fix typedef binding with CJS `exports=` With this PR, top-level typedefs in file with commonjs exports (`module.exports=x` or `exports=x`) are no longer added as exports of the file. They're added as exports of whatever is `export=`. The big change is that, in Strada, non-top-level typedefs are also exported. But it never made sense for these two scoped type aliases to be exported, let alone *both*: ```js function one() { /** @typedef {string} T */ /** @type {T} */ var s = 's' } function two() { /** @typedef {number} T */ /** @type {T} */ var n = 1 } /* @type {T} */ var error = "I AM ERROR" ``` I'm not sure that I declared the local and export='d symbols in the right way, so I'd appreciate expert opinions there. --- internal/binder/binder.go | 32 +++++++++- ...eckJsTypeDefNoUnusedLocalMarked.errors.txt | 21 ------- ...xpandoFunctionContextualTypesJs.errors.txt | 7 +-- ...unctionWithExtraTypedefsMembers.errors.txt | 5 +- ...opertyCheckFromContainedLiteral.errors.txt | 5 +- .../importingExportingTypes.symbols | 4 +- .../importingExportingTypes.symbols.diff | 15 ----- ...ctionClassesCjsExportAssignment.errors.txt | 10 +-- ...portAliasExposedWithinNamespace.errors.txt | 5 +- ...sImportAliasExposedWithinNamespace.symbols | 4 +- ...rtAliasExposedWithinNamespace.symbols.diff | 4 +- ...tAliasExposedWithinNamespaceCjs.errors.txt | 12 ++-- ...portAliasExposedWithinNamespaceCjs.symbols | 4 +- ...liasExposedWithinNamespaceCjs.symbols.diff | 4 +- ...jsDeclarationsImportTypeBundled.errors.txt | 18 ------ .../jsDeclarationsTypeAliases.errors.txt | 58 ----------------- ...clarationsTypedefAndImportTypes.errors.txt | 12 +--- ...DeclarationsTypedefAndLatebound.errors.txt | 28 --------- ...edefPropertyAndExportAssignment.errors.txt | 18 +----- ...nsTypedefPropertyAndExportAssignment.types | 2 +- ...erenceToImportOfClassExpression.errors.txt | 14 +---- ...nceToImportOfFunctionExpression.errors.txt | 14 +---- .../moduleExportAssignment7.errors.txt | 22 +------ .../moduleExportAssignment7.symbols | 1 + .../moduleExportAssignment7.symbols.diff | 10 +-- .../conformance/moduleExportAssignment7.types | 16 ++--- .../conformance/typedefCrossModule.errors.txt | 5 +- .../typedefCrossModule2.errors.txt | 13 ++-- .../conformance/typedefCrossModule2.symbols | 4 +- .../typedefCrossModule2.symbols.diff | 13 +--- .../conformance/typedefCrossModule2.types | 2 +- .../typedefCrossModule3.errors.txt | 5 +- .../typedefCrossModule4.errors.txt | 11 ---- ...TypeDefNoUnusedLocalMarked.errors.txt.diff | 26 -------- ...oFunctionContextualTypesJs.errors.txt.diff | 7 +-- ...onWithExtraTypedefsMembers.errors.txt.diff | 5 +- ...yCheckFromContainedLiteral.errors.txt.diff | 5 +- ...ClassesCjsExportAssignment.errors.txt.diff | 10 +-- ...liasExposedWithinNamespace.errors.txt.diff | 11 ++-- ...sExposedWithinNamespaceCjs.errors.txt.diff | 10 +-- ...larationsImportTypeBundled.errors.txt.diff | 23 ------- .../jsDeclarationsTypeAliases.errors.txt.diff | 63 ------------------- ...tionsTypedefAndImportTypes.errors.txt.diff | 12 +--- ...rationsTypedefAndLatebound.errors.txt.diff | 33 ---------- ...ropertyAndExportAssignment.errors.txt.diff | 16 +---- ...edefPropertyAndExportAssignment.types.diff | 2 +- ...eToImportOfClassExpression.errors.txt.diff | 14 +---- ...ImportOfFunctionExpression.errors.txt.diff | 14 +---- .../moduleExportAssignment7.errors.txt.diff | 51 +-------------- .../moduleExportAssignment7.types.diff | 29 ++++----- .../typedefCrossModule.errors.txt.diff | 5 +- .../typedefCrossModule2.errors.txt.diff | 21 ++----- .../typedefCrossModule2.types.diff | 7 +-- .../typedefCrossModule3.errors.txt.diff | 6 +- .../typedefCrossModule4.errors.txt.diff | 22 +++---- 55 files changed, 153 insertions(+), 637 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeAliases.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule4.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff diff --git a/internal/binder/binder.go b/internal/binder/binder.go index ca96bc4c37..90fe6ffb7a 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -73,6 +73,7 @@ type Binder struct { flowNodePool core.Pool[ast.FlowNode] flowListPool core.Pool[ast.FlowList] singleDeclarationsPool core.Pool[*ast.Node] + delayedTypeAliases []*ast.Node } type ActiveLabel struct { @@ -124,9 +125,32 @@ func bindSourceFile(file *ast.SourceFile, options *core.SourceFileAffectingCompi b.bind(file.AsNode()) file.SymbolCount = b.symbolCount file.ClassifiableNames = b.classifiableNames + b.delayedBindJSDocTypedefTag() }) } +// top-level typedef binding is delayed because it changes based on whether `module.exports = x` is bound +func (b *Binder) delayedBindJSDocTypedefTag() { + if b.delayedTypeAliases == nil { + return + } + if b.file.Symbol != nil { + if exportEq := b.file.Symbol.Exports[ast.InternalSymbolNameExportEquals]; exportEq != nil && b.file.CommonJSModuleIndicator != nil { + for _, node := range b.delayedTypeAliases { + b.declareSymbol(ast.GetSymbolTable(&exportEq.Exports), exportEq /*parent*/, node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) + b.declareSymbol(ast.GetLocals(b.file.AsNode()), b.file.Symbol, node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) + } + return + } + } + // bind normally + b.container = b.file.AsNode() + b.blockScopeContainer = b.file.AsNode() + for _, node := range b.delayedTypeAliases { + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) + } +} + func (b *Binder) newSymbol(flags ast.SymbolFlags, name string) *ast.Symbol { b.symbolCount++ result := b.symbolPool.New() @@ -686,8 +710,14 @@ func (b *Binder) bind(node *ast.Node) bool { b.bindBlockScopedDeclaration(node, ast.SymbolFlagsInterface, ast.SymbolFlagsInterfaceExcludes) case ast.KindCallExpression: b.bindCallExpression(node) - case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: + case ast.KindTypeAliasDeclaration: b.bindBlockScopedDeclaration(node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) + case ast.KindJSTypeAliasDeclaration: + if b.file.AsNode() == b.container { + b.delayedTypeAliases = append(b.delayedTypeAliases, node) + } else { + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) + } case ast.KindEnumDeclaration: b.bindEnumDeclaration(node) case ast.KindModuleDeclaration: 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 index 491f957c42..d0af838614 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionContextualTypesJs.errors.txt @@ -1,11 +1,10 @@ input.js(5,48): error TS2304: Cannot find name 'P'. -input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. input.js(52,17): error TS2322: Type '{ color: string; }' is not assignable to type '{ color: "blue" | "red"; }'. Types of property 'color' are incompatible. Type 'string' is not assignable to type '"blue" | "red"'. -==== input.js (3 errors) ==== +==== input.js (2 errors) ==== /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ /** @@ -56,12 +55,8 @@ input.js(52,17): error TS2322: Type '{ color: string; }' is not assignable to ty * @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 }); ~~~~~ 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/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt index fd2276e9f7..95ab42f849 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt @@ -1,5 +1,4 @@ typescript-eslint.js(12,17): error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. -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) ==== @@ -26,7 +25,7 @@ typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in }, }; -==== typescript-eslint.js (2 errors) ==== +==== typescript-eslint.js (1 errors) ==== /** * @typedef {{ rules: Record }} Plugin */ @@ -43,6 +42,4 @@ typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in !!! error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. 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/conformance/importingExportingTypes.symbols b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols index e3d5cf7c06..a27e054aaf 100644 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols @@ -28,10 +28,10 @@ import { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs"; /** @typedef {{ x: any }} JSDocType */ export { JSDocType }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) +>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) export { JSDocType as ThisIsFine }; ->JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) +>JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) >ThisIsFine : Symbol(ThisIsFine, Decl(index.js, 5, 8)) export { WriteFileOptions }; diff --git a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff deleted file mode 100644 index 202b95d863..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importingExportingTypes.symbols.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.importingExportingTypes.symbols -+++ new.importingExportingTypes.symbols -@@= skipped -27, +27 lines =@@ - /** @typedef {{ x: any }} JSDocType */ - - export { JSDocType }; -->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) -+>JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) - - export { JSDocType as ThisIsFine }; -->JSDocType : Symbol(JSDocType, Decl(index.js, 4, 8), Decl(index.js, 2, 4)) -+>JSDocType : Symbol(JSDocType, Decl(index.js, 2, 4), Decl(index.js, 4, 8)) - >ThisIsFine : Symbol(ThisIsFine, Decl(index.js, 5, 8)) - - export { WriteFileOptions }; 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/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt index 339f44b69d..7fe3ce6bdd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt @@ -3,12 +3,13 @@ file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. +file.js(20,9): 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. -==== file.js (5 errors) ==== +==== file.js (6 errors) ==== /** * @namespace myTypes * @global @@ -39,6 +40,8 @@ file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being !!! error TS2300: Duplicate identifier 'myTypes'. export {myTypes}; + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. ==== file2.js (3 errors) ==== import {myTypes} from './file.js'; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols index 0c301bfa5c..a5c956f0fb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols @@ -23,7 +23,7 @@ const myTypes = { /** @typedef {myTypes.typeB|Function} myTypes.typeC */ export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 19, 8)) +>myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 4)) === file2.js === import {myTypes} from './file.js'; @@ -65,5 +65,5 @@ function testFn(input) { export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) +>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15), Decl(file2.js, 11, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff index e5fd12a887..c115ae89c3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespace.symbols.diff @@ -14,7 +14,7 @@ export {myTypes}; ->myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -+>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 19, 8)) ++>myTypes : Symbol(myTypes, Decl(file.js, 19, 8), Decl(file.js, 9, 4)) === file2.js === import {myTypes} from './file.js'; @@ -32,5 +32,5 @@ export {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 8)) ->testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15), Decl(file2.js, 11, 37)) -+>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 11, 4), Decl(file2.js, 27, 15)) ++>testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 15), Decl(file2.js, 11, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index b12f06b6fa..00b7e485fb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -3,13 +3,13 @@ file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. +file.js(20,9): 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'); /** @@ -44,9 +44,7 @@ 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 (5 errors) ==== +==== file.js (6 errors) ==== /** * @namespace myTypes * @global @@ -76,4 +74,6 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi ~~~~~~~ !!! error TS2300: Duplicate identifier 'myTypes'. - exports.myTypes = myTypes; \ No newline at end of file + exports.myTypes = myTypes; + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index 3882b91669..038f14ac61 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -70,8 +70,8 @@ const myTypes = { /** @typedef {myTypes.typeB|Function} myTypes.typeC */ exports.myTypes = myTypes; ->exports.myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) +>exports.myTypes : Symbol(myTypes, Decl(file.js, 7, 2), Decl(file.js, 9, 4)) >exports : Symbol("file", Decl(file.js, 0, 0)) ->myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) +>myTypes : Symbol(myTypes, Decl(file.js, 7, 2), Decl(file.js, 9, 4)) >myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index 8f346643c9..ca47520240 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -39,8 +39,8 @@ ->exports : Symbol(myTypes, Decl(file.js, 7, 2)) ->myTypes : Symbol(myTypes, Decl(file.js, 7, 2)) ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -+>exports.myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) ++>exports.myTypes : Symbol(myTypes, Decl(file.js, 7, 2), Decl(file.js, 9, 4)) +>exports : Symbol("file", Decl(file.js, 0, 0)) -+>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) ++>myTypes : Symbol(myTypes, Decl(file.js, 7, 2), Decl(file.js, 9, 4)) +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt deleted file mode 100644 index 2368c88fd4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -folder/mod1.js(8,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - -==== folder/mod1.js (1 errors) ==== - /** - * @typedef {{x: number}} Item - */ - /** - * @type {Item}; - */ - const x = {x: 12}; - module.exports = x; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== index.js (0 errors) ==== - /** @type {(typeof import("./folder/mod1"))[]} */ - const items = [{x: 12}]; - module.exports = items; \ No newline at end of file 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/jsDeclarationsTypedefAndImportTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt index c319376abf..783bb406ba 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt @@ -1,10 +1,8 @@ -conn.js(11,1): error TS2309: An export assignment cannot be used in a module with other exported elements. usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. -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 */ @@ -16,10 +14,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 (3 errors) ==== +==== usage.js (2 errors) ==== /** * @typedef {import("./conn")} Conn */ @@ -40,10 +36,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/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 9159bcdbdb..28a8fbf2e5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,16 +1,11 @@ -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(11,38): error TS2304: Cannot find name 'P'. 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 (0 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); /** @typedef {import('./module.js').TaskGroup} TaskGroup */ - ~~~~~~~~~ -!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. /** * @typedef TaskNode @@ -29,9 +24,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 (3 errors) ==== +==== module.js (2 errors) ==== /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ /** @@ -63,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.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index 66e4dc7661..c26f71c094 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -26,7 +26,7 @@ class MainThreadTasks { * @param {TaskNode} y */ constructor(x, y){} ->x : any +>x : TaskGroup >y : TaskNode } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt index 40ea387acb..92f98fe380 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt @@ -1,26 +1,18 @@ -MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. MW.js(8,10): error TS2339: Property 'compiler' does not exist on type 'MW'. -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} 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 (2 errors) ==== +==== MW.js (1 errors) ==== /** @typedef {import("./MC")} MC */ class MW { @@ -35,6 +27,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/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt index a81017037a..2577e8668b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@ -1,28 +1,20 @@ -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(8,10): error TS2339: Property 'compiler' does not exist on type 'MW'. -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 (3 errors) ==== +==== MW.js (2 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')'? @@ -39,6 +31,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/moduleExportAssignment7.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt index 88bbc580cf..7282ad6b89 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.errors.txt @@ -3,7 +3,6 @@ index.ts(3,24): error TS2694: Namespace '"mod".export=' has no exported member ' index.ts(4,24): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. index.ts(5,24): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. index.ts(6,24): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -index.ts(7,24): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. index.ts(8,24): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. index.ts(19,31): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. main.js(2,28): error TS2694: Namespace '"mod".export=' has no exported member 'Thing'. @@ -11,36 +10,25 @@ main.js(3,28): error TS2694: Namespace '"mod".export=' has no exported member 'A main.js(4,28): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. main.js(5,28): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. main.js(6,28): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -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) ==== +==== main.js (7 errors) ==== /** * @param {import("./mod").Thing} a ~~~~~ @@ -58,8 +46,6 @@ mod.js(6,1): error TS2309: An export assignment cannot be used in a module with ~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. * @param {import("./mod").buz} f - ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. * @param {import("./mod").literal} g ~~~~~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. @@ -83,7 +69,7 @@ mod.js(6,1): error TS2309: An export assignment cannot be used in a module with return a.length + b.length + c() + d() + e() + f() + g.length } -==== index.ts (8 errors) ==== +==== index.ts (7 errors) ==== function types( a: import('./mod').Thing, ~~~~~ @@ -101,8 +87,6 @@ mod.js(6,1): error TS2309: An export assignment cannot be used in a module with ~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. f: import('./mod').buz, - ~~~ -!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. g: import('./mod').literal, ~~~~~~~ !!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols index f7dfd5ea5e..9eead7358d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols @@ -126,6 +126,7 @@ function types( f: import('./mod').buz, >f : Symbol(f, Decl(index.ts, 5, 27)) +>buz : Symbol(buz, Decl(mod.js, 4, 4)) g: import('./mod').literal, >g : Symbol(g, Decl(index.ts, 6, 27)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff index 8c07ecccc4..9081ec5b04 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.symbols.diff @@ -71,15 +71,7 @@ } === index.ts === -@@= skipped -36, +36 lines =@@ - - f: import('./mod').buz, - >f : Symbol(f, Decl(index.ts, 5, 27)) -->buz : Symbol(buz, Decl(mod.js, 4, 4)) - - g: import('./mod').literal, - >g : Symbol(g, Decl(index.ts, 6, 27)) -@@= skipped -48, +47 lines =@@ +@@= skipped -84, +84 lines =@@ ) { return a.length + b.length + c() + d() + e() + f() + g.length diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types index 099a6e5460..e266a10ab3 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment7.types @@ -59,13 +59,13 @@ module.exports = { * @param {import("./mod").literal} g */ function jstypes(a, b, c, d, e, f, g) { ->jstypes : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any +>jstypes : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any >a : any >b : any >c : any >d : any >e : any ->f : any +>f : () => number >g : any return a.x + b.y + c() + d() + e() + f() + g.length @@ -87,8 +87,8 @@ function jstypes(a, b, c, d, e, f, g) { >d : any >e() : any >e : any ->f() : any ->f : any +>f() : number +>f : () => number >g.length : any >g : any >length : any @@ -141,7 +141,7 @@ function jsvalues(a, b, c, d, e, f, g) { === index.ts === function types( ->types : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any +>types : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any a: import('./mod').Thing, >a : any @@ -159,7 +159,7 @@ function types( >e : any f: import('./mod').buz, ->f : any +>f : () => number g: import('./mod').literal, >g : any @@ -184,8 +184,8 @@ function types( >d : any >e() : any >e : any ->f() : any ->f : any +>f() : number +>f : () => number >g.length : any >g : any >length : any 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..51e76e0712 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -1,20 +1,17 @@ -mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. -mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +mod1.js(3,23): error TS2300: Duplicate identifier 'Foo'. +mod1.js(4,7): error TS2300: Duplicate identifier 'Foo'. 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; }'. -use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (2 errors) ==== +==== use.js (1 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ - ~~~ -!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. var b; /** @type {mod.Baz} */ ~~~ @@ -27,10 +24,10 @@ use.js(4,12): error TS2503: Cannot find namespace 'mod'. /** @typedef {number} Foo */ ~~~ -!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +!!! error TS2300: Duplicate identifier 'Foo'. class Foo { } // should error ~~~ -!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +!!! error TS2300: Duplicate identifier 'Foo'. /** @typedef {number} Bar */ exports.Bar = class { } diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols index 2104a285c8..25443ec9ff 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols @@ -25,7 +25,7 @@ var bbb = new mod.Baz(); /** @typedef {number} Foo */ class Foo { } // should error ->Foo : Symbol(Foo, Decl(mod1.js, 2, 4), Decl(mod1.js, 0, 0)) +>Foo : Symbol(Foo, Decl(mod1.js, 0, 0)) /** @typedef {number} Bar */ exports.Bar = class { } @@ -45,7 +45,7 @@ module.exports = { /** @typedef {number} Qux */ var Qux = 2; ->Qux : Symbol(Qux, Decl(mod1.js, 15, 4), Decl(mod1.js, 16, 3)) +>Qux : Symbol(Qux, Decl(mod1.js, 16, 3), Decl(mod1.js, 15, 4)) /** @typedef {number} Quid */ exports.Quid = 2; diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff index aee4122252..909c9f8017 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff @@ -12,11 +12,7 @@ === mod1.js === // error - - /** @typedef {number} Foo */ - class Foo { } // should error -->Foo : Symbol(Foo, Decl(mod1.js, 0, 0)) -+>Foo : Symbol(Foo, Decl(mod1.js, 2, 4), Decl(mod1.js, 0, 0)) +@@= skipped -13, +13 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } @@ -36,12 +32,7 @@ Baz: class { } >Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) -@@= skipped -31, +29 lines =@@ - - /** @typedef {number} Qux */ - var Qux = 2; -->Qux : Symbol(Qux, Decl(mod1.js, 16, 3), Decl(mod1.js, 15, 4)) -+>Qux : Symbol(Qux, Decl(mod1.js, 15, 4), Decl(mod1.js, 16, 3)) +@@= skipped -22, +20 lines =@@ /** @typedef {number} Quid */ exports.Quid = 2; diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index ec6c87f6dd..6e49c8f80c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -9,7 +9,7 @@ var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ var b; ->b : any +>b : number /** @type {mod.Baz} */ var bb; diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt index cc76ff4dfb..11bd2db1cd 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.errors.txt @@ -1,15 +1,12 @@ mod2.js(3,4): error TS2339: Property 'Foo' does not exist on type '{}'. -mod2.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== mod2.js (2 errors) ==== +==== mod2.js (1 errors) ==== /** @typedef {number} Foo */ const ns = {}; ns.Foo = class {} ~~~ !!! error TS2339: Property 'Foo' does not exist on type '{}'. 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 2b56dab6c7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/checkJsTypeDefNoUnusedLocalMarked.errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.checkJsTypeDefNoUnusedLocalMarked.errors.txt -+++ new.checkJsTypeDefNoUnusedLocalMarked.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 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. diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff index 8cc2e3f334..2d417af926 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/expandoFunctionContextualTypesJs.errors.txt.diff @@ -4,13 +4,12 @@ - @@= skipped --1, +1 lines =@@ +input.js(5,48): error TS2304: Cannot find name 'P'. -+input.js(48,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +input.js(52,17): error TS2322: Type '{ color: string; }' is not assignable to type '{ color: "blue" | "red"; }'. + Types of property 'color' are incompatible. + Type 'string' is not assignable to type '"blue" | "red"'. + + -+==== input.js (3 errors) ==== ++==== input.js (2 errors) ==== + /** @typedef {{ color: "red" | "blue" }} MyComponentProps */ + + /** @@ -61,12 +60,8 @@ + * @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 }); + ~~~~~ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff index e6da449bd1..261d99918c 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsDeclarationEmitExportAssignedFunctionWithExtraTypedefsMembers.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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 @@ -17,8 +16,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. + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff index 2ae834d40c..39c0fa21ba 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff @@ -4,7 +4,6 @@ - @@= skipped --1, +1 lines =@@ +typescript-eslint.js(12,17): error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. -+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) ==== @@ -31,7 +30,7 @@ + }, + }; + -+==== typescript-eslint.js (2 errors) ==== ++==== typescript-eslint.js (1 errors) ==== + /** + * @typedef {{ rules: Record }} Plugin + */ @@ -48,6 +47,4 @@ +!!! error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. + + module.exports = { config }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index 2c1cb5b2a6..a1946cdb9d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -7,9 +7,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) ==== @@ -20,7 +18,7 @@ + this.timeout = timeout; + } + module.exports = Timer; -+==== hook.js (2 errors) ==== ++==== hook.js (1 errors) ==== + /** + * @typedef {(arg: import("./context")) => void} HookHandler + ~~~~~~~~~~~~~~~~~~~ @@ -33,10 +31,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 + * @@ -93,6 +89,4 @@ + } + } + module.exports = Context; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff index 53d5cc4eb9..8b24e444cd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespace.errors.txt.diff @@ -7,13 +7,14 @@ +file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. +file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. ++file.js(20,9): 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. -==== file.js (0 errors) ==== -+==== file.js (5 errors) ==== ++==== file.js (6 errors) ==== /** * @namespace myTypes * @global @@ -45,10 +46,12 @@ export {myTypes}; -==== file2.js (1 errors) ==== -+==== file2.js (3 errors) ==== - import {myTypes} from './file.js'; -- ~~~~~~~ +- import {myTypes} from './file.js'; + ~~~~~~~ -!!! error TS18042: 'myTypes' is a type and cannot be imported in JavaScript files. Use 'import("./file.js").myTypes' in a JSDoc type annotation. ++!!! error TS2300: Duplicate identifier 'myTypes'. ++==== file2.js (3 errors) ==== ++ import {myTypes} from './file.js'; /** * @namespace testFnTypes diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index c567ce510a..d4d289dbe3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -8,13 +8,13 @@ +file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. +file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. ++file.js(20,9): 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'); + + /** @@ -49,9 +49,7 @@ + } + + module.exports = {testFn, testFnTypes}; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== file.js (5 errors) ==== ++==== file.js (6 errors) ==== + /** + * @namespace myTypes + * @global @@ -82,3 +80,5 @@ +!!! error TS2300: Duplicate identifier 'myTypes'. + + exports.myTypes = myTypes; ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff deleted file mode 100644 index a5394bab86..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsDeclarationsImportTypeBundled.errors.txt -+++ new.jsDeclarationsImportTypeBundled.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+folder/mod1.js(8,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -+ -+ -+==== folder/mod1.js (1 errors) ==== -+ /** -+ * @typedef {{x: number}} Item -+ */ -+ /** -+ * @type {Item}; -+ */ -+ const x = {x: 12}; -+ module.exports = x; -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== index.js (0 errors) ==== -+ /** @type {(typeof import("./folder/mod1"))[]} */ -+ const items = [{x: 12}]; -+ module.exports = items; 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 a69443eda3..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeAliases.errors.txt.diff +++ /dev/null @@ -1,63 +0,0 @@ ---- old.jsDeclarationsTypeAliases.errors.txt -+++ new.jsDeclarationsTypeAliases.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 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" -+ } -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff index b57df579ed..776bc12028 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.errors.txt.diff @@ -3,13 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+conn.js(11,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +usage.js(10,14): error TS2339: Property 'connItem' does not exist on type 'Wrap'. +usage.js(12,14): error TS2339: Property 'another' does not exist on type 'Wrap'. -+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 + */ @@ -21,10 +19,8 @@ + } + + module.exports = Conn; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== usage.js (3 errors) ==== ++==== usage.js (2 errors) ==== + /** + * @typedef {import("./conn")} Conn + */ @@ -45,10 +41,6 @@ + } + + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + Wrap -+ ~~~~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + 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 fed430bfc6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.jsDeclarationsTypedefAndLatebound.errors.txt -+++ new.jsDeclarationsTypedefAndLatebound.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 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. -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 4cf617b60f..52f3570031 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -3,19 +3,14 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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(11,38): error TS2304: Cannot find name 'P'. +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 (0 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ -+ ~~~~~~~~~ -+!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. + + /** + * @typedef TaskNode @@ -34,9 +29,7 @@ + } + + module.exports = MainThreadTasks; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== module.js (3 errors) ==== ++==== module.js (2 errors) ==== + /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + + /** @@ -68,11 +61,6 @@ + const taskNameToGroup = {}; + + module.exports = { -+ ~~~~~~~~~~~~~~~~~~ + taskGroups, -+ ~~~~~~~~~~~~~~~ + taskNameToGroup, -+ ~~~~~~~~~~~~~~~~~~~~ + }; -+ ~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index e94038e6f9..ac237ffaed 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -18,7 +18,7 @@ */ constructor(x, y){} ->x : import("module").TaskGroup -+>x : any ++>x : TaskGroup >y : TaskNode } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff index 50c492237b..59430c6015 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff @@ -3,29 +3,21 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(8,10): error TS2339: Property 'compiler' does not exist on type 'MW'. -+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} 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 (2 errors) ==== ++==== MW.js (1 errors) ==== + /** @typedef {import("./MC")} MC */ + + class MW { @@ -40,6 +32,4 @@ + } + + module.exports = MW; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff index a46248685e..ebacd0bce1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff @@ -3,31 +3,23 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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(8,10): error TS2339: Property 'compiler' does not exist on type 'MW'. -+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 (3 errors) ==== ++==== MW.js (2 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')'? @@ -44,6 +36,4 @@ + } + + module.exports = MW; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff index cd97073159..3b5cef7912 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.errors.txt.diff @@ -1,10 +1,7 @@ --- old.moduleExportAssignment7.errors.txt +++ new.moduleExportAssignment7.errors.txt -@@= skipped -2, +2 lines =@@ - index.ts(4,24): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. - index.ts(5,24): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. +@@= skipped -4, +4 lines =@@ index.ts(6,24): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -+index.ts(7,24): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. index.ts(8,24): error TS2694: Namespace '"mod".export=' has no exported member 'literal'. index.ts(19,31): error TS2694: Namespace '"mod".export=' has no exported member 'buz'. +main.js(2,28): error TS2694: Namespace '"mod".export=' has no exported member 'Thing'. @@ -12,38 +9,16 @@ +main.js(4,28): error TS2694: Namespace '"mod".export=' has no exported member 'foo'. +main.js(5,28): error TS2694: Namespace '"mod".export=' has no exported member 'qux'. +main.js(6,28): error TS2694: Namespace '"mod".export=' has no exported member 'baz'. -+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 (0 errors) ==== -+==== 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 -17, +23 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) ==== ++==== main.js (7 errors) ==== /** * @param {import("./mod").Thing} a + ~~~~~ @@ -61,29 +36,9 @@ + ~~~ +!!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. * @param {import("./mod").buz} f -+ ~~~ -+!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. * @param {import("./mod").literal} g + ~~~~~~~ +!!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. */ function jstypes(a, b, c, d, e, f, g) { return a.x + b.y + c() + d() + e() + f() + g.length -@@= skipped -48, +80 lines =@@ - return a.length + b.length + c() + d() + e() + f() + g.length - } - --==== index.ts (7 errors) ==== -+==== index.ts (8 errors) ==== - function types( - a: import('./mod').Thing, - ~~~~~ -@@= skipped -18, +18 lines =@@ - ~~~ - !!! error TS2694: Namespace '"mod".export=' has no exported member 'baz'. - f: import('./mod').buz, -+ ~~~ -+!!! error TS2694: Namespace '"mod".export=' has no exported member 'buz'. - g: import('./mod').literal, - ~~~~~~~ - !!! error TS2694: Namespace '"mod".export=' has no exported member 'literal'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff index 0065273908..e9c147630e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment7.types.diff @@ -29,13 +29,13 @@ ->e : () => number ->f : import("mod").buz ->g : string -+>jstypes : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any ++>jstypes : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any +>a : any +>b : any +>c : any +>d : any +>e : any -+>f : any ++>f : () => number +>g : any return a.x + b.y + c() + d() + e() + f() + g.length @@ -57,11 +57,6 @@ ->d : () => number ->e() : number ->e : () => number -->f() : number -->f : import("mod").buz -->g.length : number -->g : string -->length : number +>a.x + b.y + c() + d() + e() + f() + g.length : any +>a.x + b.y + c() + d() + e() + f() : any +>a.x + b.y + c() + d() + e() : any @@ -80,8 +75,12 @@ +>d : any +>e() : any +>e : any -+>f() : any -+>f : any + >f() : number +->f : import("mod").buz +->g.length : number +->g : string +->length : number ++>f : () => number +>g.length : any +>g : any +>length : any @@ -102,7 +101,7 @@ === index.ts === function types( ->types : (a: import("./mod").Thing, b: import("./mod").AnotherThing, c: import("./mod").foo, d: import("./mod").qux, e: import("./mod").baz, f: import("./mod").buz, g: import("./mod").literal) => any -+>types : (a: any, b: any, c: any, d: any, e: any, f: any, g: any) => any ++>types : (a: any, b: any, c: any, d: any, e: any, f: () => number, g: any) => any a: import('./mod').Thing, >a : any @@ -111,18 +110,16 @@ f: import('./mod').buz, ->f : import("mod").buz -+>f : any ++>f : () => number g: import('./mod').literal, >g : any -@@= skipped -25, +25 lines =@@ - >d : any +@@= skipped -26, +26 lines =@@ >e() : any >e : any -->f() : number + >f() : number ->f : import("mod").buz -+>f() : any -+>f : any ++>f : () => number >g.length : any >g : any >length : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff index 38256774be..36d12c7f20 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff @@ -3,20 +3,17 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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 1921a5962d..6694396202 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -1,28 +1,23 @@ --- old.typedefCrossModule2.errors.txt +++ new.typedefCrossModule2.errors.txt @@= skipped -0, +0 lines =@@ --mod1.js(3,23): error TS2300: Duplicate identifier 'Foo'. --mod1.js(4,7): error TS2300: Duplicate identifier 'Foo'. + mod1.js(3,23): error TS2300: Duplicate identifier 'Foo'. + mod1.js(4,7): error TS2300: Duplicate identifier 'Foo'. -mod1.js(9,23): error TS2300: Duplicate identifier 'Baz'. -mod1.js(11,5): error TS2300: Duplicate identifier 'Baz'. -+mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. -+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; }'. -+use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (0 errors) ==== -+==== use.js (2 errors) ==== ++==== use.js (1 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ -+ ~~~ -+!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. var b; /** @type {mod.Baz} */ + ~~~ @@ -35,13 +30,7 @@ // error /** @typedef {number} Foo */ - ~~~ --!!! error TS2300: Duplicate identifier 'Foo'. -+!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. - class Foo { } // should error - ~~~ --!!! error TS2300: Duplicate identifier 'Foo'. -+!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +@@= skipped -23, +30 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } @@ -69,7 +58,7 @@ // ok -@@= skipped -42, +56 lines =@@ +@@= skipped -19, +23 lines =@@ /** @typedef {number} Quid */ exports.Quid = 2; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index 97373e3d4c..6044b381cd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -11,10 +11,7 @@ >require : any >'./mod1.js' : "./mod1.js" - /** @type {import("./mod1.js").Baz} */ - var b; -->b : number -+>b : any +@@= skipped -11, +11 lines =@@ /** @type {mod.Baz} */ var bb; @@ -30,7 +27,7 @@ >Baz : typeof Baz === mod1.js === -@@= skipped -30, +30 lines =@@ +@@= skipped -19, +19 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } >exports.Bar = class { } : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff index ff156cd3b8..3777d2b96a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.errors.txt.diff @@ -4,10 +4,10 @@ -mod2.js(1,23): error TS2300: Duplicate identifier 'Foo'. -mod2.js(3,4): error TS2300: Duplicate identifier 'Foo'. +mod2.js(3,4): error TS2339: Property 'Foo' does not exist on type '{}'. -+mod2.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - ==== mod2.js (2 errors) ==== +-==== mod2.js (2 errors) ==== ++==== mod2.js (1 errors) ==== /** @typedef {number} Foo */ - ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. @@ -19,7 +19,5 @@ -!!! related TS6203 mod2.js:1:23: 'Foo' was also declared here. +!!! error TS2339: Property 'Foo' does not exist on type '{}'. module.exports = ns; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff index f3615f3918..0ece8798d9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule4.errors.txt.diff @@ -1,23 +1,21 @@ --- old.typedefCrossModule4.errors.txt +++ new.typedefCrossModule4.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -mod3.js(1,23): error TS2300: Duplicate identifier 'Foo'. -mod3.js(3,20): error TS2300: Duplicate identifier 'Foo'. -+mod3.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. - - +- +- -==== mod3.js (2 errors) ==== -+==== 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. - - +- +- +@@= skipped --1, +1 lines =@@ ++ From b8bc14704a1212f8baf713ade6a4d8d890b3e0fa Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 28 Apr 2025 09:51:11 -0700 Subject: [PATCH 2/5] remove TODO that is now done --- internal/parser/reparser.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 6efc931964..2e010daf88 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -79,7 +79,6 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { for _, tag := range j.AsJSDoc().Tags.Nodes { switch tag.Kind { case ast.KindJSDocTypedefTag: - // !!! Don't mark typedefs as exported if they are not in a module typeExpression := tag.AsJSDocTypedefTag().TypeExpression if typeExpression == nil { break From 8021e94ec247dd0bd1e09c03c1845b6590d1895b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 5 May 2025 11:18:07 -0700 Subject: [PATCH 3/5] fallback-resolve namespace members on the export= symbol --- internal/checker/checker.go | 38 +++++++++++--- ...ctionClassesCjsExportAssignment.errors.txt | 5 +- ...nsFunctionClassesCjsExportAssignment.types | 30 +++++------ .../conformance/typedefCrossModule.errors.txt | 47 ----------------- .../conformance/typedefCrossModule.types | 12 ++--- .../typedefCrossModule2.errors.txt | 5 +- .../conformance/typedefCrossModule2.types | 2 +- ...ClassesCjsExportAssignment.errors.txt.diff | 5 +- ...ctionClassesCjsExportAssignment.types.diff | 30 +++++------ .../typedefCrossModule.errors.txt.diff | 52 ------------------- .../conformance/typedefCrossModule.types.diff | 16 +++--- .../typedefCrossModule2.errors.txt.diff | 13 ++--- .../typedefCrossModule2.types.diff | 11 +--- 13 files changed, 83 insertions(+), 183 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 3383971d34..eeb7cc8859 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -13618,7 +13618,7 @@ func (c *Checker) getTargetOfImportEqualsDeclaration(node *ast.Node, dontResolve moduleReference = getExternalModuleImportEqualsDeclarationExpression(node) } immediate := c.resolveExternalModuleName(node, moduleReference, false /*ignoreErrors*/) - resolved := c.resolveExternalModuleSymbol(immediate, false /*dontResolveAlias*/) + resolved := c.resolveExternalModuleSymbol(immediate, dontResolveAlias) c.markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false /*overwriteEmpty*/, nil, "") return resolved } @@ -14545,9 +14545,24 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign } func (c *Checker) resolveQualifiedName(name *ast.Node, left *ast.Node, right *ast.Node, meaning ast.SymbolFlags, ignoreErrors bool, dontResolveAlias bool, location *ast.Node) *ast.Symbol { - namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) + namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, true /*ignoreErrors*/, false /*dontResolveAlias*/, location) if namespace == nil || ast.NodeIsMissing(right) { - return nil + var immediate *ast.Symbol + alias := c.resolveEntityName(left, ast.SymbolFlagsAlias, true /*ignoreErrors*/, true /*dontResolveAlias*/, location) + if alias != nil { + immediate = c.getImmediateAliasedSymbol(alias) + if immediate != nil && !core.Some(immediate.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { + immediate = nil + } + } + if immediate == nil { + if !ignoreErrors { + c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) + } + return nil + } else { + namespace = immediate + } } if namespace == c.unknownSymbol { return namespace @@ -22830,9 +22845,20 @@ func (c *Checker) getTypeFromImportTypeNode(node *ast.Node) *Type { } next := core.OrElse(symbolFromModule, symbolFromVariable) if next == nil { - c.error(current, diagnostics.Namespace_0_has_no_exported_member_1, c.getFullyQualifiedName(currentNamespace, nil), scanner.DeclarationNameToString(current)) - links.resolvedType = c.errorType - return links.resolvedType + var symbolFromImmediateModule *ast.Symbol + if currentNamespace == moduleSymbol { + immediateModuleSymbol := c.resolveExternalModuleSymbol(innerModuleSymbol, true /*dontResolveAlias*/) + if immediateModuleSymbol != nil && core.Some(immediateModuleSymbol.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { + symbolFromImmediateModule = c.getSymbol(c.getExportsOfSymbol(immediateModuleSymbol), current.Text(), meaning) + } + } + if symbolFromImmediateModule != nil { + next = symbolFromImmediateModule + } else { + c.error(current, diagnostics.Namespace_0_has_no_exported_member_1, c.getFullyQualifiedName(currentNamespace, nil), scanner.DeclarationNameToString(current)) + links.resolvedType = c.errorType + return links.resolvedType + } } c.symbolNodeLinks.Get(current).resolvedSymbol = next c.symbolNodeLinks.Get(current.Parent).resolvedSymbol = next diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt index 2b4385d035..92201af30d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt @@ -1,6 +1,5 @@ context.js(4,14): error TS1340: Module './timer' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./timer')'? 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. 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')'? @@ -27,7 +26,7 @@ hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is } module.exports = Hook; -==== context.js (4 errors) ==== +==== context.js (3 errors) ==== /** * Imports * @@ -38,8 +37,6 @@ hook.js(2,20): error TS1340: Module './context' does not refer to a type, but is ~~~~~~~~~~~~~~~~ !!! error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? * @typedef {import("./hook").HookHandler} HookHandler - ~~~~~~~~~~~ -!!! error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. */ /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types index 7433c03608..5732a3c707 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types @@ -80,7 +80,7 @@ module.exports = Hook; */ function Context(input) { ->Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } >input : Input if (!(this instanceof Context)) { @@ -88,11 +88,11 @@ function Context(input) { >(this instanceof Context) : boolean >this instanceof Context : boolean >this : any ->Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } return new Context(input) >new Context(input) : any ->Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } >input : Input } this.state = this.construct(input); @@ -107,11 +107,11 @@ function Context(input) { >input : Input } Context.prototype = { ->Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: any) => State; } ->Context.prototype : { construct: (input: Input, handle?: any) => State; } ->Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ->prototype : { construct: (input: Input, handle?: any) => State; } ->{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: any) => State; } +>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } +>Context.prototype : { construct: (input: Input, handle?: HookHandler) => State; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>prototype : { construct: (input: Input, handle?: HookHandler) => State; } +>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } /** * @param {Input} input @@ -119,9 +119,9 @@ Context.prototype = { * @returns {State} */ construct(input, handle = () => void 0) { ->construct : (input: Input, handle?: any) => State +>construct : (input: Input, handle?: HookHandler) => State >input : Input ->handle : any +>handle : HookHandler >() => void 0 : () => any >void 0 : undefined >0 : 0 @@ -131,9 +131,9 @@ Context.prototype = { } } module.exports = Context; ->module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ->module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ->module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; }; } ->exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ->Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } +>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; }; } +>exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt deleted file mode 100644 index 1007bdc830..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.errors.txt +++ /dev/null @@ -1,47 +0,0 @@ -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 (0 errors) ==== - /// - /** @typedef {{ type: "a", x: 1 }} A */ - /** @typedef {{ type: "b", y: 1 }} B */ - /** @typedef {A | B} Both */ - module.exports = C - function C() { - this.p = 1 - } - -==== mod2.js (0 errors) ==== - /// - /** @typedef {{ type: "a", x: 1 }} A */ - /** @typedef {{ type: "b", y: 1 }} B */ - /** @typedef {A | B} Both */ - - export function C() { - this.p = 1 - } - -==== mod3.js (0 errors) ==== - /// - /** @typedef {{ type: "a", x: 1 }} A */ - /** @typedef {{ type: "b", y: 1 }} B */ - /** @typedef {A | B} Both */ - - exports.C = function() { - this.p = 1 - } - -==== use.js (1 errors) ==== - /** @type {import('./mod1').Both} */ - ~~~~ -!!! error TS2694: Namespace 'C' has no exported member 'Both'. - var both1 = { type: 'a', x: 1 }; - /** @type {import('./mod2').Both} */ - var both2 = both1; - /** @type {import('./mod3').Both} */ - var both3 = both2; - - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index f7fd67e21f..83ab826c18 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -69,22 +69,22 @@ exports.C = function() { === use.js === /** @type {import('./mod1').Both} */ var both1 = { type: 'a', x: 1 }; ->both1 : any ->{ type: 'a', x: 1 } : { type: string; x: number; } ->type : string +>both1 : { type: "a"; x: 1; } | { type: "b"; y: 1; } +>{ type: 'a', x: 1 } : { type: "a"; x: 1; } +>type : "a" >'a' : "a" ->x : number +>x : 1 >1 : 1 /** @type {import('./mod2').Both} */ var both2 = both1; >both2 : Both ->both1 : any +>both1 : { type: "a"; x: 1; } /** @type {import('./mod3').Both} */ var both3 = both2; >both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } ->both2 : Both +>both2 : A diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index 51e76e0712..ef2c18dda2 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -6,16 +6,13 @@ mod1.js(10,1): error TS2309: An export assignment cannot be used in a module wit 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; }'. -use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (1 errors) ==== +==== use.js (0 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ var b; /** @type {mod.Baz} */ - ~~~ -!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 6e49c8f80c..6ff7139c87 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -13,7 +13,7 @@ var b; /** @type {mod.Baz} */ var bb; ->bb : Baz +>bb : number var bbb = new mod.Baz(); >bbb : Baz diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff index a1946cdb9d..7a9117fa16 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.errors.txt.diff @@ -5,7 +5,6 @@ @@= skipped --1, +1 lines =@@ +context.js(4,14): error TS1340: Module './timer' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./timer')'? +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. +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')'? + @@ -32,7 +31,7 @@ + } + module.exports = Hook; + -+==== context.js (4 errors) ==== ++==== context.js (3 errors) ==== + /** + * Imports + * @@ -43,8 +42,6 @@ + ~~~~~~~~~~~~~~~~ +!!! error TS1340: Module './hook' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./hook')'? + * @typedef {import("./hook").HookHandler} HookHandler -+ ~~~~~~~~~~~ -+!!! error TS2694: Namespace 'Hook' has no exported member 'HookHandler'. + */ + + /** diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff index 2f9e134bc7..6a9ada9701 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff @@ -65,7 +65,7 @@ function Context(input) { ->Context : typeof Context -+>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } >input : Input if (!(this instanceof Context)) { @@ -75,13 +75,13 @@ ->this : this ->Context : typeof Context +>this : any -+>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } return new Context(input) ->new Context(input) : Context ->Context : typeof Context +>new Context(input) : any -+>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } >input : Input } this.state = this.construct(input); @@ -107,11 +107,11 @@ ->Context : typeof Context ->prototype : { construct(input: Input, handle?: HookHandler | undefined): State; } ->{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct(input: Input, handle?: HookHandler | undefined): State; } -+>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: any) => State; } -+>Context.prototype : { construct: (input: Input, handle?: any) => State; } -+>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } -+>prototype : { construct: (input: Input, handle?: any) => State; } -+>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: any) => State; } ++>Context.prototype = { /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } ++>Context.prototype : { construct: (input: Input, handle?: HookHandler) => State; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>prototype : { construct: (input: Input, handle?: HookHandler) => State; } ++>{ /** * @param {Input} input * @param {HookHandler=} handle * @returns {State} */ construct(input, handle = () => void 0) { return input; }} : { construct: (input: Input, handle?: HookHandler) => State; } /** * @param {Input} input @@ -120,10 +120,10 @@ */ construct(input, handle = () => void 0) { ->construct : (input: Input, handle?: HookHandler | undefined) => State -+>construct : (input: Input, handle?: any) => State ++>construct : (input: Input, handle?: HookHandler) => State >input : Input ->handle : import("hook").HookHandler -+>handle : any ++>handle : HookHandler >() => void 0 : () => any >void 0 : undefined >0 : 0 @@ -136,9 +136,9 @@ ->module : { exports: { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; }; } ->exports : { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; } ->Context : typeof Context -+>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } -+>module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } -+>module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; }; } -+>exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } -+>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: any) => State; }; } ++>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; }; } ++>exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff deleted file mode 100644 index 36d12c7f20..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.errors.txt.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- old.typedefCrossModule.errors.txt -+++ new.typedefCrossModule.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+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 (0 errors) ==== -+ /// -+ /** @typedef {{ type: "a", x: 1 }} A */ -+ /** @typedef {{ type: "b", y: 1 }} B */ -+ /** @typedef {A | B} Both */ -+ module.exports = C -+ function C() { -+ this.p = 1 -+ } -+ -+==== mod2.js (0 errors) ==== -+ /// -+ /** @typedef {{ type: "a", x: 1 }} A */ -+ /** @typedef {{ type: "b", y: 1 }} B */ -+ /** @typedef {A | B} Both */ -+ -+ export function C() { -+ this.p = 1 -+ } -+ -+==== mod3.js (0 errors) ==== -+ /// -+ /** @typedef {{ type: "a", x: 1 }} A */ -+ /** @typedef {{ type: "b", y: 1 }} B */ -+ /** @typedef {A | B} Both */ -+ -+ exports.C = function() { -+ this.p = 1 -+ } -+ -+==== use.js (1 errors) ==== -+ /** @type {import('./mod1').Both} */ -+ ~~~~ -+!!! error TS2694: Namespace 'C' has no exported member 'Both'. -+ var both1 = { type: 'a', x: 1 }; -+ /** @type {import('./mod2').Both} */ -+ var both2 = both1; -+ /** @type {import('./mod3').Both} */ -+ var both3 = both2; -+ -+ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff index 6aa012e05b..30f0ff3b5f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff @@ -69,29 +69,25 @@ /** @type {import('./mod1').Both} */ var both1 = { type: 'a', x: 1 }; ->both1 : import("mod1").Both -->{ type: 'a', x: 1 } : { type: "a"; x: 1; } -->type : "a" -+>both1 : any -+>{ type: 'a', x: 1 } : { type: string; x: number; } -+>type : string ++>both1 : { type: "a"; x: 1; } | { type: "b"; y: 1; } + >{ type: 'a', x: 1 } : { type: "a"; x: 1; } + >type : "a" >'a' : "a" -->x : 1 -+>x : number - >1 : 1 +@@= skipped -9, +9 lines =@@ /** @type {import('./mod2').Both} */ var both2 = both1; ->both2 : import("mod2").Both ->both1 : import("mod1").A +>both2 : Both -+>both1 : any ++>both1 : { type: "a"; x: 1; } /** @type {import('./mod3').Both} */ var both3 = both2; ->both3 : import("mod3").Both ->both2 : import("mod2").A +>both3 : { type: "a"; x: 1; } | { type: "b"; y: 1; } -+>both2 : Both ++>both2 : A diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index 6694396202..abe8829172 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -11,17 +11,10 @@ +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; }'. -+use.js(4,12): error TS2503: Cannot find namespace 'mod'. --==== use.js (0 errors) ==== -+==== use.js (1 errors) ==== - var mod = require('./mod1.js'); - /** @type {import("./mod1.js").Baz} */ - var b; - /** @type {mod.Baz} */ -+ ~~~ -+!!! error TS2503: Cannot find namespace 'mod'. + ==== use.js (0 errors) ==== +@@= skipped -11, +15 lines =@@ var bb; var bbb = new mod.Baz(); @@ -30,7 +23,7 @@ // error /** @typedef {number} Foo */ -@@= skipped -23, +30 lines =@@ +@@= skipped -12, +12 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index 6044b381cd..c6acb76186 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -11,14 +11,7 @@ >require : any >'./mod1.js' : "./mod1.js" -@@= skipped -11, +11 lines =@@ - - /** @type {mod.Baz} */ - var bb; -->bb : number -+>bb : Baz - - var bbb = new mod.Baz(); +@@= skipped -17, +17 lines =@@ >bbb : Baz >new mod.Baz() : Baz >mod.Baz : typeof Baz @@ -27,7 +20,7 @@ >Baz : typeof Baz === mod1.js === -@@= skipped -19, +19 lines =@@ +@@= skipped -13, +13 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } >exports.Bar = class { } : typeof Bar From 1cffb6ec0ec1329f6eac0012b65dc7f1b7b48b56 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 8 May 2025 06:31:01 -0700 Subject: [PATCH 4/5] Add JSExportDeclaration I'm adding this to show the changes, but I plan to revert it. The results are more correct, but the amount of code in the checker is twice the previous commit, so I don't think the improvement is worthwhile. --- internal/api/encoder/encoder.go | 4 +- internal/ast/ast.go | 22 ++- internal/ast/kind.go | 1 + internal/ast/kind_stringer_generated.go | 17 ++- internal/ast/utilities.go | 10 +- internal/binder/binder.go | 4 +- internal/binder/referenceresolver.go | 2 + internal/checker/checker.go | 137 ++++++++++++------ internal/checker/grammarchecks.go | 3 +- internal/checker/utilities.go | 2 +- internal/ls/utilities.go | 2 +- internal/parser/reparser.go | 6 +- internal/printer/namegenerator.go | 2 +- internal/printer/printer.go | 2 +- internal/transformers/typeeraser.go | 2 +- .../amdLikeInputDeclarationEmit.errors.txt | 11 +- .../amdLikeInputDeclarationEmit.types | 2 +- ...nmentDefineProperrtyPotentialMerge.symbols | 8 +- ...DefineProperrtyPotentialMerge.symbols.diff | 8 +- ...ignmentDefineProperrtyPotentialMerge.types | 16 +- ...Script(verbatimmodulesyntax=false).symbols | 4 +- ...t(verbatimmodulesyntax=false).symbols.diff | 4 +- ...vaScript(verbatimmodulesyntax=false).types | 6 +- ...aScript(verbatimmodulesyntax=true).symbols | 4 +- ...pt(verbatimmodulesyntax=true).symbols.diff | 4 +- ...avaScript(verbatimmodulesyntax=true).types | 6 +- .../compiler/javascriptCommonjsModule.symbols | 4 +- .../javascriptCommonjsModule.symbols.diff | 4 +- .../compiler/javascriptCommonjsModule.types | 6 +- .../javascriptImportDefaultBadExport.symbols | 4 +- ...ascriptImportDefaultBadExport.symbols.diff | 4 +- .../javascriptImportDefaultBadExport.types | 8 +- ...maxNodeModuleJsDepthDefaultsToZero.symbols | 4 +- ...deModuleJsDepthDefaultsToZero.symbols.diff | 4 +- .../maxNodeModuleJsDepthDefaultsToZero.types | 6 +- ...uthinessCallExpressionCoercion4.errors.txt | 4 +- .../truthinessCallExpressionCoercion4.symbols | 8 +- ...hinessCallExpressionCoercion4.symbols.diff | 8 +- .../truthinessCallExpressionCoercion4.types | 14 +- ...initializedModuleExportsAssignment.symbols | 4 +- ...alizedModuleExportsAssignment.symbols.diff | 4 +- ...UninitializedModuleExportsAssignment.types | 6 +- .../callbackCrossModule.errors.txt | 4 +- .../conformance/callbackCrossModule.symbols | 4 +- .../callbackCrossModule.symbols.diff | 4 +- .../conformance/callbackCrossModule.types | 6 +- ...portsObjectAssignPrototypeProperty.symbols | 4 +- ...ObjectAssignPrototypeProperty.symbols.diff | 4 +- ...ExportsObjectAssignPrototypeProperty.types | 10 +- .../checkObjectDefineProperty.errors.txt | 52 +++---- .../checkObjectDefineProperty.symbols | 4 +- .../checkObjectDefineProperty.symbols.diff | 4 +- .../checkObjectDefineProperty.types | 34 ++--- .../commonJSImportClassTypeReference.types | 6 +- ...ommonJSImportExportedClassExpression.types | 6 +- ...mmonJSImportNestedClassTypeReference.types | 6 +- .../conformance/constructorFunctions2.symbols | 4 +- .../constructorFunctions2.symbols.diff | 4 +- .../conformance/constructorFunctions2.types | 12 +- .../conformance/enumTagImported.types | 2 +- .../conformance/exportNamespace11.errors.txt | 14 -- .../exportNamespace11.errors.txt.diff | 19 +++ .../conformance/exportNamespace11.symbols | 2 + .../exportNamespace11.symbols.diff | 3 + .../conformance/exportNamespace11.types | 6 +- .../conformance/exportNamespace11.types.diff | 10 +- .../conformance/exportNamespace12.errors.txt | 20 --- .../exportNamespace12.errors.txt.diff | 25 ++++ .../conformance/exportNamespace12.js | 3 +- .../conformance/exportNamespace12.js.diff | 4 +- .../conformance/exportNamespace12.symbols | 2 + .../exportNamespace12.symbols.diff | 3 + .../conformance/exportNamespace12.types | 4 +- .../conformance/exportNamespace12.types.diff | 10 +- .../conformance/exportNamespace4.errors.txt | 6 +- .../exportNamespace4.errors.txt.diff | 21 +++ .../submodule/conformance/exportNamespace4.js | 3 +- .../conformance/exportNamespace4.js.diff | 9 +- .../conformance/exportNamespace5.errors.txt | 34 ----- .../exportNamespace5.errors.txt.diff | 39 +++++ .../submodule/conformance/exportNamespace5.js | 4 +- .../conformance/exportNamespace5.js.diff | 4 +- .../conformance/exportNamespace6.errors.txt | 24 --- .../exportNamespace6.errors.txt.diff | 29 ++++ .../submodule/conformance/exportNamespace6.js | 5 +- .../conformance/exportNamespace6.js.diff | 5 +- .../conformance/exportNamespace7.errors.txt | 46 ------ .../exportNamespace7.errors.txt.diff | 51 +++++++ .../submodule/conformance/exportNamespace7.js | 11 +- .../conformance/exportNamespace7.js.diff | 11 +- .../conformance/exportNamespace8.errors.txt | 6 +- .../exportNamespace8.errors.txt.diff | 22 +++ .../submodule/conformance/exportNamespace8.js | 2 +- .../conformance/exportNamespace8.js.diff | 2 +- .../conformance/exportNamespace_js.errors.txt | 16 -- .../exportedEnumTypeAndValue.types | 2 +- .../importAliasModuleExports.symbols | 4 +- .../importAliasModuleExports.symbols.diff | 4 +- .../importAliasModuleExports.types | 22 +-- ...larationsClassExtendsVisibility.errors.txt | 12 +- ...DeclarationsClassExtendsVisibility.symbols | 14 +- ...rationsClassExtendsVisibility.symbols.diff | 19 ++- ...jsDeclarationsClassExtendsVisibility.types | 26 ++-- .../jsDeclarationsClassStatic.errors.txt | 12 +- .../jsDeclarationsClassStatic.symbols | 10 +- .../jsDeclarationsClassStatic.symbols.diff | 13 +- .../jsDeclarationsClassStatic.types | 16 +- ...clarationsExportAssignedVisibility.symbols | 4 +- ...tionsExportAssignedVisibility.symbols.diff | 4 +- ...DeclarationsExportAssignedVisibility.types | 6 +- .../jsDeclarationsExportForms.symbols | 4 +- .../jsDeclarationsExportForms.symbols.diff | 4 +- .../jsDeclarationsExportForms.types | 6 +- .../jsDeclarationsExportFormsErr.symbols | 4 +- .../jsDeclarationsExportFormsErr.symbols.diff | 4 +- .../jsDeclarationsExportFormsErr.types | 6 +- ...eclarationsExportSubAssignments.errors.txt | 14 +- ...jsDeclarationsExportSubAssignments.symbols | 10 +- ...larationsExportSubAssignments.symbols.diff | 12 +- .../jsDeclarationsExportSubAssignments.types | 16 +- ...FunctionClassesCjsExportAssignment.symbols | 12 +- ...ionClassesCjsExportAssignment.symbols.diff | 12 +- ...nsFunctionClassesCjsExportAssignment.types | 18 +-- .../jsDeclarationsFunctionLikeClasses.types | 8 +- ...eclarationsFunctionPrototypeStatic.symbols | 4 +- ...ationsFunctionPrototypeStatic.symbols.diff | 4 +- ...sDeclarationsFunctionPrototypeStatic.types | 6 +- ...sFunctionWithDefaultAssignedMember.symbols | 4 +- ...tionWithDefaultAssignedMember.symbols.diff | 4 +- ...onsFunctionWithDefaultAssignedMember.types | 6 +- .../jsDeclarationsImportTypeBundled.symbols | 8 +- ...DeclarationsImportTypeBundled.symbols.diff | 8 +- .../jsDeclarationsImportTypeBundled.types | 18 +-- .../conformance/jsDeclarationsJson.symbols | 4 +- .../jsDeclarationsJson.symbols.diff | 4 +- .../conformance/jsDeclarationsJson.types | 6 +- .../jsDeclarationsPackageJson.symbols | 4 +- .../jsDeclarationsPackageJson.symbols.diff | 4 +- .../jsDeclarationsPackageJson.types | 6 +- ...ameterTagReusesInputNodeInEmit1.errors.txt | 5 +- ...ParameterTagReusesInputNodeInEmit1.symbols | 4 +- ...eterTagReusesInputNodeInEmit1.symbols.diff | 4 +- ...nsParameterTagReusesInputNodeInEmit1.types | 6 +- ...ameterTagReusesInputNodeInEmit2.errors.txt | 30 ---- ...ParameterTagReusesInputNodeInEmit2.symbols | 4 +- ...eterTagReusesInputNodeInEmit2.symbols.diff | 4 +- ...nsParameterTagReusesInputNodeInEmit2.types | 6 +- ...ionsReexportAliasesEsModuleInterop.symbols | 8 +- ...eexportAliasesEsModuleInterop.symbols.diff | 8 +- ...ationsReexportAliasesEsModuleInterop.types | 16 +- ...onsReferenceToClassInstanceCrossFile.types | 8 +- ...onsTypeReassignmentFromDeclaration.symbols | 4 +- ...peReassignmentFromDeclaration.symbols.diff | 4 +- ...tionsTypeReassignmentFromDeclaration.types | 6 +- ...nsTypeReassignmentFromDeclaration2.symbols | 4 +- ...eReassignmentFromDeclaration2.symbols.diff | 4 +- ...ionsTypeReassignmentFromDeclaration2.types | 6 +- ...sDeclarationsTypedefAndImportTypes.symbols | 4 +- ...arationsTypedefAndImportTypes.symbols.diff | 4 +- .../jsDeclarationsTypedefAndImportTypes.types | 6 +- .../jsDeclarationsTypedefAndLatebound.symbols | 4 +- ...clarationsTypedefAndLatebound.symbols.diff | 4 +- .../jsDeclarationsTypedefAndLatebound.types | 10 +- ...TypedefPropertyAndExportAssignment.symbols | 4 +- ...efPropertyAndExportAssignment.symbols.diff | 4 +- ...nsTypedefPropertyAndExportAssignment.types | 6 +- .../conformance/jsdocImportType.symbols | 4 +- .../conformance/jsdocImportType.symbols.diff | 4 +- .../conformance/jsdocImportType.types | 10 +- ...ReferenceToImportOfClassExpression.symbols | 4 +- ...enceToImportOfClassExpression.symbols.diff | 4 +- ...peReferenceToImportOfClassExpression.types | 12 +- ...erenceToImportOfFunctionExpression.symbols | 4 +- ...eToImportOfFunctionExpression.symbols.diff | 4 +- ...eferenceToImportOfFunctionExpression.types | 12 +- .../moduleExportAliasExports.errors.txt | 16 +- .../moduleExportAliasExports.types | 6 +- .../moduleExportAliasImported.errors.txt | 15 +- .../moduleExportAliasImported.symbols | 6 +- .../moduleExportAliasImported.symbols.diff | 11 +- .../moduleExportAliasImported.types | 12 +- .../moduleExportAssignment5.errors.txt | 12 +- .../moduleExportAssignment5.symbols | 10 +- .../moduleExportAssignment5.symbols.diff | 12 +- .../conformance/moduleExportAssignment5.types | 16 +- ...ExportPropertyAssignmentDefault.errors.txt | 12 +- ...uleExportPropertyAssignmentDefault.symbols | 10 +- ...portPropertyAssignmentDefault.symbols.diff | 12 +- ...oduleExportPropertyAssignmentDefault.types | 16 +- ...rtWithExportPropertyAssignment4.errors.txt | 29 ++-- ...xportWithExportPropertyAssignment4.symbols | 42 +++--- ...WithExportPropertyAssignment4.symbols.diff | 44 +++--- ...eExportWithExportPropertyAssignment4.types | 76 +++++----- ...ExportAssignment(module=node16).errors.txt | 5 +- ...wJsExportAssignment(module=node16).symbols | 8 +- ...portAssignment(module=node16).symbols.diff | 8 +- ...lowJsExportAssignment(module=node16).types | 12 +- ...portAssignment(module=nodenext).errors.txt | 5 +- ...sExportAssignment(module=nodenext).symbols | 8 +- ...rtAssignment(module=nodenext).symbols.diff | 8 +- ...wJsExportAssignment(module=nodenext).types | 12 +- .../typeFromParamTagForFunction.types | 24 +-- .../typeFromPropertyAssignment17.symbols | 4 +- .../typeFromPropertyAssignment17.symbols.diff | 4 +- .../typeFromPropertyAssignment17.types | 16 +- .../conformance/typedefCrossModule.symbols | 4 +- .../typedefCrossModule.symbols.diff | 4 +- .../conformance/typedefCrossModule.types | 6 +- .../typedefCrossModule2.errors.txt | 5 +- .../conformance/typedefCrossModule2.types | 2 +- .../conformance/typedefCrossModule3.symbols | 4 +- .../typedefCrossModule3.symbols.diff | 4 +- .../conformance/typedefCrossModule3.types | 6 +- ...mdLikeInputDeclarationEmit.errors.txt.diff | 11 +- .../amdLikeInputDeclarationEmit.types.diff | 2 +- ...ntDefineProperrtyPotentialMerge.types.diff | 16 +- ...ipt(verbatimmodulesyntax=false).types.diff | 11 +- ...ript(verbatimmodulesyntax=true).types.diff | 11 +- .../javascriptCommonjsModule.types.diff | 11 +- ...avascriptImportDefaultBadExport.types.diff | 13 +- ...NodeModuleJsDepthDefaultsToZero.types.diff | 6 +- ...essCallExpressionCoercion4.errors.txt.diff | 4 +- ...uthinessCallExpressionCoercion4.types.diff | 25 +++- ...tializedModuleExportsAssignment.types.diff | 11 +- .../callbackCrossModule.errors.txt.diff | 4 +- .../callbackCrossModule.types.diff | 6 +- ...tsObjectAssignPrototypeProperty.types.diff | 10 +- .../checkObjectDefineProperty.errors.txt.diff | 52 +++---- .../checkObjectDefineProperty.types.diff | 34 ++--- ...ommonJSImportClassTypeReference.types.diff | 15 +- ...JSImportExportedClassExpression.types.diff | 15 +- ...SImportNestedClassTypeReference.types.diff | 14 +- .../constructorFunctions2.types.diff | 12 +- .../conformance/enumTagImported.types.diff | 2 +- .../exportNamespace_js.errors.txt.diff | 30 ++-- .../exportedEnumTypeAndValue.types.diff | 2 +- .../importAliasModuleExports.types.diff | 29 ++-- ...ionsClassExtendsVisibility.errors.txt.diff | 12 +- ...larationsClassExtendsVisibility.types.diff | 47 ++++-- .../jsDeclarationsClassStatic.errors.txt.diff | 12 +- .../jsDeclarationsClassStatic.types.diff | 27 ++-- ...rationsExportAssignedVisibility.types.diff | 11 +- .../jsDeclarationsExportForms.types.diff | 6 +- .../jsDeclarationsExportFormsErr.types.diff | 6 +- ...ationsExportSubAssignments.errors.txt.diff | 12 +- ...eclarationsExportSubAssignments.types.diff | 25 ++-- ...ctionClassesCjsExportAssignment.types.diff | 18 +-- ...DeclarationsFunctionLikeClasses.types.diff | 19 ++- ...arationsFunctionPrototypeStatic.types.diff | 6 +- ...nctionWithDefaultAssignedMember.types.diff | 6 +- ...jsDeclarationsImportTypeBundled.types.diff | 22 +-- .../conformance/jsDeclarationsJson.types.diff | 12 +- .../jsDeclarationsPackageJson.types.diff | 12 +- ...rTagReusesInputNodeInEmit1.errors.txt.diff | 5 +- ...ameterTagReusesInputNodeInEmit1.types.diff | 14 +- ...rTagReusesInputNodeInEmit2.errors.txt.diff | 35 ----- ...ameterTagReusesInputNodeInEmit2.types.diff | 14 +- ...sReexportAliasesEsModuleInterop.types.diff | 21 +-- ...ferenceToClassInstanceCrossFile.types.diff | 17 ++- ...TypeReassignmentFromDeclaration.types.diff | 11 +- ...ypeReassignmentFromDeclaration2.types.diff | 6 +- ...clarationsTypedefAndImportTypes.types.diff | 14 +- ...DeclarationsTypedefAndLatebound.types.diff | 24 ++- ...edefPropertyAndExportAssignment.types.diff | 9 +- .../conformance/jsdocImportType.types.diff | 15 +- ...erenceToImportOfClassExpression.types.diff | 30 +++- ...nceToImportOfFunctionExpression.types.diff | 32 +++- .../moduleExportAliasExports.errors.txt.diff | 16 +- .../moduleExportAliasExports.types.diff | 15 +- .../moduleExportAliasImported.errors.txt.diff | 15 +- .../moduleExportAliasImported.types.diff | 17 +-- .../moduleExportAssignment5.errors.txt.diff | 12 +- .../moduleExportAssignment5.types.diff | 18 +-- ...tPropertyAssignmentDefault.errors.txt.diff | 12 +- ...ExportPropertyAssignmentDefault.types.diff | 16 +- ...hExportPropertyAssignment4.errors.txt.diff | 39 +++-- ...rtWithExportPropertyAssignment4.types.diff | 90 +++++------- ...tAssignment(module=node16).errors.txt.diff | 6 +- ...ExportAssignment(module=node16).types.diff | 20 ++- ...ssignment(module=nodenext).errors.txt.diff | 6 +- ...portAssignment(module=nodenext).types.diff | 20 ++- .../typeFromParamTagForFunction.types.diff | 61 +++++--- .../typeFromPropertyAssignment17.types.diff | 16 +- .../conformance/typedefCrossModule.types.diff | 6 +- .../typedefCrossModule2.errors.txt.diff | 13 +- .../typedefCrossModule2.types.diff | 11 +- .../typedefCrossModule3.types.diff | 6 +- 287 files changed, 1846 insertions(+), 1570 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff diff --git a/internal/api/encoder/encoder.go b/internal/api/encoder/encoder.go index 5a1502eba3..9aaf947bd5 100644 --- a/internal/api/encoder/encoder.go +++ b/internal/api/encoder/encoder.go @@ -474,7 +474,7 @@ func getChildrenPropertyMask(node *ast.Node) uint8 { case ast.KindNamespaceExportDeclaration: n := node.AsNamespaceExportDeclaration() return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: n := node.AsExportDeclaration() return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.ExportClause != nil) << 1) | (boolToByte(n.ModuleSpecifier != nil) << 2) | (boolToByte(n.Attributes != nil) << 3) case ast.KindExportSpecifier: @@ -733,7 +733,7 @@ func getNodeDefinedData(node *ast.Node) uint32 { case ast.KindExportAssignment: n := node.AsExportAssignment() return uint32(boolToByte(n.IsExportEquals)) << 24 - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: n := node.AsExportDeclaration() return uint32(boolToByte(n.IsTypeOnly)) << 24 case ast.KindBlock: diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 67f0afc4e3..a51a5ae96a 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -753,7 +753,7 @@ func (n *Node) ModuleSpecifier() *Expression { switch n.Kind { case KindImportDeclaration: return n.AsImportDeclaration().ModuleSpecifier - case KindExportDeclaration: + case KindExportDeclaration, KindJSExportDeclaration: return n.AsExportDeclaration().ModuleSpecifier case KindJSDocImportTag: return n.AsJSDocImportTag().ModuleSpecifier @@ -4482,19 +4482,27 @@ type ExportDeclaration struct { Attributes *ImportAttributesNode // ImportAttributesNode. Optional } -func (f *NodeFactory) NewExportDeclaration(modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { +func (f *NodeFactory) newExportOrJSExportDeclaration(kind Kind, modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { data := &ExportDeclaration{} data.modifiers = modifiers data.IsTypeOnly = isTypeOnly data.ExportClause = exportClause data.ModuleSpecifier = moduleSpecifier data.Attributes = attributes - return f.newNode(KindExportDeclaration, data) + return f.newNode(kind, data) +} + +func (f *NodeFactory) NewExportDeclaration(modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + return f.newExportOrJSExportDeclaration(KindExportDeclaration, modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) +} + +func (f *NodeFactory) NewJSExportDeclaration(moduleSpecifier *Expression) *Node { + return f.newExportOrJSExportDeclaration(KindJSExportDeclaration, nil /*modifiers*/, false /*isTypeOnly*/, nil /*exportClause*/, moduleSpecifier, nil /*attributes*/) } func (f *NodeFactory) UpdateExportDeclaration(node *ExportDeclaration, modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { if modifiers != node.modifiers || exportClause != node.ExportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes { - return updateNode(f.NewExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node.AsNode(), f.hooks) + return updateNode(f.newExportOrJSExportDeclaration(node.Kind, modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node.AsNode(), f.hooks) } return node.AsNode() } @@ -4508,7 +4516,7 @@ func (node *ExportDeclaration) VisitEachChild(v *NodeVisitor) *Node { } func (node *ExportDeclaration) Clone(f NodeFactoryCoercible) *Node { - return cloneNode(f.AsNodeFactory().NewExportDeclaration(node.Modifiers(), node.IsTypeOnly, node.ExportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) + return cloneNode(f.AsNodeFactory().newExportOrJSExportDeclaration(node.Kind, node.Modifiers(), node.IsTypeOnly, node.ExportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) } func (node *ExportDeclaration) computeSubtreeFacts() SubtreeFacts { @@ -4523,6 +4531,10 @@ func IsExportDeclaration(node *Node) bool { return node.Kind == KindExportDeclaration } +func IsJSExportDeclaration(node *Node) bool { + return node.Kind == KindJSExportDeclaration +} + // NamespaceExport type NamespaceExport struct { diff --git a/internal/ast/kind.go b/internal/ast/kind.go index 3107c895bd..607d95af2a 100644 --- a/internal/ast/kind.go +++ b/internal/ast/kind.go @@ -380,6 +380,7 @@ const ( // Reparsed JS nodes KindJSTypeAliasDeclaration KindJSExportAssignment + KindJSExportDeclaration KindCommonJSExport // Transformation nodes KindNotEmittedStatement diff --git a/internal/ast/kind_stringer_generated.go b/internal/ast/kind_stringer_generated.go index 329adfa55d..73f47085ea 100644 --- a/internal/ast/kind_stringer_generated.go +++ b/internal/ast/kind_stringer_generated.go @@ -355,17 +355,18 @@ func _() { _ = x[KindSyntaxList-344] _ = x[KindJSTypeAliasDeclaration-345] _ = x[KindJSExportAssignment-346] - _ = x[KindCommonJSExport-347] - _ = x[KindNotEmittedStatement-348] - _ = x[KindPartiallyEmittedExpression-349] - _ = x[KindCommaListExpression-350] - _ = x[KindSyntheticReferenceExpression-351] - _ = x[KindCount-352] + _ = x[KindJSExportDeclaration-347] + _ = x[KindCommonJSExport-348] + _ = x[KindNotEmittedStatement-349] + _ = x[KindPartiallyEmittedExpression-350] + _ = x[KindCommaListExpression-351] + _ = x[KindSyntheticReferenceExpression-352] + _ = x[KindCount-353] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindCommonJSExportKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindJSExportDeclarationKindCommonJSExportKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6596, 6618, 6636, 6659, 6689, 6712, 6744, 6753} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6596, 6618, 6641, 6659, 6682, 6712, 6735, 6767, 6776} func (i Kind) String() string { if i < 0 || i >= Kind(len(_Kind_index)-1) { diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index ffe9baee60..ebc345633c 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -648,6 +648,7 @@ func isDeclarationStatementKind(kind Kind) bool { KindImportDeclaration, KindImportEqualsDeclaration, KindExportDeclaration, + KindJSExportDeclaration, KindExportAssignment, KindJSExportAssignment, KindNamespaceExportDeclaration: @@ -1677,7 +1678,7 @@ func GetExternalModuleName(node *Node) *Expression { switch node.Kind { case KindImportDeclaration: return node.AsImportDeclaration().ModuleSpecifier - case KindExportDeclaration: + case KindExportDeclaration, KindJSExportDeclaration: return node.AsExportDeclaration().ModuleSpecifier case KindJSDocImportTag: return node.AsJSDocImportTag().ModuleSpecifier @@ -1703,7 +1704,7 @@ func GetImportAttributes(node *Node) *Node { switch node.Kind { case KindImportDeclaration: return node.AsImportDeclaration().Attributes - case KindExportDeclaration: + case KindExportDeclaration, KindJSExportDeclaration: return node.AsExportDeclaration().Attributes } panic("Unhandled case in getImportAttributes") @@ -2055,7 +2056,8 @@ func GetMeaningFromDeclaration(node *Node) SemanticMeaning { KindImportDeclaration, KindExportAssignment, KindJSExportAssignment, - KindExportDeclaration: + KindExportDeclaration, + KindJSExportDeclaration: return SemanticMeaningAll // An external module can be a Value @@ -2346,7 +2348,7 @@ func GetNamespaceDeclarationNode(node *Node) *Node { } case KindImportEqualsDeclaration: return node - case KindExportDeclaration: + case KindExportDeclaration, KindJSExportDeclaration: exportClause := node.AsExportDeclaration().ExportClause if exportClause != nil && IsNamespaceExport(exportClause) { return exportClause diff --git a/internal/binder/binder.go b/internal/binder/binder.go index 90fe6ffb7a..e9eb9e9ccf 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -376,7 +376,7 @@ func (b *Binder) getDeclarationName(node *ast.Node) string { return ast.InternalSymbolNameNew case ast.KindIndexSignature: return ast.InternalSymbolNameIndex - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: return ast.InternalSymbolNameExportStar case ast.KindSourceFile: return ast.InternalSymbolNameExportEquals @@ -728,7 +728,7 @@ func (b *Binder) bind(node *ast.Node) bool { b.bindNamespaceExportDeclaration(node) case ast.KindImportClause: b.bindImportClause(node) - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: b.bindExportDeclaration(node) case ast.KindExportAssignment, ast.KindJSExportAssignment: b.bindExportAssignment(node) diff --git a/internal/binder/referenceresolver.go b/internal/binder/referenceresolver.go index 8fbe5297e3..8adae57ba7 100644 --- a/internal/binder/referenceresolver.go +++ b/internal/binder/referenceresolver.go @@ -112,6 +112,8 @@ func (r *referenceResolver) isTypeOnlyAliasDeclaration(symbol *ast.Symbol) bool switch node.Kind { case ast.KindImportEqualsDeclaration, ast.KindExportDeclaration: return node.IsTypeOnly() + case ast.KindJSExportDeclaration: + return false case ast.KindImportClause, ast.KindImportSpecifier, ast.KindExportSpecifier: if node.IsTypeOnly() { return true diff --git a/internal/checker/checker.go b/internal/checker/checker.go index eeb7cc8859..f0554a930b 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -2209,7 +2209,7 @@ func (c *Checker) checkSourceElementWorker(node *ast.Node) { c.checkImportDeclaration(node) case ast.KindImportEqualsDeclaration: c.checkImportEqualsDeclaration(node) - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: c.checkExportDeclaration(node) case ast.KindExportAssignment, ast.KindJSExportAssignment: c.checkExportAssignment(node) @@ -4890,7 +4890,7 @@ func (c *Checker) checkModuleAugmentationElement(node *ast.Node) { for _, decl := range node.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { c.checkModuleAugmentationElement(decl) } - case ast.KindExportAssignment, ast.KindJSExportAssignment, ast.KindExportDeclaration: + case ast.KindExportAssignment, ast.KindJSExportAssignment, ast.KindExportDeclaration, ast.KindJSExportDeclaration: c.grammarErrorOnFirstToken(node, diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations) case ast.KindImportEqualsDeclaration: // import a = e.x; in module augmentation is ok, but not import a = require('fs) @@ -4963,6 +4963,9 @@ func (c *Checker) checkExternalImportOrExportDeclaration(node *ast.Node) bool { // Should be a parse error. return false } + if node.Kind == ast.KindJSExportDeclaration { + return true + } if !ast.IsStringLiteral(moduleName) { c.error(moduleName, diagnostics.String_literal_expected) return false @@ -5078,7 +5081,7 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { func isExclusivelyTypeOnlyImportOrExport(node *ast.Node) bool { switch node.Kind { - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: return node.AsExportDeclaration().IsTypeOnly case ast.KindImportDeclaration: if importClause := node.AsImportDeclaration().ImportClause; importClause != nil { @@ -5172,6 +5175,9 @@ func (c *Checker) checkExportDeclaration(node *ast.Node) { if !ast.IsSourceFile(node.Parent) && !inAmbientExternalModule && !inAmbientNamespaceDeclaration { c.error(node, diagnostics.Export_declarations_are_not_permitted_in_a_namespace) } + } else if node.Kind == ast.KindJSExportDeclaration { + // export * from foo, reparsed from `module.exports = foo` + // TODO: Nothing to check that I can think of } else { // export * from "foo" // export * as ns from "foo"; @@ -13618,7 +13624,7 @@ func (c *Checker) getTargetOfImportEqualsDeclaration(node *ast.Node, dontResolve moduleReference = getExternalModuleImportEqualsDeclarationExpression(node) } immediate := c.resolveExternalModuleName(node, moduleReference, false /*ignoreErrors*/) - resolved := c.resolveExternalModuleSymbol(immediate, dontResolveAlias) + resolved := c.resolveExternalModuleSymbol(immediate, false /*dontResolveAlias*/) c.markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false /*overwriteEmpty*/, nil, "") return resolved } @@ -13663,7 +13669,7 @@ func (c *Checker) checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(nod decl := node.AsImportEqualsDeclaration() if c.markSymbolOfAliasDeclarationIfTypeOnly(node, nil /*immediateTarget*/, resolved, false /*overwriteEmpty*/, nil, "") && !decl.IsTypeOnly { typeOnlyDeclaration := c.getTypeOnlyAliasDeclaration(c.getSymbolOfDeclaration(node)) - isExport := ast.NodeKindIs(typeOnlyDeclaration, ast.KindExportSpecifier, ast.KindExportDeclaration) + isExport := ast.NodeKindIs(typeOnlyDeclaration, ast.KindExportSpecifier, ast.KindExportDeclaration, ast.KindJSExportDeclaration) message := core.IfElse(isExport, diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type, diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type) @@ -14109,6 +14115,7 @@ func (c *Checker) getTargetOfExportAssignment(node *ast.Node, dontResolveAlias b return resolved } +// TODO: Is this still used? func (c *Checker) getTargetOfBinaryExpression(node *ast.Node, dontResolveAlias bool) *ast.Symbol { resolved := c.getTargetOfAliasLikeExpression(node.AsBinaryExpression().Right, dontResolveAlias) c.markSymbolOfAliasDeclarationIfTypeOnly(node, nil /*immediateTarget*/, resolved, false /*overwriteEmpty*/, nil, "") @@ -14175,7 +14182,7 @@ func getModuleSpecifierFromNode(node *ast.Node) *ast.Node { switch node.Kind { case ast.KindImportDeclaration: return node.AsImportDeclaration().ModuleSpecifier - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: return node.AsExportDeclaration().ModuleSpecifier } panic("Unhandled case in getModuleSpecifierFromNode") @@ -14520,7 +14527,29 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign if resolveLocation == nil { resolveLocation = name } - symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) + symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, nil, true /*isUse*/, false /*excludeGlobals*/)) + if symbol == nil && meaning == ast.SymbolFlagsType && !dontResolveAlias && ast.IsInJSFile(name) { + symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, ast.SymbolFlagsAlias, nil, true /*isUse*/, false /*excludeGlobals*/)) + if symbol == nil || symbol.Flags&ast.SymbolFlagsAlias == 0 { + c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) + return nil + } else { + target := c.resolveAlias(symbol) + if target.Flags&ast.SymbolFlagsValueModule != 0 && c.getExportsOfModule(target)[ast.InternalSymbolNameExportStar] != nil { + exportstar := c.getExportsOfModule(target)[ast.InternalSymbolNameExportStar] + if core.Some(exportstar.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportDeclaration }) { + for _, node := range exportstar.Declarations { + if node.Kind == ast.KindJSExportDeclaration { + return c.getTargetOfAliasLikeExpression(node.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) + } + } + } + } + } + c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) + } else { + c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) + } case ast.KindQualifiedName: qualified := name.AsQualifiedName() symbol = c.resolveQualifiedName(name, qualified.Left, qualified.Right, meaning, ignoreErrors, dontResolveAlias, location) @@ -14545,24 +14574,9 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign } func (c *Checker) resolveQualifiedName(name *ast.Node, left *ast.Node, right *ast.Node, meaning ast.SymbolFlags, ignoreErrors bool, dontResolveAlias bool, location *ast.Node) *ast.Symbol { - namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, true /*ignoreErrors*/, false /*dontResolveAlias*/, location) + namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) if namespace == nil || ast.NodeIsMissing(right) { - var immediate *ast.Symbol - alias := c.resolveEntityName(left, ast.SymbolFlagsAlias, true /*ignoreErrors*/, true /*dontResolveAlias*/, location) - if alias != nil { - immediate = c.getImmediateAliasedSymbol(alias) - if immediate != nil && !core.Some(immediate.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { - immediate = nil - } - } - if immediate == nil { - if !ignoreErrors { - c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) - } - return nil - } else { - namespace = immediate - } + return nil } if namespace == c.unknownSymbol { return namespace @@ -14892,8 +14906,21 @@ func (c *Checker) getExportsOfModuleWorker(moduleSymbol *ast.Symbol) (exports as nestedSymbols := make(ast.SymbolTable) lookupTable := make(ExportCollisionTable) for _, node := range exportStars.Declarations { - resolvedModule := c.resolveExternalModuleName(node, node.AsExportDeclaration().ModuleSpecifier, false /*ignoreErrors*/) - exportedSymbols := visit(resolvedModule, node, isTypeOnly || node.AsExportDeclaration().IsTypeOnly) + var resolved *ast.Symbol + if node.Kind == ast.KindJSExportDeclaration { + resolved = c.getTargetOfAliasLikeExpression(node.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) + if resolved != nil && resolved.ValueDeclaration != nil && ast.IsVariableDeclaration(resolved.ValueDeclaration) { + initializer := resolved.ValueDeclaration.Initializer() + if initializer != nil && ast.IsFunctionExpressionOrArrowFunction(initializer) { + initSymbol := c.getSymbolOfNode(initializer) + exportedSymbols := visit(initSymbol, node, isTypeOnly) + c.extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node) + } + } + } else { + resolved = c.resolveExternalModuleName(node, node.AsExportDeclaration().ModuleSpecifier, false /*ignoreErrors*/) + } + exportedSymbols := visit(resolved, node, isTypeOnly) c.extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node) } for id, s := range lookupTable { @@ -18237,8 +18264,6 @@ func (c *Checker) getSignaturesOfSymbol(symbol *ast.Symbol) []*Signature { continue } } - // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. - // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would suppress checks that the two are compatible. result = append(result, c.getSignatureFromDeclaration(decl)) } return result @@ -19080,18 +19105,32 @@ func (c *Checker) resolveAnonymousTypeMembers(t *Type) { } } d.indexInfos = indexInfos + s := symbol + if members[ast.InternalSymbolNameExportStar] != nil && + core.Some(members[ast.InternalSymbolNameExportStar].Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportDeclaration }) { + // dereference `export * as id` to see whether it is a function or class that should contribute signatures + // TODO: This might need recursive deference like getExportsOfModuleWorker does (although resolving aliases might take care of that) + for _, node := range members[ast.InternalSymbolNameExportStar].Declarations { + if node.Kind == ast.KindJSExportDeclaration { + s2 := c.getTargetOfAliasLikeExpression(node.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) + if s2 != nil { + s = s2 + } + } + } + } // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are // in the process of resolving (see issue #6072). The temporarily empty signature list // will never be observed because a qualified name can't reference signatures. - if symbol.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0 { - d.signatures = c.getSignaturesOfSymbol(symbol) + if s.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0 { + d.signatures = c.getSignaturesOfSymbol(s) d.callSignatureCount = len(d.signatures) } // And likewise for construct signatures for classes - if symbol.Flags&ast.SymbolFlagsClass != 0 { - classType := c.getDeclaredTypeOfClassOrInterface(symbol) - constructSignatures := c.getSignaturesOfSymbol(symbol.Members[ast.InternalSymbolNameConstructor]) + if s.Flags&ast.SymbolFlagsClass != 0 { + classType := c.getDeclaredTypeOfClassOrInterface(s) + constructSignatures := c.getSignaturesOfSymbol(s.Members[ast.InternalSymbolNameConstructor]) if len(constructSignatures) == 0 { constructSignatures = c.getDefaultConstructSignatures(classType) } @@ -22845,20 +22884,9 @@ func (c *Checker) getTypeFromImportTypeNode(node *ast.Node) *Type { } next := core.OrElse(symbolFromModule, symbolFromVariable) if next == nil { - var symbolFromImmediateModule *ast.Symbol - if currentNamespace == moduleSymbol { - immediateModuleSymbol := c.resolveExternalModuleSymbol(innerModuleSymbol, true /*dontResolveAlias*/) - if immediateModuleSymbol != nil && core.Some(immediateModuleSymbol.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { - symbolFromImmediateModule = c.getSymbol(c.getExportsOfSymbol(immediateModuleSymbol), current.Text(), meaning) - } - } - if symbolFromImmediateModule != nil { - next = symbolFromImmediateModule - } else { - c.error(current, diagnostics.Namespace_0_has_no_exported_member_1, c.getFullyQualifiedName(currentNamespace, nil), scanner.DeclarationNameToString(current)) - links.resolvedType = c.errorType - return links.resolvedType - } + c.error(current, diagnostics.Namespace_0_has_no_exported_member_1, c.getFullyQualifiedName(currentNamespace, nil), scanner.DeclarationNameToString(current)) + links.resolvedType = c.errorType + return links.resolvedType } c.symbolNodeLinks.Get(current).resolvedSymbol = next c.symbolNodeLinks.Get(current.Parent).resolvedSymbol = next @@ -22869,9 +22897,24 @@ func (c *Checker) getTypeFromImportTypeNode(node *ast.Node) *Type { if moduleSymbol.Flags&targetMeaning != 0 { links.resolvedType = c.resolveImportSymbolType(node, moduleSymbol, targetMeaning) } else { + if moduleSymbol.Flags&ast.SymbolFlagsValueModule != 0 && c.getExportsOfModule(moduleSymbol)[ast.InternalSymbolNameExportStar] != nil { + exportstar := c.getExportsOfModule(moduleSymbol)[ast.InternalSymbolNameExportStar] + if core.Some(exportstar.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportDeclaration }) { + for _, decl := range exportstar.Declarations { + if decl.Kind == ast.KindJSExportDeclaration { + s := c.getTargetOfAliasLikeExpression(decl.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) + if s.Flags&targetMeaning != 0 { + links.resolvedType = c.resolveImportSymbolType(node, s, targetMeaning) + return links.resolvedType + } + } + } + } + } message := core.IfElse(targetMeaning == ast.SymbolFlagsValue, diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here, diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0) + c.error(node, message, n.Argument.AsLiteralTypeNode().Literal.Text()) c.symbolNodeLinks.Get(node).resolvedSymbol = c.unknownSymbol links.resolvedType = c.errorType diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 6e61fdaaf8..bf3356a3ba 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -600,6 +600,7 @@ func (c *Checker) findFirstIllegalModifier(node *ast.Node) *ast.Node { ast.KindImportDeclaration, ast.KindImportEqualsDeclaration, ast.KindExportDeclaration, + ast.KindJSExportDeclaration, ast.KindExportAssignment, ast.KindJSExportAssignment, ast.KindFunctionExpression, @@ -2021,7 +2022,7 @@ func (c *Checker) checkGrammarTopLevelElementForRequiredDeclareModifier(node *as // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if node.Kind == ast.KindInterfaceDeclaration || node.Kind == ast.KindTypeAliasDeclaration || node.Kind == ast.KindImportDeclaration || node.Kind == ast.KindImportEqualsDeclaration || node.Kind == ast.KindExportDeclaration || node.Kind == ast.KindExportAssignment || node.Kind == ast.KindJSExportAssignment || node.Kind == ast.KindNamespaceExportDeclaration || ast.HasSyntacticModifier(node, ast.ModifierFlagsAmbient|ast.ModifierFlagsExport|ast.ModifierFlagsDefault) { + if node.Kind == ast.KindInterfaceDeclaration || node.Kind == ast.KindTypeAliasDeclaration || node.Kind == ast.KindImportDeclaration || node.Kind == ast.KindImportEqualsDeclaration || node.Kind == ast.KindExportDeclaration || node.Kind == ast.KindJSExportDeclaration || node.Kind == ast.KindExportAssignment || node.Kind == ast.KindJSExportAssignment || node.Kind == ast.KindNamespaceExportDeclaration || ast.HasSyntacticModifier(node, ast.ModifierFlagsAmbient|ast.ModifierFlagsExport|ast.ModifierFlagsDefault) { return false } diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 4c22427383..e52537aaa9 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -309,7 +309,7 @@ func canHaveSymbol(node *ast.Node) bool { case ast.KindArrowFunction, ast.KindBinaryExpression, ast.KindBindingElement, ast.KindCallExpression, ast.KindCallSignature, ast.KindClassDeclaration, ast.KindClassExpression, ast.KindClassStaticBlockDeclaration, ast.KindConstructor, ast.KindConstructorType, ast.KindConstructSignature, ast.KindElementAccessExpression, ast.KindEnumDeclaration, ast.KindEnumMember, ast.KindExportAssignment, ast.KindJSExportAssignment, - ast.KindExportDeclaration, ast.KindExportSpecifier, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindFunctionType, + ast.KindExportDeclaration, ast.KindJSExportDeclaration, ast.KindExportSpecifier, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindFunctionType, ast.KindGetAccessor, ast.KindIdentifier, ast.KindImportClause, ast.KindImportEqualsDeclaration, ast.KindImportSpecifier, ast.KindIndexSignature, ast.KindInterfaceDeclaration, ast.KindJSDocSignature, ast.KindJSDocTypeLiteral, ast.KindJsxAttribute, ast.KindJsxAttributes, ast.KindJsxSpreadAttribute, ast.KindMappedType, ast.KindMethodDeclaration, diff --git a/internal/ls/utilities.go b/internal/ls/utilities.go index 719588ae09..54954ab5e8 100644 --- a/internal/ls/utilities.go +++ b/internal/ls/utilities.go @@ -20,7 +20,7 @@ func isInString(file *ast.SourceFile, position int, previousToken *ast.Node) boo func tryGetImportFromModuleSpecifier(node *ast.StringLiteralLike) *ast.Node { switch node.Parent.Kind { - case ast.KindImportDeclaration, ast.KindExportDeclaration, ast.KindJSDocImportTag: + case ast.KindImportDeclaration, ast.KindExportDeclaration, ast.KindJSExportDeclaration, ast.KindJSDocImportTag: return node.Parent case ast.KindExternalModuleReference: return node.Parent.Parent diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index dd2cb4f36b..ff3bffab89 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -34,7 +34,11 @@ func (p *Parser) reparseCommonJS(node *ast.Node) { var export *ast.Node switch kind { case jsDeclarationKindModuleExports: - export = p.factory.NewJSExportAssignment(bin.Right) + if bin.Right.Kind == ast.KindIdentifier { + export = p.factory.NewJSExportDeclaration(bin.Right) + } else { + export = p.factory.NewJSExportAssignment(bin.Right) + } case jsDeclarationKindExportsProperty: nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = p.factory.NewModifier(ast.KindExportKeyword) diff --git a/internal/printer/namegenerator.go b/internal/printer/namegenerator.go index 274e68ebc0..f3d8be85d0 100644 --- a/internal/printer/namegenerator.go +++ b/internal/printer/namegenerator.go @@ -158,7 +158,7 @@ func (g *NameGenerator) generateNameForNode(node *ast.Node, privateName bool, fl panic("Generated name for a module or enum cannot be private and may have neither a prefix nor suffix") } return g.generateNameForModuleOrEnum(node) - case ast.KindImportDeclaration, ast.KindExportDeclaration: + case ast.KindImportDeclaration, ast.KindExportDeclaration, ast.KindJSExportDeclaration: if privateName || len(prefix) > 0 || len(suffix) > 0 { panic("Generated name for an import or export cannot be private and may have neither a prefix nor suffix") } diff --git a/internal/printer/printer.go b/internal/printer/printer.go index a88f2af874..6fb2cf48ca 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -3957,7 +3957,7 @@ func (p *Printer) emitStatement(node *ast.Statement) { p.emitImportDeclaration(node.AsImportDeclaration()) case ast.KindExportAssignment, ast.KindJSExportAssignment: p.emitExportAssignment(node.AsExportAssignment()) - case ast.KindExportDeclaration: + case ast.KindExportDeclaration, ast.KindJSExportDeclaration: p.emitExportDeclaration(node.AsExportDeclaration()) case ast.KindCommonJSExport: p.emitCommonJSExport(node.AsCommonJSExport()) diff --git a/internal/transformers/typeeraser.go b/internal/transformers/typeeraser.go index c2eaa6d748..6a4a84c020 100644 --- a/internal/transformers/typeeraser.go +++ b/internal/transformers/typeeraser.go @@ -95,7 +95,7 @@ func (tx *TypeEraserTransformer) visit(node *ast.Node) *ast.Node { ast.KindIndexSignature: return nil - case ast.KindJSExportAssignment: + case ast.KindJSExportAssignment, ast.KindJSExportDeclaration: // reparsed commonjs are elided return nil case ast.KindTypeAliasDeclaration, diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt index 1fafa07a86..df5d21ebc0 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt @@ -1,4 +1,6 @@ -ExtendedClass.js(17,5): error TS1231: An export assignment must be at the top level of a file or module declaration. +ExtendedClass.js(7,1): error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. + Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. +ExtendedClass.js(17,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. ExtendedClass.js(17,12): error TS2339: Property 'exports' does not exist on type '{}'. ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type '{}'. @@ -12,7 +14,7 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type } export = BaseClass; } -==== ExtendedClass.js (3 errors) ==== +==== ExtendedClass.js (4 errors) ==== define("lib/ExtendedClass", ["deps/BaseClass"], /** * {typeof import("deps/BaseClass")} @@ -20,6 +22,9 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type * @returns */ (BaseClass) => { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. +!!! error TS2345: Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. const ExtendedClass = BaseClass.extends({ f: function() { @@ -31,7 +36,7 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type const module = {}; module.exports = ExtendedClass ~~~~~~ -!!! error TS1231: An export assignment must be at the top level of a file or module declaration. +!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. ~~~~~~~ !!! error TS2339: Property 'exports' does not exist on type '{}'. return module.exports; diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types index 176cd065be..cdb506c2af 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types @@ -36,7 +36,7 @@ define("lib/ExtendedClass", ["deps/BaseClass"], * @returns */ (BaseClass) => { ->(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof BaseClass) => any +>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : {} >BaseClass : typeof BaseClass const ExtendedClass = BaseClass.extends({ diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols index fb39c7c530..7f42df0ae3 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols @@ -26,9 +26,9 @@ A.bar = class Q {} >Q : Symbol(Q, Decl(namespacey.js, 1, 7)) module.exports = A; ->module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>module.exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) >A : Symbol(A, Decl(namespacey.js, 0, 5)) === namespacer.js === @@ -47,8 +47,8 @@ Object.defineProperty(B, "NS", { value: "why though", writable: true }); >writable : Symbol(writable, Decl(namespacer.js, 2, 53)) module.exports = B; ->module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>module.exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) >B : Symbol(B, Decl(namespacer.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff index b59f9153cc..3ae4831f69 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff @@ -37,9 +37,9 @@ ->module : Symbol(export=, Decl(namespacey.js, 1, 18)) ->exports : Symbol(export=, Decl(namespacey.js, 1, 18)) ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) -+>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) ++>module.exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(A, Decl(namespacey.js, 0, 5)) ++>exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) +>A : Symbol(A, Decl(namespacey.js, 0, 5)) === namespacer.js === @@ -72,8 +72,8 @@ ->module : Symbol(export=, Decl(namespacer.js, 2, 72)) ->exports : Symbol(export=, Decl(namespacer.js, 2, 72)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) -+>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) ++>module.exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(B, Decl(namespacer.js, 0, 5)) ++>exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types index a8380c7361..c9f9c8a096 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types @@ -2,8 +2,8 @@ === index.js === const _item = require("./namespacer"); ->_item : {} ->require("./namespacer") : {} +>_item : typeof import("namespacer") +>require("./namespacer") : typeof import("namespacer") >require : any >"./namespacer" : "./namespacer" @@ -40,9 +40,9 @@ A.bar = class Q {} module.exports = A; >module.exports = A : {} ->module.exports : {} ->module : { readonly A: {}; } ->exports : {} +>module.exports : typeof import("namespacey") +>module : { "namespacey": typeof import("namespacey"); } +>exports : typeof import("namespacey") >A : {} === namespacer.js === @@ -74,8 +74,8 @@ Object.defineProperty(B, "NS", { value: "why though", writable: true }); module.exports = B; >module.exports = B : {} ->module.exports : {} ->module : { readonly B: {}; } ->exports : {} +>module.exports : typeof import("namespacer") +>module : { "namespacer": typeof import("namespacer"); } +>exports : typeof import("namespacer") >B : {} diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols index 285cda7771..e8fa5dbeff 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols @@ -17,8 +17,8 @@ class Bar extends Foo {} >Foo : Symbol(Foo, Decl(index.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol(Bar, Decl(index.js, 0, 12)) +>module.exports : Symbol("/index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Bar, Decl(index.js, 0, 12)) +>exports : Symbol("/index", Decl(index.js, 0, 0)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff index c22c0e260b..f7c2413cc8 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff @@ -16,8 +16,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 2, 24)) ->exports : Symbol(export=, Decl(index.js, 2, 24)) -+>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) ++>module.exports : Symbol("/index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Bar, Decl(index.js, 0, 12)) ++>exports : Symbol("/index", Decl(index.js, 0, 0)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types index f7a302d8e7..7e9a0d769f 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types @@ -18,8 +18,8 @@ class Bar extends Foo {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof Bar ->module : { Bar: typeof Bar; } ->exports : typeof Bar +>module.exports : typeof import("/index") +>module : { "/index": typeof import("/index"); } +>exports : typeof import("/index") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols index 285cda7771..e8fa5dbeff 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols @@ -17,8 +17,8 @@ class Bar extends Foo {} >Foo : Symbol(Foo, Decl(index.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol(Bar, Decl(index.js, 0, 12)) +>module.exports : Symbol("/index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Bar, Decl(index.js, 0, 12)) +>exports : Symbol("/index", Decl(index.js, 0, 0)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff index a8542a07f3..c4d14b2b9e 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff @@ -16,8 +16,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 2, 24)) ->exports : Symbol(export=, Decl(index.js, 2, 24)) -+>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) ++>module.exports : Symbol("/index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Bar, Decl(index.js, 0, 12)) ++>exports : Symbol("/index", Decl(index.js, 0, 0)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types index f7a302d8e7..7e9a0d769f 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types @@ -18,8 +18,8 @@ class Bar extends Foo {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof Bar ->module : { Bar: typeof Bar; } ->exports : typeof Bar +>module.exports : typeof import("/index") +>module : { "/index": typeof import("/index"); } +>exports : typeof import("/index") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols index bf438af52c..e5b2733bb0 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols +++ b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols @@ -9,8 +9,8 @@ class Bar extends Foo {} >Foo : Symbol(Foo, Decl(index.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol(Bar, Decl(index.js, 0, 12)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Bar, Decl(index.js, 0, 12)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff index 6698b104d6..c078ecd8a8 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff @@ -7,8 +7,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 2, 24)) ->exports : Symbol(export=, Decl(index.js, 2, 24)) -+>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Bar, Decl(index.js, 0, 12)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types index bae91c5459..9f8ef2822f 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types +++ b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types @@ -10,8 +10,8 @@ class Bar extends Foo {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof Bar ->module : { Bar: typeof Bar; } ->exports : typeof Bar +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols index e1364018d2..b5c6a24ae6 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols +++ b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols @@ -5,9 +5,9 @@ const alias = {}; >alias : Symbol(alias, Decl(a.js, 0, 5)) module.exports = alias; ->module.exports : Symbol(alias, Decl(a.js, 0, 5)) +>module.exports : Symbol("/a", Decl(a.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(alias, Decl(a.js, 0, 5)) +>exports : Symbol("/a", Decl(a.js, 0, 0)) >alias : Symbol(alias, Decl(a.js, 0, 5)) === /b.js === diff --git a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff index 49b75e9dcf..12f86c1b12 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(a.js, 0, 0)) ->module : Symbol(export=, Decl(a.js, 0, 17)) ->exports : Symbol(export=, Decl(a.js, 0, 17)) -+>module.exports : Symbol(alias, Decl(a.js, 0, 5)) ++>module.exports : Symbol("/a", Decl(a.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(alias, Decl(a.js, 0, 5)) ++>exports : Symbol("/a", Decl(a.js, 0, 0)) >alias : Symbol(alias, Decl(a.js, 0, 5)) === /b.js === diff --git a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types index b1ae2fc014..c2d91e04de 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types +++ b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types @@ -7,12 +7,12 @@ const alias = {}; module.exports = alias; >module.exports = alias : {} ->module.exports : {} ->module : { readonly alias: {}; } ->exports : {} +>module.exports : typeof import("/a") +>module : { "/a": typeof import("/a"); } +>exports : typeof import("/a") >alias : {} === /b.js === import a from "./a"; ->a : {} +>a : typeof import("/a") diff --git a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols index 17104ab2ab..1b5b62bef9 100644 --- a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols +++ b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols @@ -41,8 +41,8 @@ var y = { y: 'foo' }; >y : Symbol(y, Decl(index.js, 1, 9)) module.exports = y; ->module.exports : Symbol(y, Decl(index.js, 1, 3)) +>module.exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(y, Decl(index.js, 1, 3)) +>exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) >y : Symbol(y, Decl(index.js, 1, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff index f65a01da1c..7ca8b8d98e 100644 --- a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff @@ -33,8 +33,8 @@ +>y : Symbol(y, Decl(index.js, 1, 9)) + +module.exports = y; -+>module.exports : Symbol(y, Decl(index.js, 1, 3)) ++>module.exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(y, Decl(index.js, 1, 3)) ++>exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) +>y : Symbol(y, Decl(index.js, 1, 3)) + diff --git a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types index 04e5662c06..c57aa2b33c 100644 --- a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types +++ b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types @@ -50,8 +50,8 @@ var y = { y: 'foo' }; module.exports = y; >module.exports = y : { y: string; } ->module.exports : { y: string; } ->module : { y: { y: string; }; } ->exports : { y: string; } +>module.exports : typeof import("/node_modules/shortid/index") +>module : { "/node_modules/shortid/index": typeof import("/node_modules/shortid/index"); } +>exports : typeof import("/node_modules/shortid/index") >y : { y: string; } diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt index 1e6ac9586c..aba768686f 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt @@ -1,5 +1,5 @@ a.js(3,12): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -a.js(4,5): error TS1231: An export assignment must be at the top level of a file or module declaration. +a.js(4,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. ==== a.js (2 errors) ==== @@ -10,6 +10,6 @@ a.js(4,5): error TS1231: An export assignment must be at the top level of a file !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. module.exports = fn; ~~~~~~ -!!! error TS1231: An export assignment must be at the top level of a file or module declaration. +!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols index e7ec94d877..cfb3c19253 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols @@ -5,14 +5,14 @@ function fn() {} >fn : Symbol(fn, Decl(a.js, 0, 0)) if (typeof module === 'object' && module.exports) { ->module.exports : Symbol(fn, Decl(a.js, 0, 0)) +>module.exports : Symbol("a", Decl(a.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(fn, Decl(a.js, 0, 0)) +>exports : Symbol("a", Decl(a.js, 0, 0)) module.exports = fn; ->module.exports : Symbol(fn, Decl(a.js, 0, 0)) +>module.exports : Symbol("a", Decl(a.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(fn, Decl(a.js, 0, 0)) +>exports : Symbol("a", Decl(a.js, 0, 0)) >fn : Symbol(fn, Decl(a.js, 0, 0)) } diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff index 542b1b3da3..4d8b70ffb9 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff @@ -8,17 +8,17 @@ ->module.exports : Symbol(module.exports, Decl(a.js, 0, 0)) ->module : Symbol(module, Decl(a.js, 2, 51)) ->exports : Symbol(module.exports, Decl(a.js, 0, 0)) -+>module.exports : Symbol(fn, Decl(a.js, 0, 0)) ++>module.exports : Symbol("a", Decl(a.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(fn, Decl(a.js, 0, 0)) ++>exports : Symbol("a", Decl(a.js, 0, 0)) module.exports = fn; ->module.exports : Symbol(module.exports, Decl(a.js, 0, 0)) ->module : Symbol(export=, Decl(a.js, 2, 51)) ->exports : Symbol(export=, Decl(a.js, 2, 51)) -+>module.exports : Symbol(fn, Decl(a.js, 0, 0)) ++>module.exports : Symbol("a", Decl(a.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(fn, Decl(a.js, 0, 0)) ++>exports : Symbol("a", Decl(a.js, 0, 0)) >fn : Symbol(fn, Decl(a.js, 0, 0)) } diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types index 86ae1b1225..e2dedf89c0 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types @@ -5,20 +5,20 @@ function fn() {} >fn : () => void if (typeof module === 'object' && module.exports) { ->typeof module === 'object' && module.exports : false | (() => void) +>typeof module === 'object' && module.exports : false | (typeof import("a")) >typeof module === 'object' : boolean >typeof module : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >module : any >'object' : "object" ->module.exports : () => void ->module : { fn: () => void; } ->exports : () => void +>module.exports : typeof import("a") +>module : { "a": typeof import("a"); } +>exports : typeof import("a") module.exports = fn; >module.exports = fn : () => void ->module.exports : () => void ->module : { fn: () => void; } ->exports : () => void +>module.exports : typeof import("a") +>module : { "a": typeof import("a"); } +>exports : typeof import("a") >fn : () => void } diff --git a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols index cf0725a551..f82dd5c264 100644 --- a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols @@ -10,8 +10,8 @@ var loop2 = loop1; >loop1 : Symbol(loop1, Decl(loop.js, 0, 3)) module.exports = loop2; ->module.exports : Symbol(loop2, Decl(loop.js, 1, 3)) +>module.exports : Symbol("loop", Decl(loop.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(loop2, Decl(loop.js, 1, 3)) +>exports : Symbol("loop", Decl(loop.js, 0, 0)) >loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff index 9c22a5dc9c..ae419993e3 100644 --- a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff @@ -7,8 +7,8 @@ ->module.exports : Symbol(module.exports, Decl(loop.js, 0, 0)) ->module : Symbol(export=, Decl(loop.js, 1, 18)) ->exports : Symbol(export=, Decl(loop.js, 1, 18)) -+>module.exports : Symbol(loop2, Decl(loop.js, 1, 3)) ++>module.exports : Symbol("loop", Decl(loop.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(loop2, Decl(loop.js, 1, 3)) ++>exports : Symbol("loop", Decl(loop.js, 0, 0)) >loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types index 6724f06fcc..da2b055d30 100644 --- a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types @@ -11,8 +11,8 @@ var loop2 = loop1; module.exports = loop2; >module.exports = loop2 : any ->module.exports : any ->module : { loop2: any; } ->exports : any +>module.exports : typeof import("loop") +>module : { "loop": typeof import("loop"); } +>exports : typeof import("loop") >loop2 : any diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt index d1c4231be8..713849341c 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt @@ -1,4 +1,4 @@ -use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. +use.js(1,30): error TS2694: Namespace '"mod1"' has no exported member 'Con'. ==== mod1.js (0 errors) ==== @@ -14,7 +14,7 @@ use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. ==== use.js (1 errors) ==== /** @param {import('./mod1').Con} k */ ~~~ -!!! error TS2694: Namespace 'C' has no exported member 'Con'. +!!! error TS2694: Namespace '"mod1"' has no exported member 'Con'. function f(k) { if (1 === 2 - 1) { // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols index a3c308ae21..8d90284925 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols @@ -6,9 +6,9 @@ * @return {any} I don't even know what this should return */ module.exports = C ->module.exports : Symbol(C, Decl(mod1.js, 4, 18)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(C, Decl(mod1.js, 4, 18)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff index d6547a6d1a..c84101f5c5 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) ->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -+>module.exports : Symbol(C, Decl(mod1.js, 4, 18)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(C, Decl(mod1.js, 4, 18)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types index f014c62629..d4bb49b1c0 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types @@ -7,9 +7,9 @@ */ module.exports = C >module.exports = C : () => void ->module.exports : () => void ->module : { C: () => void; } ->exports : () => void +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") >C : () => void function C() { diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols index 6b6cc08719..43164254e4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols @@ -130,8 +130,8 @@ Object.defineProperty(Person.prototype, "setonlyAccessor", { } }); module.exports = Person; ->module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >Person : Symbol(Person, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff index a09b927c21..808712ef45 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff @@ -185,8 +185,8 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 19, 3)) ->exports : Symbol(export=, Decl(mod1.js, 19, 3)) -+>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Person, Decl(mod1.js, 0, 0)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >Person : Symbol(Person, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types index 3fe63091c2..8b3afda6de 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types @@ -4,12 +4,12 @@ import "./"; import Person = require("./mod1"); ->Person : (name: string) => void +>Person : typeof import("mod1") const m1 = new Person("Name") >m1 : any >new Person("Name") : any ->Person : (name: string) => void +>Person : typeof import("mod1") >"Name" : "Name" m1.thing; @@ -215,8 +215,8 @@ Object.defineProperty(Person.prototype, "setonlyAccessor", { }); module.exports = Person; >module.exports = Person : (name: string) => void ->module.exports : (name: string) => void ->module : { Person: (name: string) => void; } ->exports : (name: string) => void +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") >Person : (name: string) => void diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt index 26d070eca5..f8d0962ba5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt @@ -1,19 +1,19 @@ index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. -validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. -validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. -validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. -validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. -validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. -validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. -validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. -validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. -validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. -validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. -validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. -validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. -validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. +validate.ts(3,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. +validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. +validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. +validate.ts(6,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. +validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. +validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. +validate.ts(10,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. +validate.ts(11,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. +validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. +validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. +validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. +validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. +validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. ==== validate.ts (13 errors) ==== @@ -21,45 +21,45 @@ validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{ import x = require("./"); x.name; ~~~~ -!!! error TS2339: Property 'name' does not exist on type '{}'. +!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. x.middleInit; ~~~~~~~~~~ -!!! error TS2339: Property 'middleInit' does not exist on type '{}'. +!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. x.lastName; ~~~~~~~~ -!!! error TS2339: Property 'lastName' does not exist on type '{}'. +!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. x.zip; ~~~ -!!! error TS2339: Property 'zip' does not exist on type '{}'. +!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. x.houseNumber; ~~~~~~~~~~~ -!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. +!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. x.zipStr; ~~~~~~ -!!! error TS2339: Property 'zipStr' does not exist on type '{}'. +!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. x.name = "Another"; ~~~~ -!!! error TS2339: Property 'name' does not exist on type '{}'. +!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. x.zip = 98123; ~~~ -!!! error TS2339: Property 'zip' does not exist on type '{}'. +!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. x.zipStr = "OK"; ~~~~~~ -!!! error TS2339: Property 'zipStr' does not exist on type '{}'. +!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. x.lastName = "should fail"; ~~~~~~~~ -!!! error TS2339: Property 'lastName' does not exist on type '{}'. +!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. x.houseNumber = 12; // should also fail ~~~~~~~~~~~ -!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. +!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. x.zipStr = 12; // should fail ~~~~~~ -!!! error TS2339: Property 'zipStr' does not exist on type '{}'. +!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. x.middleInit = "R"; // should also fail ~~~~~~~~~~ -!!! error TS2339: Property 'middleInit' does not exist on type '{}'. +!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. ==== index.js (3 errors) ==== const x = {}; diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols index fb8fb1c8c0..03df866de0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols @@ -161,8 +161,8 @@ match(() => expected, (x = expected) => void 0); >expected : Symbol(expected, Decl(index.js, 32, 5)) module.exports = x; ->module.exports : Symbol(x, Decl(index.js, 0, 5)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(x, Decl(index.js, 0, 5)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >x : Symbol(x, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff index 58073b8baa..e9fa2dc18b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff @@ -200,8 +200,8 @@ ->module : Symbol(export=, Decl(index.js, 41, 48)) ->exports : Symbol(export=, Decl(index.js, 41, 48)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -+>module.exports : Symbol(x, Decl(index.js, 0, 5)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(x, Decl(index.js, 0, 5)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) +>x : Symbol(x, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types index 7a23ea5f67..a2c56f08ac 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types @@ -3,84 +3,84 @@ === validate.ts === // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); ->x : {} +>x : typeof import("index") x.name; >x.name : any ->x : {} +>x : typeof import("index") >name : any x.middleInit; >x.middleInit : any ->x : {} +>x : typeof import("index") >middleInit : any x.lastName; >x.lastName : any ->x : {} +>x : typeof import("index") >lastName : any x.zip; >x.zip : any ->x : {} +>x : typeof import("index") >zip : any x.houseNumber; >x.houseNumber : any ->x : {} +>x : typeof import("index") >houseNumber : any x.zipStr; >x.zipStr : any ->x : {} +>x : typeof import("index") >zipStr : any x.name = "Another"; >x.name = "Another" : "Another" >x.name : any ->x : {} +>x : typeof import("index") >name : any >"Another" : "Another" x.zip = 98123; >x.zip = 98123 : 98123 >x.zip : any ->x : {} +>x : typeof import("index") >zip : any >98123 : 98123 x.zipStr = "OK"; >x.zipStr = "OK" : "OK" >x.zipStr : any ->x : {} +>x : typeof import("index") >zipStr : any >"OK" : "OK" x.lastName = "should fail"; >x.lastName = "should fail" : "should fail" >x.lastName : any ->x : {} +>x : typeof import("index") >lastName : any >"should fail" : "should fail" x.houseNumber = 12; // should also fail >x.houseNumber = 12 : 12 >x.houseNumber : any ->x : {} +>x : typeof import("index") >houseNumber : any >12 : 12 x.zipStr = 12; // should fail >x.zipStr = 12 : 12 >x.zipStr : any ->x : {} +>x : typeof import("index") >zipStr : any >12 : 12 x.middleInit = "R"; // should also fail >x.middleInit = "R" : "R" >x.middleInit : any ->x : {} +>x : typeof import("index") >middleInit : any >"R" : "R" @@ -251,8 +251,8 @@ match(() => expected, (x = expected) => void 0); module.exports = x; >module.exports = x : {} ->module.exports : {} ->module : { readonly x: {}; } ->exports : {} +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >x : {} diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types index 7c31947da1..c2642ed445 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: K) => void ->k : K +>f : (k: any) => void +>k : any k.values() >k.values() : any >k.values : any ->k : K +>k : any >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types index 00dcff55ca..287d076177 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: K) => void ->k : K +>f : (k: any) => void +>k : any k.values() >k.values() : any >k.values : any ->k : K +>k : any >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types index 417be9ccc8..fe24af79d4 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: K) => void ->k : K +>f : (k: any) => void +>k : any k.values() >k.values() : any >k.values : any ->k : K +>k : any >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols index 6f2ed5343e..ecd9a4be5d 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols @@ -42,8 +42,8 @@ function A() { this.id = 1; } >A : Symbol(A, Decl(other.js, 0, 0)) module.exports = A; ->module.exports : Symbol(A, Decl(other.js, 0, 0)) +>module.exports : Symbol("other", Decl(other.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(A, Decl(other.js, 0, 0)) +>exports : Symbol("other", Decl(other.js, 0, 0)) >A : Symbol(A, Decl(other.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff index 6784d0c9f5..c4e63fdf41 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff @@ -50,8 +50,8 @@ ->module.exports : Symbol(module.exports, Decl(other.js, 0, 0)) ->module : Symbol(export=, Decl(other.js, 0, 29)) ->exports : Symbol(export=, Decl(other.js, 0, 29)) -+>module.exports : Symbol(A, Decl(other.js, 0, 0)) ++>module.exports : Symbol("other", Decl(other.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(A, Decl(other.js, 0, 0)) ++>exports : Symbol("other", Decl(other.js, 0, 0)) >A : Symbol(A, Decl(other.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types index f513861801..734def5f5c 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types @@ -11,8 +11,8 @@ declare var module: any, exports: any; === index.js === const A = require("./other"); ->A : () => void ->require("./other") : () => void +>A : typeof import("other") +>require("./other") : typeof import("other") >require : (id: string) => any >"./other" : "./other" @@ -20,7 +20,7 @@ const a = new A().id; >a : any >new A().id : any >new A() : any ->A : () => void +>A : typeof import("other") >id : any const B = function() { this.id = 1; } @@ -72,8 +72,8 @@ function A() { this.id = 1; } module.exports = A; >module.exports = A : () => void ->module.exports : () => void ->module : { A: () => void; } ->exports : () => void +>module.exports : typeof import("other") +>module : { "other": typeof import("other"); } +>exports : typeof import("other") >A : () => void diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.types b/testdata/baselines/reference/submodule/conformance/enumTagImported.types index a7e576e4d9..c64b14e80a 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTagImported.types +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.types @@ -18,7 +18,7 @@ import { TestEnum } from "./mod1" /** @type {TestEnum} */ const tist = TestEnum.ADD ->tist : TestEnum +>tist : any >TestEnum.ADD : string >TestEnum : { ADD: string; REMOVE: string; } >ADD : string diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt deleted file mode 100644 index 28338d4764..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -main.ts(2,52): error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. - - -==== main.ts (1 errors) ==== - import * as intermediate from './intermediate' - const ghost: intermediate.Ghost = new intermediate.Ghost() - ~~~~~ -!!! error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. - -==== intermediate.ts (0 errors) ==== - export type * from './ghost' - -==== ghost.ts (0 errors) ==== - export class Ghost {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff new file mode 100644 index 0000000000..bfaa4ba1ad --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff @@ -0,0 +1,19 @@ +--- old.exportNamespace11.errors.txt ++++ new.exportNamespace11.errors.txt +@@= skipped -0, +-1 lines =@@ +-main.ts(2,52): error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. +- +- +-==== main.ts (1 errors) ==== +- import * as intermediate from './intermediate' +- const ghost: intermediate.Ghost = new intermediate.Ghost() +- ~~~~~ +-!!! error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. +- +-==== intermediate.ts (0 errors) ==== +- export type * from './ghost' +- +-==== ghost.ts (0 errors) ==== +- export class Ghost {} +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols index c5a74a5c0c..1e517ecca1 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols @@ -8,7 +8,9 @@ const ghost: intermediate.Ghost = new intermediate.Ghost() >ghost : Symbol(ghost, Decl(main.ts, 1, 5)) >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) >Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) +>intermediate.Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) +>Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) === intermediate.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff index 6d5f34034e..3bb741b2e3 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff @@ -6,6 +6,9 @@ >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) ->Ghost : Symbol(intermediate.Ghost, Decl(ghost.ts, 0, 0)) +>Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) ++>intermediate.Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) ++>Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) === intermediate.ts === + diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types index 25914ac276..8314e8ca64 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types @@ -7,10 +7,10 @@ import * as intermediate from './intermediate' const ghost: intermediate.Ghost = new intermediate.Ghost() >ghost : Ghost >intermediate : any ->new intermediate.Ghost() : any ->intermediate.Ghost : any +>new intermediate.Ghost() : Ghost +>intermediate.Ghost : typeof Ghost >intermediate : typeof import("intermediate") ->Ghost : any +>Ghost : typeof Ghost === intermediate.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff index 9e6e09dcc3..33d9f0dd01 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff @@ -11,10 +11,14 @@ ->ghost : intermediate.Ghost +>ghost : Ghost >intermediate : any - >new intermediate.Ghost() : any - >intermediate.Ghost : any +->new intermediate.Ghost() : any +->intermediate.Ghost : any ->intermediate : typeof intermediate +->Ghost : any ++>new intermediate.Ghost() : Ghost ++>intermediate.Ghost : typeof Ghost +>intermediate : typeof import("intermediate") - >Ghost : any ++>Ghost : typeof Ghost === intermediate.ts === + diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt deleted file mode 100644 index 885f1e3acb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -main.ts(3,13): error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. -main.ts(4,19): error TS2339: Property 'c' does not exist on type 'typeof import("types")'. - - -==== main.ts (2 errors) ==== - import { c } from './types' - import * as types from './types' - console.log(c) // Fails as expected, import is still allowed though. - ~ -!!! error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 types.ts:1:1: 'c' was exported here. - console.log(types.c) // Expected an error here. - ~ -!!! error TS2339: Property 'c' does not exist on type 'typeof import("types")'. - -==== types.ts (0 errors) ==== - export type * from './values' - -==== values.ts (0 errors) ==== - export const c = 10 \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff new file mode 100644 index 0000000000..968bd57750 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff @@ -0,0 +1,25 @@ +--- old.exportNamespace12.errors.txt ++++ new.exportNamespace12.errors.txt +@@= skipped -0, +-1 lines =@@ +-main.ts(3,13): error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. +-main.ts(4,19): error TS2339: Property 'c' does not exist on type 'typeof import("types")'. +- +- +-==== main.ts (2 errors) ==== +- import { c } from './types' +- import * as types from './types' +- console.log(c) // Fails as expected, import is still allowed though. +- ~ +-!!! error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 types.ts:1:1: 'c' was exported here. +- console.log(types.c) // Expected an error here. +- ~ +-!!! error TS2339: Property 'c' does not exist on type 'typeof import("types")'. +- +-==== types.ts (0 errors) ==== +- export type * from './values' +- +-==== values.ts (0 errors) ==== +- export const c = 10 +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js index 3b60d6bde4..a8aff59270 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js @@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); const types = require("./types"); -console.log(c); // Fails as expected, import is still allowed though. +console.log(types_1.c); // Fails as expected, import is still allowed though. console.log(types.c); // Expected an error here. diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff index 0894e55c79..d74a7ebfd4 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff @@ -5,6 +5,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var types = require("./types"); +-console.log(c); // Fails as expected, import is still allowed though. ++const types_1 = require("./types"); +const types = require("./types"); - console.log(c); // Fails as expected, import is still allowed though. ++console.log(types_1.c); // Fails as expected, import is still allowed though. console.log(types.c); // Expected an error here. diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols index f77f7b2336..c096ce0089 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols @@ -17,7 +17,9 @@ console.log(types.c) // Expected an error here. >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) +>types.c : Symbol(c, Decl(values.ts, 0, 12)) >types : Symbol(types, Decl(main.ts, 1, 6)) +>c : Symbol(c, Decl(values.ts, 0, 12)) === types.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff index 157acc1c26..7f65586976 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff @@ -17,6 +17,9 @@ >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) ++>types.c : Symbol(c, Decl(values.ts, 0, 12)) >types : Symbol(types, Decl(main.ts, 1, 6)) ++>c : Symbol(c, Decl(values.ts, 0, 12)) === types.ts === + diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types index 1c1e76275d..086a2782cc 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types @@ -19,9 +19,9 @@ console.log(types.c) // Expected an error here. >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->types.c : any +>types.c : 10 >types : typeof import("types") ->c : any +>c : 10 === types.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff index 01af2c2941..6ab7e84f99 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff @@ -9,12 +9,16 @@ console.log(c) // Fails as expected, import is still allowed though. >console.log(c) : void -@@= skipped -15, +15 lines =@@ +@@= skipped -14, +14 lines =@@ + >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void - >types.c : any +->types.c : any ->types : typeof types +->c : any ++>types.c : 10 +>types : typeof import("types") - >c : any ++>c : 10 === types.ts === + diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt index 2b1270b838..1a827be564 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt @@ -1,4 +1,3 @@ -d.ts(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. e.ts(2,1): error TS1362: 'ns' cannot be used as a value because it was exported using 'export type'. @@ -11,12 +10,9 @@ e.ts(2,1): error TS1362: 'ns' cannot be used as a value because it was exported ==== c.ts (0 errors) ==== export type * as ns from './a'; -==== d.ts (1 errors) ==== +==== d.ts (0 errors) ==== import { A } from './b'; A; - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 b.ts:1:1: 'A' was exported here. ==== e.ts (1 errors) ==== import { ns } from './c'; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff new file mode 100644 index 0000000000..0946df3e23 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff @@ -0,0 +1,21 @@ +--- old.exportNamespace4.errors.txt ++++ new.exportNamespace4.errors.txt +@@= skipped -0, +0 lines =@@ +-d.ts(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. + e.ts(2,1): error TS1362: 'ns' cannot be used as a value because it was exported using 'export type'. + + +@@= skipped -10, +9 lines =@@ + ==== c.ts (0 errors) ==== + export type * as ns from './a'; + +-==== d.ts (1 errors) ==== ++==== d.ts (0 errors) ==== + import { A } from './b'; + A; +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 b.ts:1:1: 'A' was exported here. + + ==== e.ts (1 errors) ==== + import { ns } from './c'; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js index 14a8fe977b..297b00294b 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js @@ -34,7 +34,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [d.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -A; +const b_1 = require("./b"); +b_1.A; //// [e.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff index 7d65ea430e..663cfe808c 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff @@ -14,7 +14,14 @@ exports.A = A; //// [b.js] "use strict"; -@@= skipped -20, +17 lines =@@ +@@= skipped -15, +12 lines =@@ + //// [d.js] + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-A; ++const b_1 = require("./b"); ++b_1.A; + //// [e.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); ns.A; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt deleted file mode 100644 index d94580faee..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -/c.ts(3,17): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. - - -==== /a.ts (0 errors) ==== - export class A {} - export class B {} - export class X {} - -==== /b.ts (0 errors) ==== - export type * from "./a"; - export { X } from "./a"; - -==== /c.ts (2 errors) ==== - import { A, B as C, X } from "./b"; - let _: A = new A(); // Error - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /b.ts:1:1: 'A' was exported here. - let __: C = new C(); // Error - ~ -!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /b.ts:1:1: 'C' was exported here. - let ___: X = new X(); // Ok - -==== /d.ts (0 errors) ==== - export type * from "./a"; - export * from "./a"; - -==== /e.ts (0 errors) ==== - import { A, B, X } from "./d"; - let _: A = new A(); // Ok - let __: B = new B(); // Ok - let ___: X = new X(); // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff new file mode 100644 index 0000000000..7e8bed63f3 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff @@ -0,0 +1,39 @@ +--- old.exportNamespace5.errors.txt ++++ new.exportNamespace5.errors.txt +@@= skipped -0, +-1 lines =@@ +-/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-/c.ts(3,17): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. +- +- +-==== /a.ts (0 errors) ==== +- export class A {} +- export class B {} +- export class X {} +- +-==== /b.ts (0 errors) ==== +- export type * from "./a"; +- export { X } from "./a"; +- +-==== /c.ts (2 errors) ==== +- import { A, B as C, X } from "./b"; +- let _: A = new A(); // Error +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /b.ts:1:1: 'A' was exported here. +- let __: C = new C(); // Error +- ~ +-!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /b.ts:1:1: 'C' was exported here. +- let ___: X = new X(); // Ok +- +-==== /d.ts (0 errors) ==== +- export type * from "./a"; +- export * from "./a"; +- +-==== /e.ts (0 errors) ==== +- import { A, B, X } from "./d"; +- let _: A = new A(); // Ok +- let __: B = new B(); // Ok +- let ___: X = new X(); // Ok +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js index ae43edb08d..4388ba5d35 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js @@ -48,8 +48,8 @@ Object.defineProperty(exports, "X", { enumerable: true, get: function () { retur "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const b_1 = require("./b"); -let _ = new A(); // Error -let __ = new C(); // Error +let _ = new b_1.A(); // Error +let __ = new b_1.B(); // Error let ___ = new b_1.X(); // Ok //// [d.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff index 5dc65f7e77..64b4bda13c 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff @@ -43,8 +43,8 @@ -var __ = new C(); // Error -var ___ = new b_1.X(); // Ok +const b_1 = require("./b"); -+let _ = new A(); // Error -+let __ = new C(); // Error ++let _ = new b_1.A(); // Error ++let __ = new b_1.B(); // Error +let ___ = new b_1.X(); // Ok //// [d.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt deleted file mode 100644 index b639df1663..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -/d.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. - - -==== /a.ts (0 errors) ==== - export class A {} - export class B {} - -==== /b.ts (0 errors) ==== - export type * from "./a"; - -==== /c.ts (0 errors) ==== - export * from "./b"; - -==== /d.ts (2 errors) ==== - import { A, B } from "./c"; - let _: A = new A(); // Error - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /b.ts:1:1: 'A' was exported here. - let __: B = new B(); // Error - ~ -!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /b.ts:1:1: 'B' was exported here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff new file mode 100644 index 0000000000..cf7b8c80c2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff @@ -0,0 +1,29 @@ +--- old.exportNamespace6.errors.txt ++++ new.exportNamespace6.errors.txt +@@= skipped -0, +-1 lines =@@ +-/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-/d.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +- +- +-==== /a.ts (0 errors) ==== +- export class A {} +- export class B {} +- +-==== /b.ts (0 errors) ==== +- export type * from "./a"; +- +-==== /c.ts (0 errors) ==== +- export * from "./b"; +- +-==== /d.ts (2 errors) ==== +- import { A, B } from "./c"; +- let _: A = new A(); // Error +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /b.ts:1:1: 'A' was exported here. +- let __: B = new B(); // Error +- ~ +-!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /b.ts:1:1: 'B' was exported here. +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js index 36cd8e08a9..8ef15e73ed 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js @@ -49,5 +49,6 @@ __exportStar(require("./b"), exports); //// [d.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let _ = new A(); // Error -let __ = new B(); // Error +const c_1 = require("./c"); +let _ = new c_1.A(); // Error +let __ = new c_1.B(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff index bcf69c391d..35d58c4382 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff @@ -28,5 +28,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ = new A(); // Error -var __ = new B(); // Error -+let _ = new A(); // Error -+let __ = new B(); // Error ++const c_1 = require("./c"); ++let _ = new c_1.A(); // Error ++let __ = new c_1.B(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt deleted file mode 100644 index c713c7ec4e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -/c.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. -/e.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -/e.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. -/e.ts(4,18): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. - - -==== /a.ts (0 errors) ==== - export class A {} - export class B {} - export class C {} - -==== /b.ts (0 errors) ==== - export type * from "./a"; - export class C {} - -==== /c.ts (2 errors) ==== - import { A, B, C } from "./b"; - let _: A = new A(); // Error - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /b.ts:1:1: 'A' was exported here. - let __: B = new B(); // Error - ~ -!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /b.ts:1:1: 'B' was exported here. - let ___: C = new C(); // Ok - -==== /d.ts (0 errors) ==== - export type * from "./b"; - -==== /e.ts (3 errors) ==== - import { A, B, C } from "./d"; - let _: A = new A(); // Error - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /d.ts:1:1: 'A' was exported here. - let __: B = new B(); // Error - ~ -!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /d.ts:1:1: 'B' was exported here. - let ___: C = new C(); // Error - ~ -!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /d.ts:1:1: 'C' was exported here. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff new file mode 100644 index 0000000000..9e0b8f8d28 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff @@ -0,0 +1,51 @@ +--- old.exportNamespace7.errors.txt ++++ new.exportNamespace7.errors.txt +@@= skipped -0, +-1 lines =@@ +-/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-/c.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +-/e.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-/e.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +-/e.ts(4,18): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. +- +- +-==== /a.ts (0 errors) ==== +- export class A {} +- export class B {} +- export class C {} +- +-==== /b.ts (0 errors) ==== +- export type * from "./a"; +- export class C {} +- +-==== /c.ts (2 errors) ==== +- import { A, B, C } from "./b"; +- let _: A = new A(); // Error +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /b.ts:1:1: 'A' was exported here. +- let __: B = new B(); // Error +- ~ +-!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /b.ts:1:1: 'B' was exported here. +- let ___: C = new C(); // Ok +- +-==== /d.ts (0 errors) ==== +- export type * from "./b"; +- +-==== /e.ts (3 errors) ==== +- import { A, B, C } from "./d"; +- let _: A = new A(); // Error +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /d.ts:1:1: 'A' was exported here. +- let __: B = new B(); // Error +- ~ +-!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /d.ts:1:1: 'B' was exported here. +- let ___: C = new C(); // Error +- ~ +-!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /d.ts:1:1: 'C' was exported here. +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js index faea07cd5d..0e0702c2a9 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js @@ -49,8 +49,8 @@ exports.C = C; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const b_1 = require("./b"); -let _ = new A(); // Error -let __ = new B(); // Error +let _ = new b_1.A(); // Error +let __ = new b_1.B(); // Error let ___ = new b_1.C(); // Ok //// [d.js] "use strict"; @@ -58,6 +58,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [e.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -let _ = new A(); // Error -let __ = new B(); // Error -let ___ = new C(); // Error +const d_1 = require("./d"); +let _ = new d_1.A(); // Error +let __ = new d_1.B(); // Error +let ___ = new d_1.C(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff index f925079c86..f3d5613cfc 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff @@ -48,8 +48,8 @@ -var __ = new B(); // Error -var ___ = new b_1.C(); // Ok +const b_1 = require("./b"); -+let _ = new A(); // Error -+let __ = new B(); // Error ++let _ = new b_1.A(); // Error ++let __ = new b_1.B(); // Error +let ___ = new b_1.C(); // Ok //// [d.js] "use strict"; @@ -60,6 +60,7 @@ -var _ = new A(); // Error -var __ = new B(); // Error -var ___ = new C(); // Error -+let _ = new A(); // Error -+let __ = new B(); // Error -+let ___ = new C(); // Error ++const d_1 = require("./d"); ++let _ = new d_1.A(); // Error ++let __ = new d_1.B(); // Error ++let ___ = new d_1.C(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt index 8ee301e187..905173619f 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt @@ -1,5 +1,4 @@ /c.ts(2,1): error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. -/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. ==== /a.ts (0 errors) ==== @@ -16,12 +15,9 @@ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. -==== /d.ts (1 errors) ==== +==== /d.ts (0 errors) ==== import { A, B, C } from "./c"; let _: A = new A(); // Error - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 /c.ts:1:1: 'A' was exported here. let __: B = new B(); // Ok let ___: C = new C(); // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff new file mode 100644 index 0000000000..3c0842309b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff @@ -0,0 +1,22 @@ +--- old.exportNamespace8.errors.txt ++++ new.exportNamespace8.errors.txt +@@= skipped -0, +0 lines =@@ + /c.ts(2,1): error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. +-/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. + + + ==== /a.ts (0 errors) ==== +@@= skipped -15, +14 lines =@@ + ~~~~~~~~~~~~~~~~~~~~ + !!! error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. + +-==== /d.ts (1 errors) ==== ++==== /d.ts (0 errors) ==== + import { A, B, C } from "./c"; + let _: A = new A(); // Error +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 /c.ts:1:1: 'A' was exported here. + let __: B = new B(); // Ok + let ___: C = new C(); // Ok + diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js index 188abb9396..b45eb4da50 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js @@ -61,6 +61,6 @@ __exportStar(require("./b"), exports); // Collision error "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const c_1 = require("./c"); -let _ = new A(); // Error +let _ = new c_1.A(); // Error let __ = new c_1.B(); // Ok let ___ = new c_1.C(); // Ok diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff index 00e09e3f48..c685d2885d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff @@ -51,6 +51,6 @@ -var __ = new c_1.B(); // Ok -var ___ = new c_1.C(); // Ok +const c_1 = require("./c"); -+let _ = new A(); // Error ++let _ = new c_1.A(); // Error +let __ = new c_1.B(); // Ok +let ___ = new c_1.C(); // Ok diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt deleted file mode 100644 index bea8c5ca84..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -c.js(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. - - -==== a.js (0 errors) ==== - export class A {} - -==== b.js (0 errors) ==== - export type * from './a'; - -==== c.js (1 errors) ==== - import { A } from './b'; - A; - ~ -!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -!!! related TS1377 b.js:1:1: 'A' was exported here. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types index ac3b962eb8..0ae87c6ec9 100644 --- a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types +++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types @@ -24,7 +24,7 @@ import MyEnum from "./def"; /** @type {MyEnum} */ const v = MyEnum.b; ->v : MyEnum +>v : any >MyEnum.b : number >MyEnum : { a: number; b: number; } >b : number diff --git a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols index 304a0ff5e1..998ef14bdb 100644 --- a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols +++ b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols @@ -8,9 +8,9 @@ class Alias { >bar : Symbol(bar, Decl(mod1.js, 0, 13)) } module.exports = Alias; ->module.exports : Symbol(Alias, Decl(mod1.js, 0, 0)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Alias, Decl(mod1.js, 0, 0)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >Alias : Symbol(Alias, Decl(mod1.js, 0, 0)) === main.js === diff --git a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff index 0a7bebfb48..9da468d200 100644 --- a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff @@ -11,9 +11,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 2, 1)) ->exports : Symbol(export=, Decl(mod1.js, 2, 1)) -+>module.exports : Symbol(Alias, Decl(mod1.js, 0, 0)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Alias, Decl(mod1.js, 0, 0)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >Alias : Symbol(Alias, Decl(mod1.js, 0, 0)) === main.js === diff --git a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types index 35aaf499c6..7f13c9f5df 100644 --- a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types +++ b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types @@ -10,20 +10,20 @@ class Alias { } module.exports = Alias; >module.exports = Alias : typeof Alias ->module.exports : typeof Alias ->module : { Alias: typeof Alias; } ->exports : typeof Alias +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") >Alias : typeof Alias === main.js === import A from './mod1' ->A : typeof Alias +>A : typeof import("mod1") A.prototype.foo = 0 >A.prototype.foo = 0 : 0 >A.prototype.foo : any >A.prototype : Alias ->A : typeof Alias +>A : typeof import("mod1") >prototype : Alias >foo : any >0 : 0 @@ -32,7 +32,7 @@ A.prototype.func = function() { this._func = 0; } >A.prototype.func = function() { this._func = 0; } : () => void >A.prototype.func : any >A.prototype : Alias ->A : typeof Alias +>A : typeof import("mod1") >prototype : Alias >func : any >function() { this._func = 0; } : () => void @@ -48,7 +48,7 @@ Object.defineProperty(A.prototype, "def", { value: 0 }); >Object : ObjectConstructor >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >A.prototype : Alias ->A : typeof Alias +>A : typeof import("mod1") >prototype : Alias >"def" : "def" >{ value: 0 } : { value: number; } @@ -58,25 +58,25 @@ Object.defineProperty(A.prototype, "def", { value: 0 }); new A().bar >new A().bar : () => number >new A() : Alias ->A : typeof Alias +>A : typeof import("mod1") >bar : () => number new A().foo >new A().foo : any >new A() : Alias ->A : typeof Alias +>A : typeof import("mod1") >foo : any new A().func() >new A().func() : any >new A().func : any >new A() : Alias ->A : typeof Alias +>A : typeof import("mod1") >func : any new A().def >new A().def : any >new A() : Alias ->A : typeof Alias +>A : typeof import("mod1") >def : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt index cbb4b6d57d..c0a51caec6 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(7,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. -==== cls.js (2 errors) ==== +==== cls.js (1 errors) ==== const Bar = require("./bar"); const Strings = { a: "A", @@ -10,11 +9,10 @@ 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. + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. +!!! related TS2728 cls.js:8:1: 'Strings' is declared here. module.exports.Strings = Strings; - ~~~~~~~ -!!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. ==== bar.js (0 errors) ==== class Bar {} module.exports = Bar; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols index bd1cc110ec..e533cb0973 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols @@ -21,15 +21,17 @@ class Foo extends Bar {} >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) module.exports = Foo; ->module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 4, 2)) module.exports.Strings = Strings; ->module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>module.exports.Strings : Symbol(Strings, Decl(cls.js, 6, 21)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) +>Strings : Symbol(Strings, Decl(cls.js, 6, 21)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) === bar.js === @@ -37,8 +39,8 @@ class Bar {} >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>module.exports : Symbol("bar", Decl(bar.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>exports : Symbol("bar", Decl(bar.js, 0, 0)) >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff index e18c727ca3..a47869272f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff @@ -7,32 +7,31 @@ ->module.exports : Symbol(module.exports, Decl(cls.js, 0, 0)) ->module : Symbol(export=, Decl(cls.js, 5, 24)) ->exports : Symbol(export=, Decl(cls.js, 5, 24)) -+>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Foo, Decl(cls.js, 4, 2)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 4, 2)) module.exports.Strings = Strings; -->module.exports.Strings : Symbol(Strings, Decl(cls.js, 6, 21)) + >module.exports.Strings : Symbol(Strings, Decl(cls.js, 6, 21)) ->module.exports : Symbol(Strings, Decl(cls.js, 6, 21)) ->module : Symbol(module, Decl(cls.js, 5, 24)) ->exports : Symbol(module.exports, Decl(cls.js, 0, 0)) -->Strings : Symbol(Strings, Decl(cls.js, 6, 21)) -+>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Foo, Decl(cls.js, 4, 2)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) + >Strings : Symbol(Strings, Decl(cls.js, 6, 21)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) - === bar.js === -@@= skipped -18, +16 lines =@@ +@@= skipped -18, +18 lines =@@ >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol(module.exports, Decl(bar.js, 0, 0)) ->module : Symbol(export=, Decl(bar.js, 0, 12)) ->exports : Symbol(export=, Decl(bar.js, 0, 12)) -+>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) ++>module.exports : Symbol("bar", Decl(bar.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Bar, Decl(bar.js, 0, 0)) ++>exports : Symbol("bar", Decl(bar.js, 0, 0)) >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types index d2474b76c9..ce0c764652 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types @@ -2,8 +2,8 @@ === cls.js === const Bar = require("./bar"); ->Bar : typeof Bar ->require("./bar") : typeof Bar +>Bar : typeof import("bar") +>require("./bar") : typeof import("bar") >require : any >"./bar" : "./bar" @@ -26,18 +26,18 @@ class Foo extends Bar {} module.exports = Foo; >module.exports = Foo : typeof Foo ->module.exports : typeof Foo ->module : { Foo: typeof Foo; } ->exports : typeof Foo +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } ->module.exports.Strings : any ->module.exports : typeof Foo ->module : { Foo: typeof Foo; } ->exports : typeof Foo ->Strings : any +>module.exports.Strings : { a: string; b: string; } +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } === bar.js === @@ -46,8 +46,8 @@ class Bar {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof Bar ->module : { Bar: typeof Bar; } ->exports : typeof Bar +>module.exports : typeof import("bar") +>module : { "bar": typeof import("bar"); } +>exports : typeof import("bar") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt index ca8208ac52..624c41ba68 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt @@ -1,9 +1,8 @@ source.js(9,9): error TS2339: Property 'statische' does not exist on type 'typeof Handler'. -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(15,1): error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. -==== source.js (3 errors) ==== +==== source.js (2 errors) ==== class Handler { static get OPTIONS() { return 1; @@ -21,11 +20,10 @@ 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. + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. +!!! related TS2728 source.js:16:1: 'Strings' is declared here. module.exports.Strings = Strings - ~~~~~~~ -!!! error TS2339: Property 'Strings' does not exist on type 'typeof Handler'. /** * @typedef {Object} HandlerOptions diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols index 899a405f27..d7fb25e9b6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols @@ -28,15 +28,17 @@ const Strings = { } module.exports = Handler; ->module.exports : Symbol(Handler, Decl(source.js, 0, 0)) +>module.exports : Symbol("source", Decl(source.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Handler, Decl(source.js, 0, 0)) +>exports : Symbol("source", Decl(source.js, 0, 0)) >Handler : Symbol(Handler, Decl(source.js, 0, 0)) module.exports.Strings = Strings ->module.exports : Symbol(Handler, Decl(source.js, 0, 0)) +>module.exports.Strings : Symbol(Strings, Decl(source.js, 14, 25)) +>module.exports : Symbol("source", Decl(source.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Handler, Decl(source.js, 0, 0)) +>exports : Symbol("source", Decl(source.js, 0, 0)) +>Strings : Symbol(Strings, Decl(source.js, 14, 25)) >Strings : Symbol(Strings, Decl(source.js, 9, 5)) /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff index 3d495c8667..dbb88bb6d3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff @@ -35,20 +35,19 @@ ->module : Symbol(export=, Decl(source.js, 12, 1)) ->exports : Symbol(export=, Decl(source.js, 12, 1)) ->Handler : Symbol(Handler, Decl(source.js, 0, 0), Decl(source.js, 7, 1)) -+>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) ++>module.exports : Symbol("source", Decl(source.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Handler, Decl(source.js, 0, 0)) ++>exports : Symbol("source", Decl(source.js, 0, 0)) +>Handler : Symbol(Handler, Decl(source.js, 0, 0)) module.exports.Strings = Strings -->module.exports.Strings : Symbol(Strings, Decl(source.js, 14, 25)) + >module.exports.Strings : Symbol(Strings, Decl(source.js, 14, 25)) ->module.exports : Symbol(Strings, Decl(source.js, 14, 25)) ->module : Symbol(module, Decl(source.js, 12, 1)) ->exports : Symbol(module.exports, Decl(source.js, 0, 0)) -->Strings : Symbol(Strings, Decl(source.js, 14, 25)) -+>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) ++>module.exports : Symbol("source", Decl(source.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Handler, Decl(source.js, 0, 0)) ++>exports : Symbol("source", Decl(source.js, 0, 0)) + >Strings : Symbol(Strings, Decl(source.js, 14, 25)) >Strings : Symbol(Strings, Decl(source.js, 9, 5)) - /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types index 732245046e..c186fd20a6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types @@ -37,18 +37,18 @@ const Strings = { module.exports = Handler; >module.exports = Handler : typeof Handler ->module.exports : typeof Handler ->module : { Handler: typeof Handler; } ->exports : typeof Handler +>module.exports : typeof import("source") +>module : { "source": typeof import("source"); } +>exports : typeof import("source") >Handler : typeof Handler module.exports.Strings = Strings >module.exports.Strings = Strings : { a: string; b: string; } ->module.exports.Strings : any ->module.exports : typeof Handler ->module : { Handler: typeof Handler; } ->exports : typeof Handler ->Strings : any +>module.exports.Strings : { a: string; b: string; } +>module.exports : typeof import("source") +>module : { "source": typeof import("source"); } +>exports : typeof import("source") +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols index 89d7829634..72e5be4118 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols @@ -17,9 +17,9 @@ class Container { } module.exports = Container; ->module.exports : Symbol(Container, Decl(index.js, 0, 29)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Container, Decl(index.js, 0, 29)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >Container : Symbol(Container, Decl(index.js, 0, 29)) === obj.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff index 1e3e65d778..f31880e2fb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff @@ -15,9 +15,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 6, 1)) ->exports : Symbol(export=, Decl(index.js, 6, 1)) -+>module.exports : Symbol(Container, Decl(index.js, 0, 29)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Container, Decl(index.js, 0, 29)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >Container : Symbol(Container, Decl(index.js, 0, 29)) === obj.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types index 1b123a62e8..a0b06fe4c2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types @@ -23,9 +23,9 @@ class Container { module.exports = Container; >module.exports = Container : typeof Container ->module.exports : typeof Container ->module : { Container: typeof Container; } ->exports : typeof Container +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >Container : typeof Container === obj.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols index 716a94e9ae..e3d56db2ef 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols @@ -65,9 +65,9 @@ const ns = require("./cls"); >"./cls" : Symbol("cls", Decl(cls.js, 0, 0)) module.exports = ns; ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) +>exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) >ns : Symbol(ns, Decl(cjs2.js, 0, 5)) === cjs3.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff index b302986532..d2820ea48a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff @@ -27,9 +27,9 @@ ->module.exports : Symbol(module.exports, Decl(cjs2.js, 0, 0)) ->module : Symbol(export=, Decl(cjs2.js, 0, 28)) ->exports : Symbol(export=, Decl(cjs2.js, 0, 28)) -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>module.exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) >ns : Symbol(ns, Decl(cjs2.js, 0, 5)) === cjs3.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types index 0d9eaa2848..d5b8e43499 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types @@ -70,9 +70,9 @@ const ns = require("./cls"); module.exports = ns; >module.exports = ns : typeof import("cls") ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") +>module.exports : typeof import("cjs2") +>module : { "cjs2": typeof import("cjs2"); } +>exports : typeof import("cjs2") >ns : typeof import("cls") === cjs3.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols index 34204ffe6a..294ada5721 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols @@ -16,9 +16,9 @@ import * as ns from "./cls"; >ns : Symbol(ns, Decl(bin.js, 0, 6)) module.exports = ns; // We refuse to bind cjs module exports assignments in the same file we find an import in ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol("bin", Decl(bin.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) +>exports : Symbol("bin", Decl(bin.js, 0, 0)) >ns : Symbol(ns, Decl(bin.js, 0, 6)) === globalNs.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff index 6706cd8bd1..4ee27b7498 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff @@ -4,9 +4,9 @@ >ns : Symbol(ns, Decl(bin.js, 0, 6)) module.exports = ns; // We refuse to bind cjs module exports assignments in the same file we find an import in -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>module.exports : Symbol("bin", Decl(bin.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>exports : Symbol("bin", Decl(bin.js, 0, 0)) >ns : Symbol(ns, Decl(bin.js, 0, 6)) === globalNs.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types index e641d5289b..4aee73567c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types @@ -17,9 +17,9 @@ import * as ns from "./cls"; module.exports = ns; // We refuse to bind cjs module exports assignments in the same file we find an import in >module.exports = ns : typeof import("cls") ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") +>module.exports : typeof import("bin") +>module : { "bin": typeof import("bin"); } +>exports : typeof import("bin") >ns : typeof import("cls") === globalNs.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt index 3c8079cefa..817ed8f7a2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt @@ -1,16 +1,14 @@ -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(6,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. -==== 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 + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. +!!! related TS2728 cls.js:7:1: 'Strings' is declared here. + module.exports.Strings = Strings; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols index b68cc7cae5..e69d74a67e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols @@ -15,14 +15,16 @@ class Foo {} >Foo : Symbol(Foo, Decl(cls.js, 3, 2)) module.exports = Foo; ->module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 3, 2)) module.exports.Strings = Strings; ->module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>module.exports.Strings : Symbol(Strings, Decl(cls.js, 5, 21)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) +>Strings : Symbol(Strings, Decl(cls.js, 5, 21)) >Strings : Symbol(Strings, Decl(cls.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff index 1b0ce33d43..68dca6f807 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff @@ -7,19 +7,19 @@ ->module.exports : Symbol(module.exports, Decl(cls.js, 0, 0)) ->module : Symbol(export=, Decl(cls.js, 4, 12)) ->exports : Symbol(export=, Decl(cls.js, 4, 12)) -+>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Foo, Decl(cls.js, 3, 2)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 3, 2)) module.exports.Strings = Strings; -->module.exports.Strings : Symbol(Strings, Decl(cls.js, 5, 21)) + >module.exports.Strings : Symbol(Strings, Decl(cls.js, 5, 21)) ->module.exports : Symbol(Strings, Decl(cls.js, 5, 21)) ->module : Symbol(module, Decl(cls.js, 4, 12)) ->exports : Symbol(module.exports, Decl(cls.js, 0, 0)) -->Strings : Symbol(Strings, Decl(cls.js, 5, 21)) -+>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Foo, Decl(cls.js, 3, 2)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) + >Strings : Symbol(Strings, Decl(cls.js, 5, 21)) >Strings : Symbol(Strings, Decl(cls.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types index 2bc348dc16..87899d1d51 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types @@ -19,17 +19,17 @@ class Foo {} module.exports = Foo; >module.exports = Foo : typeof Foo ->module.exports : typeof Foo ->module : { Foo: typeof Foo; } ->exports : typeof Foo +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } ->module.exports.Strings : any ->module.exports : typeof Foo ->module : { Foo: typeof Foo; } ->exports : typeof Foo ->Strings : any +>module.exports.Strings : { a: string; b: string; } +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") +>Strings : { a: string; b: string; } >Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols index 015b3ca595..b3e741478b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols @@ -12,9 +12,9 @@ function Timer(timeout) { >timeout : Symbol(timeout, Decl(timer.js, 3, 15)) } module.exports = Timer; ->module.exports : Symbol(Timer, Decl(timer.js, 0, 0)) +>module.exports : Symbol("timer", Decl(timer.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Timer, Decl(timer.js, 0, 0)) +>exports : Symbol("timer", Decl(timer.js, 0, 0)) >Timer : Symbol(Timer, Decl(timer.js, 0, 0)) === hook.js === @@ -32,9 +32,9 @@ function Hook(handle) { >handle : Symbol(handle, Decl(hook.js, 6, 14)) } module.exports = Hook; ->module.exports : Symbol(Hook, Decl(hook.js, 0, 0)) +>module.exports : Symbol("hook", Decl(hook.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Hook, Decl(hook.js, 0, 0)) +>exports : Symbol("hook", Decl(hook.js, 0, 0)) >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === @@ -103,8 +103,8 @@ Context.prototype = { } } module.exports = Context; ->module.exports : Symbol(Context, Decl(context.js, 0, 0)) +>module.exports : Symbol("context", Decl(context.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Context, Decl(context.js, 0, 0)) +>exports : Symbol("context", Decl(context.js, 0, 0)) >Context : Symbol(Context, Decl(context.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff index 6090b4fc1c..c328b520d3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff @@ -13,9 +13,9 @@ ->module.exports : Symbol(module.exports, Decl(timer.js, 0, 0)) ->module : Symbol(export=, Decl(timer.js, 5, 1)) ->exports : Symbol(export=, Decl(timer.js, 5, 1)) -+>module.exports : Symbol(Timer, Decl(timer.js, 0, 0)) ++>module.exports : Symbol("timer", Decl(timer.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Timer, Decl(timer.js, 0, 0)) ++>exports : Symbol("timer", Decl(timer.js, 0, 0)) >Timer : Symbol(Timer, Decl(timer.js, 0, 0)) === hook.js === @@ -32,9 +32,9 @@ ->module.exports : Symbol(module.exports, Decl(hook.js, 0, 0)) ->module : Symbol(export=, Decl(hook.js, 8, 1)) ->exports : Symbol(export=, Decl(hook.js, 8, 1)) -+>module.exports : Symbol(Hook, Decl(hook.js, 0, 0)) ++>module.exports : Symbol("hook", Decl(hook.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Hook, Decl(hook.js, 0, 0)) ++>exports : Symbol("hook", Decl(hook.js, 0, 0)) >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === @@ -81,8 +81,8 @@ ->module : Symbol(export=, Decl(context.js, 46, 1)) ->exports : Symbol(export=, Decl(context.js, 46, 1)) ->Context : Symbol(Context, Decl(context.js, 0, 0), Decl(context.js, 36, 1)) -+>module.exports : Symbol(Context, Decl(context.js, 0, 0)) ++>module.exports : Symbol("context", Decl(context.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Context, Decl(context.js, 0, 0)) ++>exports : Symbol("context", Decl(context.js, 0, 0)) +>Context : Symbol(Context, Decl(context.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types index 5732a3c707..39386d9c57 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types @@ -17,9 +17,9 @@ function Timer(timeout) { } module.exports = Timer; >module.exports = Timer : (timeout: number) => void ->module.exports : (timeout: number) => void ->module : { Timer: (timeout: number) => void; } ->exports : (timeout: number) => void +>module.exports : typeof import("timer") +>module : { "timer": typeof import("timer"); } +>exports : typeof import("timer") >Timer : (timeout: number) => void === hook.js === @@ -42,9 +42,9 @@ function Hook(handle) { } module.exports = Hook; >module.exports = Hook : (handle: HookHandler) => void ->module.exports : (handle: HookHandler) => void ->module : { Hook: (handle: HookHandler) => void; } ->exports : (handle: HookHandler) => void +>module.exports : typeof import("hook") +>module : { "hook": typeof import("hook"); } +>exports : typeof import("hook") >Hook : (handle: HookHandler) => void === context.js === @@ -132,8 +132,8 @@ Context.prototype = { } module.exports = Context; >module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ->module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ->module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; }; } ->exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>module.exports : typeof import("context") +>module : { "context": typeof import("context"); } +>exports : typeof import("context") >Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types index 8946c4eb88..cf209b5387 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types @@ -46,8 +46,8 @@ import {Point} from "./source"; * @param {Point} p */ export function magnitude(p) { ->magnitude : (p: Point) => number ->p : Point +>magnitude : (p: any) => number +>p : any return Math.sqrt(p.x ** 2 + p.y ** 2); >Math.sqrt(p.x ** 2 + p.y ** 2) : number @@ -57,12 +57,12 @@ export function magnitude(p) { >p.x ** 2 + p.y ** 2 : number >p.x ** 2 : number >p.x : any ->p : Point +>p : any >x : any >2 : 2 >p.y ** 2 : number >p.y : any ->p : Point +>p : any >y : any >2 : 2 } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols index c192b9ad18..ddcf600ae6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols @@ -2,9 +2,9 @@ === source.js === module.exports = MyClass; ->module.exports : Symbol(MyClass, Decl(source.js, 0, 25)) +>module.exports : Symbol("source", Decl(source.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(MyClass, Decl(source.js, 0, 25)) +>exports : Symbol("source", Decl(source.js, 0, 0)) >MyClass : Symbol(MyClass, Decl(source.js, 0, 25)) function MyClass() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff index 649df7c51c..2bc7f1bc37 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff @@ -8,9 +8,9 @@ ->module : Symbol(export=, Decl(source.js, 0, 0)) ->exports : Symbol(export=, Decl(source.js, 0, 0)) ->MyClass : Symbol(MyClass, Decl(source.js, 0, 25), Decl(source.js, 2, 21), Decl(source.js, 4, 40)) -+>module.exports : Symbol(MyClass, Decl(source.js, 0, 25)) ++>module.exports : Symbol("source", Decl(source.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(MyClass, Decl(source.js, 0, 25)) ++>exports : Symbol("source", Decl(source.js, 0, 0)) +>MyClass : Symbol(MyClass, Decl(source.js, 0, 25)) function MyClass() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types index 63d7a95b46..301c3f8b5a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types @@ -3,9 +3,9 @@ === source.js === module.exports = MyClass; >module.exports = MyClass : { (): void; staticMethod: () => void; staticProperty: number; } ->module.exports : { (): void; staticMethod: () => void; staticProperty: number; } ->module : { MyClass: { (): void; staticMethod: () => void; staticProperty: number; }; } ->exports : { (): void; staticMethod: () => void; staticProperty: number; } +>module.exports : typeof import("source") +>module : { "source": typeof import("source"); } +>exports : typeof import("source") >MyClass : { (): void; staticMethod: () => void; staticProperty: number; } function MyClass() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols index 5d9024d83e..eb6f942821 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols @@ -17,8 +17,8 @@ foo.default = foo; >foo : Symbol(foo, Decl(index.js, 0, 0)) module.exports = foo; ->module.exports : Symbol(foo, Decl(index.js, 0, 0)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(foo, Decl(index.js, 0, 0)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >foo : Symbol(foo, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff index 1447d1d8b4..6de015ffad 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff @@ -32,8 +32,8 @@ ->module : Symbol(export=, Decl(index.js, 3, 18)) ->exports : Symbol(export=, Decl(index.js, 3, 18)) ->foo : Symbol(foo, Decl(index.js, 0, 0), Decl(index.js, 0, 17), Decl(index.js, 2, 14)) -+>module.exports : Symbol(foo, Decl(index.js, 0, 0)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(foo, Decl(index.js, 0, 0)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) +>foo : Symbol(foo, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types index 3a3a17dfee..7179860fd4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types @@ -20,8 +20,8 @@ foo.default = foo; module.exports = foo; >module.exports = foo : { (): void; foo: ???; default: ???; } ->module.exports : { (): void; foo: ???; default: ???; } ->module : { foo: { (): void; foo: ???; default: ???; }; } ->exports : { (): void; foo: ???; default: ???; } +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >foo : { (): void; foo: ???; default: ???; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols index 8368b6c6a0..8127b75c26 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols @@ -12,9 +12,9 @@ const x = {x: 12}; >x : Symbol(x, Decl(mod1.js, 6, 11)) module.exports = x; ->module.exports : Symbol(x, Decl(mod1.js, 6, 5)) +>module.exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(x, Decl(mod1.js, 6, 5)) +>exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) >x : Symbol(x, Decl(mod1.js, 6, 5)) === index.js === @@ -24,8 +24,8 @@ const items = [{x: 12}]; >x : Symbol(x, Decl(index.js, 1, 16)) module.exports = items; ->module.exports : Symbol(items, Decl(index.js, 1, 5)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(items, Decl(index.js, 1, 5)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff index 0ece6b780b..a3b3eb1e9e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 6, 18)) ->exports : Symbol(export=, Decl(mod1.js, 6, 18)) -+>module.exports : Symbol(x, Decl(mod1.js, 6, 5)) ++>module.exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(x, Decl(mod1.js, 6, 5)) ++>exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) >x : Symbol(x, Decl(mod1.js, 6, 5)) === index.js === @@ -20,8 +20,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 1, 24)) ->exports : Symbol(export=, Decl(index.js, 1, 24)) -+>module.exports : Symbol(items, Decl(index.js, 1, 5)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(items, Decl(index.js, 1, 5)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types index 4eb595b0e1..4c7880d0ce 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types @@ -15,24 +15,24 @@ const x = {x: 12}; module.exports = x; >module.exports = x : { x: number; } ->module.exports : { x: number; } ->module : { readonly x: { x: number; }; } ->exports : { x: number; } +>module.exports : typeof import("folder/mod1") +>module : { "folder/mod1": typeof import("folder/mod1"); } +>exports : typeof import("folder/mod1") >x : { x: number; } === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : { x: number; }[] +>items : typeof import("folder/mod1")[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number >12 : 12 module.exports = items; ->module.exports = items : { x: number; }[] ->module.exports : { x: number; }[] ->module : { readonly items: { x: number; }[]; } ->exports : { x: number; }[] ->items : { x: number; }[] +>module.exports = items : typeof import("folder/mod1")[] +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") +>items : typeof import("folder/mod1")[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols index b174264e65..de87894e97 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols @@ -7,9 +7,9 @@ const j = require("./obj.json"); >"./obj.json" : Symbol("obj", Decl(obj.json, 0, 0)) module.exports = j; ->module.exports : Symbol(export=, Decl(obj.json, 0, 0)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(export=, Decl(obj.json, 0, 0)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === obj.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff index bad8351c2f..be3d0def3d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 32)) ->exports : Symbol(export=, Decl(index.js, 0, 32)) -+>module.exports : Symbol(export=, Decl(obj.json, 0, 0)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(export=, Decl(obj.json, 0, 0)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === obj.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types index ce3292755b..bca04a5e03 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types @@ -9,9 +9,9 @@ const j = require("./obj.json"); module.exports = j; >module.exports = j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module : { export=: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } ->exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } === obj.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols index 023ee18f3d..9124253fcc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols @@ -7,9 +7,9 @@ const j = require("./package.json"); >"./package.json" : Symbol("package", Decl(package.json, 0, 0)) module.exports = j; ->module.exports : Symbol(export=, Decl(package.json, 0, 0)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(export=, Decl(package.json, 0, 0)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === package.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff index cc31c515e9..27c11ca079 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 36)) ->exports : Symbol(export=, Decl(index.js, 0, 36)) -+>module.exports : Symbol(export=, Decl(package.json, 0, 0)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(export=, Decl(package.json, 0, 0)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === package.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types index 0feebff08b..fae1fe9e11 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types @@ -9,9 +9,9 @@ const j = require("./package.json"); module.exports = j; >module.exports = j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } ->module.exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } ->module : { export=: { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; }; } ->exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } === package.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt index eb9ed27e87..d0b6bfe341 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt @@ -1,8 +1,7 @@ -base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. file.js(1,15): error TS1340: Module './base' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./base')'? -==== base.js (1 errors) ==== +==== base.js (0 errors) ==== class Base { constructor() {} } @@ -14,8 +13,6 @@ file.js(1,15): error TS1340: Module './base' does not refer to a type, but is us BaseFactory.Base = Base; module.exports = BaseFactory; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== file.js (1 errors) ==== /** @typedef {import('./base')} BaseFactory */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols index 61b3252118..cd036a44e1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols @@ -22,9 +22,9 @@ BaseFactory.Base = Base; >Base : Symbol(Base, Decl(base.js, 0, 0)) module.exports = BaseFactory; ->module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>module.exports : Symbol("base", Decl(base.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>exports : Symbol("base", Decl(base.js, 0, 0)) >BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff index 89eef0156e..98e0a27ca5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff @@ -26,9 +26,9 @@ ->module : Symbol(export=, Decl(base.js, 8, 24)) ->exports : Symbol(export=, Decl(base.js, 8, 24)) ->BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2)) -+>module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) ++>module.exports : Symbol("base", Decl(base.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) ++>exports : Symbol("base", Decl(base.js, 0, 0)) +>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types index 9431695150..0fc5b97bd1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types @@ -26,9 +26,9 @@ BaseFactory.Base = Base; module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } ->module.exports : { (): Base; Base: typeof Base; } ->module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } ->exports : { (): Base; Base: typeof Base; } +>module.exports : typeof import("base") +>module : { "base": typeof import("base"); } +>exports : typeof import("base") >BaseFactory : { (): Base; Base: typeof Base; } === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt deleted file mode 100644 index fef4bd8c6b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - - -==== base.js (1 errors) ==== - class Base { - constructor() {} - } - - const BaseFactory = () => { - return new Base(); - }; - - BaseFactory.Base = Base; - - module.exports = BaseFactory; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - -==== file.js (0 errors) ==== - /** @typedef {typeof import('./base')} BaseFactory */ - - /** - * - * @param {InstanceType} base - * @returns {InstanceType} - */ - const test = (base) => { - return base; - }; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols index 982c22c1e1..01b36f5cd6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols @@ -22,9 +22,9 @@ BaseFactory.Base = Base; >Base : Symbol(Base, Decl(base.js, 0, 0)) module.exports = BaseFactory; ->module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>module.exports : Symbol("base", Decl(base.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>exports : Symbol("base", Decl(base.js, 0, 0)) >BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff index 281186ce6c..1edbd55627 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff @@ -26,9 +26,9 @@ ->module : Symbol(export=, Decl(base.js, 8, 24)) ->exports : Symbol(export=, Decl(base.js, 8, 24)) ->BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2)) -+>module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) ++>module.exports : Symbol("base", Decl(base.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) ++>exports : Symbol("base", Decl(base.js, 0, 0)) +>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types index dd819ce298..1bcedcd4f2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types @@ -26,9 +26,9 @@ BaseFactory.Base = Base; module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } ->module.exports : { (): Base; Base: typeof Base; } ->module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } ->exports : { (): Base; Base: typeof Base; } +>module.exports : typeof import("base") +>module : { "base": typeof import("base"); } +>exports : typeof import("base") >BaseFactory : { (): Base; Base: typeof Base; } === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols index 87ad80b3c1..0fa6b5afe1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols @@ -5,14 +5,14 @@ class Foo {} >Foo : Symbol(Foo, Decl(cls.js, 0, 0)) module.exports = Foo; ->module.exports : Symbol(Foo, Decl(cls.js, 0, 0)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Foo, Decl(cls.js, 0, 0)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 0, 0)) === usage.js === import {default as Fooa} from "./cls"; ->default : Symbol(Foo, Decl(cls.js, 0, 12)) +>default : Symbol("cls", Decl(cls.js, 0, 0)) >Fooa : Symbol(Fooa, Decl(usage.js, 0, 8)) export const x = new Fooa(); @@ -20,6 +20,6 @@ export const x = new Fooa(); >Fooa : Symbol(Fooa, Decl(usage.js, 0, 8)) export {default as Foob} from "./cls"; ->default : Symbol(Foo, Decl(cls.js, 0, 12)) +>default : Symbol("cls", Decl(cls.js, 0, 0)) >Foob : Symbol(Foob, Decl(usage.js, 4, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff index 1fdfd983b5..c0b96bd30a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff @@ -7,15 +7,15 @@ ->module.exports : Symbol(module.exports, Decl(cls.js, 0, 0)) ->module : Symbol(export=, Decl(cls.js, 0, 12)) ->exports : Symbol(export=, Decl(cls.js, 0, 12)) -+>module.exports : Symbol(Foo, Decl(cls.js, 0, 0)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Foo, Decl(cls.js, 0, 0)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 0, 0)) === usage.js === import {default as Fooa} from "./cls"; ->default : Symbol(export=, Decl(cls.js, 0, 12)) -+>default : Symbol(Foo, Decl(cls.js, 0, 12)) ++>default : Symbol("cls", Decl(cls.js, 0, 0)) >Fooa : Symbol(Fooa, Decl(usage.js, 0, 8)) export const x = new Fooa(); @@ -24,6 +24,6 @@ export {default as Foob} from "./cls"; ->default : Symbol(export=, Decl(cls.js, 0, 12)) -+>default : Symbol(Foo, Decl(cls.js, 0, 12)) ++>default : Symbol("cls", Decl(cls.js, 0, 0)) >Foob : Symbol(Foob, Decl(usage.js, 4, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types index e3b5cdd547..9c4c56d3c3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types @@ -6,22 +6,22 @@ class Foo {} module.exports = Foo; >module.exports = Foo : typeof Foo ->module.exports : typeof Foo ->module : { Foo: typeof Foo; } ->exports : typeof Foo +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") >Foo : typeof Foo === usage.js === import {default as Fooa} from "./cls"; ->default : typeof Foo ->Fooa : typeof Foo +>default : typeof import("cls") +>Fooa : typeof import("cls") export const x = new Fooa(); >x : Foo >new Fooa() : Foo ->Fooa : typeof Foo +>Fooa : typeof import("cls") export {default as Foob} from "./cls"; ->default : typeof Foo ->Foob : typeof Foo +>default : typeof import("cls") +>Foob : typeof import("cls") diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types index c11d9b3b3a..911a448431 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types @@ -13,10 +13,10 @@ let render = new Render(); >Render : typeof Render render.addRectangle(); ->render.addRectangle() : Rectangle ->render.addRectangle : () => Rectangle +>render.addRectangle() : any +>render.addRectangle : () => any >render : Render ->addRectangle : () => Rectangle +>addRectangle : () => any console.log("Objects", render.objects); >console.log("Objects", render.objects) : void @@ -78,7 +78,7 @@ class Render { * @returns {Rectangle} the rect */ addRectangle() { ->addRectangle : () => Rectangle +>addRectangle : () => any const obj = new Rectangle(); >obj : Rectangle diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols index 6a34e25da5..89f6665250 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols @@ -20,8 +20,8 @@ const items = []; >items : Symbol(items, Decl(index.js, 1, 5)) module.exports = items; ->module.exports : Symbol(items, Decl(index.js, 1, 5)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(items, Decl(index.js, 1, 5)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff index fb55ebe2f5..8e859f03cb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff @@ -16,8 +16,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 1, 17)) ->exports : Symbol(export=, Decl(index.js, 1, 17)) -+>module.exports : Symbol(items, Decl(index.js, 1, 5)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(items, Decl(index.js, 1, 5)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types index 41589f0d1e..7eb6f338ea 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types @@ -19,8 +19,8 @@ const items = []; module.exports = items; >module.exports = items : Item[] ->module.exports : Item[] ->module : { readonly items: Item[]; } ->exports : Item[] +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >items : Item[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols index 6f1f52ce7b..8202049806 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols @@ -5,9 +5,9 @@ const items = require("./some-mod")(); >items : Symbol(items, Decl(index.js, 0, 5)) module.exports = items; ->module.exports : Symbol(items, Decl(index.js, 0, 5)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(items, Decl(index.js, 0, 5)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >items : Symbol(items, Decl(index.js, 0, 5)) === some-mod.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff index b446b0f974..c45be0e1bc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff @@ -11,9 +11,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 38)) ->exports : Symbol(export=, Decl(index.js, 0, 38)) -+>module.exports : Symbol(items, Decl(index.js, 0, 5)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(items, Decl(index.js, 0, 5)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >items : Symbol(items, Decl(index.js, 0, 5)) === some-mod.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types index 40ff68dc81..ed842ce680 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types @@ -10,9 +10,9 @@ const items = require("./some-mod")(); module.exports = items; >module.exports = items : any ->module.exports : any ->module : { readonly items: any; } ->exports : any +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >items : any === some-mod.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols index 9c06625b4c..ed89640fe2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols @@ -17,9 +17,9 @@ class Conn { } module.exports = Conn; ->module.exports : Symbol(Conn, Decl(conn.js, 0, 0)) +>module.exports : Symbol("conn", Decl(conn.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Conn, Decl(conn.js, 0, 0)) +>exports : Symbol("conn", Decl(conn.js, 0, 0)) >Conn : Symbol(Conn, Decl(conn.js, 0, 0)) === usage.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff index 612c925f9d..753d34e9bc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff @@ -16,9 +16,9 @@ ->module.exports : Symbol(module.exports, Decl(conn.js, 0, 0)) ->module : Symbol(export=, Decl(conn.js, 8, 1)) ->exports : Symbol(export=, Decl(conn.js, 8, 1)) -+>module.exports : Symbol(Conn, Decl(conn.js, 0, 0)) ++>module.exports : Symbol("conn", Decl(conn.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Conn, Decl(conn.js, 0, 0)) ++>exports : Symbol("conn", Decl(conn.js, 0, 0)) >Conn : Symbol(Conn, Decl(conn.js, 0, 0)) === usage.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types index b2cfda6619..c87313a8a3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types @@ -19,9 +19,9 @@ class Conn { module.exports = Conn; >module.exports = Conn : typeof Conn ->module.exports : typeof Conn ->module : { Conn: typeof Conn; } ->exports : typeof Conn +>module.exports : typeof import("conn") +>module : { "conn": typeof import("conn"); } +>exports : typeof import("conn") >Conn : typeof Conn === usage.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols index 32610b29dd..091a6faea5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols @@ -41,8 +41,8 @@ class LazySet { } module.exports = LazySet; ->module.exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) +>module.exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) +>exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff index 1e12a162c8..0e658cd204 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff @@ -34,8 +34,8 @@ ->module.exports : Symbol(module.exports, Decl(LazySet.js, 0, 0)) ->module : Symbol(export=, Decl(LazySet.js, 10, 1)) ->exports : Symbol(export=, Decl(LazySet.js, 10, 1)) -+>module.exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) ++>module.exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) ++>exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types index 7690579039..6bd6c18df9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types @@ -2,8 +2,8 @@ === index.js === const LazySet = require("./LazySet"); ->LazySet : typeof LazySet ->require("./LazySet") : typeof LazySet +>LazySet : typeof import("LazySet") +>require("./LazySet") : typeof import("LazySet") >require : any >"./LazySet" : "./LazySet" @@ -44,8 +44,8 @@ class LazySet { module.exports = LazySet; >module.exports = LazySet : typeof LazySet ->module.exports : typeof LazySet ->module : { LazySet: typeof LazySet; } ->exports : typeof LazySet +>module.exports : typeof import("LazySet") +>module : { "LazySet": typeof import("LazySet"); } +>exports : typeof import("LazySet") >LazySet : typeof LazySet diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index 383deeead4..be9185a225 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -30,9 +30,9 @@ class MainThreadTasks { } module.exports = MainThreadTasks; ->module.exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) +>module.exports : Symbol("index", Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) +>exports : Symbol("index", Decl(index.js, 0, 0)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) === module.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index 80cb2b4d97..63fa5eb8cd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 18, 1)) ->exports : Symbol(export=, Decl(index.js, 18, 1)) -+>module.exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) ++>module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) === module.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index c26f71c094..b9c28fe338 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -32,9 +32,9 @@ class MainThreadTasks { module.exports = MainThreadTasks; >module.exports = MainThreadTasks : typeof MainThreadTasks ->module.exports : typeof MainThreadTasks ->module : { MainThreadTasks: typeof MainThreadTasks; } ->exports : typeof MainThreadTasks +>module.exports : typeof import("index") +>module : { "index": typeof import("index"); } +>exports : typeof import("index") >MainThreadTasks : typeof MainThreadTasks === module.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols index 93fb6896b8..2d9cadee8c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols @@ -45,8 +45,8 @@ class Chunk { } } module.exports = Chunk; ->module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff index f46c241539..e88dd8dde8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff @@ -33,8 +33,8 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 5, 1)) ->exports : Symbol(export=, Decl(mod1.js, 5, 1)) -+>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types index f2014f2aca..e3c0da626e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types @@ -13,8 +13,8 @@ c.chunk; >chunk : any const D = require("./mod1"); ->D : typeof Chunk ->require("./mod1") : typeof Chunk +>D : typeof import("mod1") +>require("./mod1") : typeof import("mod1") >require : (name: string) => any >"./mod1" : "./mod1" @@ -55,8 +55,8 @@ class Chunk { } module.exports = Chunk; >module.exports = Chunk : typeof Chunk ->module.exports : typeof Chunk ->module : { Chunk: typeof Chunk; } ->exports : typeof Chunk +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") >Chunk : typeof Chunk diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols index 3ee8f67b2d..e1656ebdbf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols @@ -42,8 +42,8 @@ class MW { } module.exports = MW; ->module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module.exports : Symbol("MW", Decl(MW.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(MW, Decl(MW.js, 0, 0)) +>exports : Symbol("MW", Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff index 61a7b3444e..e4723af57e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff @@ -33,8 +33,8 @@ ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -+>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>module.exports : Symbol("MW", Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>exports : Symbol("MW", Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types index f02de57cd4..169025c5b0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : typeof MW ->require("./MW") : typeof MW +>MW : typeof import("MW") +>require("./MW") : typeof import("MW") >require : any >"./MW" : "./MW" @@ -22,7 +22,7 @@ module.exports = class MC { return new MW(this); >new MW(this) : MW ->MW : typeof MW +>MW : typeof import("MW") >this : this } }; @@ -50,8 +50,8 @@ class MW { module.exports = MW; >module.exports = MW : typeof MW ->module.exports : typeof MW ->module : { MW: typeof MW; } ->exports : typeof MW +>module.exports : typeof import("MW") +>module : { "MW": typeof import("MW"); } +>exports : typeof import("MW") >MW : typeof MW diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols index 1c27613be4..d6f96ad615 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols @@ -44,8 +44,8 @@ class MW { } module.exports = MW; ->module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module.exports : Symbol("MW", Decl(MW.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(MW, Decl(MW.js, 0, 0)) +>exports : Symbol("MW", Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff index 71368dfa96..94c0abbee0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff @@ -26,8 +26,8 @@ ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -+>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>module.exports : Symbol("MW", Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>exports : Symbol("MW", Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types index 8e53ae07de..936756067b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : typeof MW ->require("./MW") : typeof MW +>MW : typeof import("MW") +>require("./MW") : typeof import("MW") >require : any >"./MW" : "./MW" @@ -25,7 +25,7 @@ module.exports = function MC() { return new MW(x); >new MW(x) : MW ->MW : typeof MW +>MW : typeof import("MW") >x : any }; @@ -53,8 +53,8 @@ class MW { module.exports = MW; >module.exports = MW : typeof MW ->module.exports : typeof MW ->module : { MW: typeof MW; } ->exports : typeof MW +>module.exports : typeof import("MW") +>module : { "MW": typeof import("MW"); } +>exports : typeof import("MW") >MW : typeof MW diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt index e5b61208a5..5f2b7fe3f9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt @@ -1,16 +1,22 @@ -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,1): error TS2349: This expression is not callable. + Type '{}' has no call signatures. +Eloquent.js(5,1): error TS1233: An export declaration can only be used at the top level of a namespace or module. ==== Eloquent.js (2 errors) ==== // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript (function() { + ~~~~~~~~~~~~~ exports.bigOak = 1 + ~~~~~~~~~~~~~~~~~~ exports.everywhere = 2 + ~~~~~~~~~~~~~~~~~~~~~~ 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. + ~~~~~~ +!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. })() + ~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type '{}' has no call signatures. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types index 9c872cbe80..45ee509a46 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types @@ -3,9 +3,9 @@ === Eloquent.js === // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript (function() { ->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : void ->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : () => void ->function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : () => void +>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : any +>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : {} +>function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : {} exports.bigOak = 1 >exports.bigOak = 1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt index 6eb423476b..9674549fd0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt @@ -1,18 +1,13 @@ -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,1): error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. -==== bug28014.js (3 errors) ==== +==== bug28014.js (1 errors) ==== exports.version = 1 - ~~~~~~~ -!!! error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. function alias() { } 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. + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. +!!! related TS2728 bug28014.js:1:1: 'version' is declared here. ==== importer.js (0 errors) ==== import('./bug28014') diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols index 7f1206e1a5..b6215493e4 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols @@ -2,15 +2,17 @@ === bug28014.js === exports.version = 1 +>exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) >exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) +>version : Symbol(version, Decl(bug28014.js, 0, 0)) function alias() { } >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) module.exports = alias ->module.exports : Symbol(alias, Decl(bug28014.js, 0, 19)) +>module.exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(alias, Decl(bug28014.js, 0, 19)) +>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) === importer.js === diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff index e7cff875e6..a5707563ea 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff @@ -1,13 +1,12 @@ --- old.moduleExportAliasImported.symbols +++ new.moduleExportAliasImported.symbols -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === bug28014.js === exports.version = 1 -->exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) + >exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) ->exports : Symbol(version, Decl(bug28014.js, 0, 0)) -->version : Symbol(version, Decl(bug28014.js, 0, 0)) +>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) + >version : Symbol(version, Decl(bug28014.js, 0, 0)) function alias() { } >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) @@ -16,9 +15,9 @@ ->module.exports : Symbol(module.exports, Decl(bug28014.js, 0, 0)) ->module : Symbol(export=, Decl(bug28014.js, 1, 20)) ->exports : Symbol(export=, Decl(bug28014.js, 1, 20)) -+>module.exports : Symbol(alias, Decl(bug28014.js, 0, 19)) ++>module.exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(alias, Decl(bug28014.js, 0, 19)) ++>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) === importer.js === diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types index efd5fe7f64..da86ed1f71 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types @@ -3,9 +3,9 @@ === bug28014.js === exports.version = 1 >exports.version = 1 : 1 ->exports.version : any +>exports.version : 1 >exports : typeof import("bug28014") ->version : any +>version : 1 >1 : 1 function alias() { } @@ -13,13 +13,13 @@ function alias() { } module.exports = alias >module.exports = alias : () => void ->module.exports : () => void ->module : { alias: () => void; } ->exports : () => void +>module.exports : typeof import("bug28014") +>module : { "bug28014": typeof import("bug28014"); } +>exports : typeof import("bug28014") >alias : () => void === importer.js === import('./bug28014') ->import('./bug28014') : Promise<() => void> +>import('./bug28014') : Promise >'./bug28014' : "./bug28014" diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt index 817b5b7b5b..375e48bb75 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(9,1): error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. -==== axios.js (2 errors) ==== +==== axios.js (1 errors) ==== class Axios { constructor() { } @@ -12,9 +11,8 @@ 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. + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. +!!! related TS2728 axios.js:10:1: 'default' is declared here. module.exports.default = axios; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'Axios'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols index e1144e754b..170109f48c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols @@ -20,14 +20,16 @@ axios.m() >m : Symbol(m, Decl(axios.js, 2, 5)) module.exports = axios; ->module.exports : Symbol(axios, Decl(axios.js, 5, 3)) +>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(axios, Decl(axios.js, 5, 3)) +>exports : Symbol("axios", Decl(axios.js, 0, 0)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) module.exports.default = axios; ->module.exports : Symbol(axios, Decl(axios.js, 5, 3)) +>module.exports.default : Symbol(default, Decl(axios.js, 8, 23)) +>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(axios, Decl(axios.js, 5, 3)) +>exports : Symbol("axios", Decl(axios.js, 0, 0)) +>default : Symbol(default, Decl(axios.js, 8, 23)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff index c773d65dd9..112e0616a0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff @@ -23,19 +23,19 @@ ->module.exports : Symbol(module.exports, Decl(axios.js, 0, 0)) ->module : Symbol(export=, Decl(axios.js, 7, 9)) ->exports : Symbol(export=, Decl(axios.js, 7, 9)) -+>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) ++>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(axios, Decl(axios.js, 5, 3)) ++>exports : Symbol("axios", Decl(axios.js, 0, 0)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) module.exports.default = axios; -->module.exports.default : Symbol(default, Decl(axios.js, 8, 23)) + >module.exports.default : Symbol(default, Decl(axios.js, 8, 23)) ->module.exports : Symbol(default, Decl(axios.js, 8, 23)) ->module : Symbol(module, Decl(axios.js, 7, 9)) ->exports : Symbol(module.exports, Decl(axios.js, 0, 0)) -->default : Symbol(default, Decl(axios.js, 8, 23)) -+>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) ++>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(axios, Decl(axios.js, 5, 3)) ++>exports : Symbol("axios", Decl(axios.js, 0, 0)) + >default : Symbol(default, Decl(axios.js, 8, 23)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types index 68d421dd4e..7d272b05cd 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types @@ -23,17 +23,17 @@ axios.m() module.exports = axios; >module.exports = axios : Axios ->module.exports : Axios ->module : { axios: Axios; } ->exports : Axios +>module.exports : typeof import("axios") +>module : { "axios": typeof import("axios"); } +>exports : typeof import("axios") >axios : Axios module.exports.default = axios; >module.exports.default = axios : Axios ->module.exports.default : any ->module.exports : Axios ->module : { axios: Axios; } ->exports : Axios ->default : any +>module.exports.default : Axios +>module.exports : typeof import("axios") +>module : { "axios": typeof import("axios"); } +>exports : typeof import("axios") +>default : Axios >axios : Axios diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt index 3867a2f253..aa59b0e8f8 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt @@ -1,13 +1,11 @@ -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,1): error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. -==== 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. + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. +!!! related TS2728 axios.js:3:1: 'default' is declared here. module.exports.default = axios - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols index 49ff0d0d69..eb124d3edf 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols @@ -5,14 +5,16 @@ var axios = {} >axios : Symbol(axios, Decl(axios.js, 0, 3)) module.exports = axios // both assignments should be ok ->module.exports : Symbol(axios, Decl(axios.js, 0, 3)) +>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(axios, Decl(axios.js, 0, 3)) +>exports : Symbol("axios", Decl(axios.js, 0, 0)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) module.exports.default = axios ->module.exports : Symbol(axios, Decl(axios.js, 0, 3)) +>module.exports.default : Symbol(default, Decl(axios.js, 1, 22)) +>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(axios, Decl(axios.js, 0, 3)) +>exports : Symbol("axios", Decl(axios.js, 0, 0)) +>default : Symbol(default, Decl(axios.js, 1, 22)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff index 83a0272583..1ec15ff63c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff @@ -7,19 +7,19 @@ ->module.exports : Symbol(module.exports, Decl(axios.js, 0, 0)) ->module : Symbol(export=, Decl(axios.js, 0, 14)) ->exports : Symbol(export=, Decl(axios.js, 0, 14)) -+>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) ++>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(axios, Decl(axios.js, 0, 3)) ++>exports : Symbol("axios", Decl(axios.js, 0, 0)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) module.exports.default = axios -->module.exports.default : Symbol(default, Decl(axios.js, 1, 22)) + >module.exports.default : Symbol(default, Decl(axios.js, 1, 22)) ->module.exports : Symbol(default, Decl(axios.js, 1, 22)) ->module : Symbol(module, Decl(axios.js, 0, 14)) ->exports : Symbol(module.exports, Decl(axios.js, 0, 0)) -->default : Symbol(default, Decl(axios.js, 1, 22)) -+>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) ++>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(axios, Decl(axios.js, 0, 3)) ++>exports : Symbol("axios", Decl(axios.js, 0, 0)) + >default : Symbol(default, Decl(axios.js, 1, 22)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types index 722a2dd211..0234144941 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types @@ -7,17 +7,17 @@ var axios = {} module.exports = axios // both assignments should be ok >module.exports = axios : {} ->module.exports : {} ->module : { axios: {}; } ->exports : {} +>module.exports : typeof import("axios") +>module : { "axios": typeof import("axios"); } +>exports : typeof import("axios") >axios : {} module.exports.default = axios >module.exports.default = axios : {} ->module.exports.default : any ->module.exports : {} ->module : { axios: {}; } ->exports : {} ->default : any +>module.exports.default : {} +>module.exports : typeof import("axios") +>module : { "axios": typeof import("axios"); } +>exports : typeof import("axios") +>default : {} >axios : {} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt index 040e68925d..55e3fe8ed7 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt @@ -1,41 +1,36 @@ -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; }'. +a.js(4,17): error TS2339: Property 'toFixed' does not exist on type '"string"'. +a.js(5,16): error TS2339: Property 'toFixed' does not exist on type '"string"'. +mod1.js(6,1): error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. -==== a.js (1 errors) ==== +==== a.js (2 errors) ==== /// var mod1 = require('./mod1') mod1.justExport.toFixed() mod1.bothBefore.toFixed() // error + ~~~~~~~ +!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.bothAfter.toFixed() + ~~~~~~~ +!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.justProperty.length - ~~~~~~~~~~~~ -!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (4 errors) ==== +==== mod1.js (1 errors) ==== /// module.exports.bothBefore = 'string' - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. A.justExport = 4 A.bothBefore = 2 A.bothAfter = 3 module.exports = A - ~~~~~~~~~~~~~~~~~~ -!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. +!!! related TS2728 mod1.js:11:1: 'justProperty' is declared here. function A() { this.p = 1 } module.exports.bothAfter = 'string' - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. module.exports.justProperty = 'string' - ~~~~~~~~~~~~ -!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols index b236c055da..4d8dfaf803 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols @@ -15,21 +15,21 @@ mod1.justExport.toFixed() >toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error ->mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ->mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ->toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) mod1.bothAfter.toFixed() ->mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ->mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ->toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) mod1.justProperty.length +>mod1.justProperty.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) +>mod1.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) +>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) === requires.d.ts === declare var module: { exports: any }; @@ -43,11 +43,11 @@ declare function require(name: string): any; === mod1.js === /// module.exports.bothBefore = 'string' ->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ->module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(A, Decl(mod1.js, 5, 18)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) A.justExport = 4 >A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) @@ -65,9 +65,9 @@ A.bothAfter = 3 >bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) module.exports = A ->module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(A, Decl(mod1.js, 5, 18)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >A : Symbol(A, Decl(mod1.js, 5, 18)) function A() { @@ -76,14 +76,16 @@ function A() { this.p = 1 } module.exports.bothAfter = 'string' ->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ->module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(A, Decl(mod1.js, 5, 18)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) module.exports.justProperty = 'string' ->module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(A, Decl(mod1.js, 5, 18)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff index db17845530..ab63989b53 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff @@ -16,28 +16,28 @@ mod1.bothBefore.toFixed() // error ->mod1.bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -+>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) -+>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) -+>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) mod1.bothAfter.toFixed() ->mod1.bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -+>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) -+>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) -+>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ->mod1.justProperty : Symbol(mod1.justProperty, Decl(mod1.js, 9, 35)) ++>mod1.justProperty.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) ++>mod1.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->justProperty : Symbol(mod1.justProperty, Decl(mod1.js, 9, 35)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ++>justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ++>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) === requires.d.ts === declare var module: { exports: any }; @@ -50,11 +50,11 @@ ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -+>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) -+>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(A, Decl(mod1.js, 5, 18)) -+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) A.justExport = 4 ->A.justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) @@ -85,9 +85,9 @@ ->module : Symbol(export=, Decl(mod1.js, 4, 15)) ->exports : Symbol(export=, Decl(mod1.js, 4, 15)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) -+>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) function A() { @@ -105,19 +105,19 @@ ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -+>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) -+>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(A, Decl(mod1.js, 5, 18)) -+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) module.exports.justProperty = 'string' -->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) + >module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) -+>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types index 48e342babc..75c7fc3bfc 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types @@ -3,8 +3,8 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>mod1 : typeof import("mod1") +>require('./mod1') : typeof import("mod1") >require : (name: string) => any >'./mod1' : "./mod1" @@ -12,32 +12,32 @@ mod1.justExport.toFixed() >mod1.justExport.toFixed() : string >mod1.justExport.toFixed : (fractionDigits?: number) => string >mod1.justExport : number ->mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>mod1 : typeof import("mod1") >justExport : number >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error ->mod1.bothBefore.toFixed() : string ->mod1.bothBefore.toFixed : (fractionDigits?: number) => string ->mod1.bothBefore : number ->mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->bothBefore : number ->toFixed : (fractionDigits?: number) => string +>mod1.bothBefore.toFixed() : any +>mod1.bothBefore.toFixed : any +>mod1.bothBefore : "string" +>mod1 : typeof import("mod1") +>bothBefore : "string" +>toFixed : any mod1.bothAfter.toFixed() ->mod1.bothAfter.toFixed() : string ->mod1.bothAfter.toFixed : (fractionDigits?: number) => string ->mod1.bothAfter : number ->mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->bothAfter : number ->toFixed : (fractionDigits?: number) => string +>mod1.bothAfter.toFixed() : any +>mod1.bothAfter.toFixed : any +>mod1.bothAfter : "string" +>mod1 : typeof import("mod1") +>bothAfter : "string" +>toFixed : any mod1.justProperty.length ->mod1.justProperty.length : any ->mod1.justProperty : any ->mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->justProperty : any ->length : any +>mod1.justProperty.length : number +>mod1.justProperty : "string" +>mod1 : typeof import("mod1") +>justProperty : "string" +>length : number === requires.d.ts === declare var module: { exports: any }; @@ -52,11 +52,11 @@ declare function require(name: string): any; /// module.exports.bothBefore = 'string' >module.exports.bothBefore = 'string' : "string" ->module.exports.bothBefore : number ->module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ->exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->bothBefore : number +>module.exports.bothBefore : "string" +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") +>bothBefore : "string" >'string' : "string" A.justExport = 4 @@ -82,9 +82,9 @@ A.bothAfter = 3 module.exports = A >module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ->exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") >A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } function A() { @@ -99,19 +99,19 @@ function A() { } module.exports.bothAfter = 'string' >module.exports.bothAfter = 'string' : "string" ->module.exports.bothAfter : number ->module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ->exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->bothAfter : number +>module.exports.bothAfter : "string" +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") +>bothAfter : "string" >'string' : "string" module.exports.justProperty = 'string' >module.exports.justProperty = 'string' : "string" ->module.exports.justProperty : any ->module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ->exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->justProperty : any +>module.exports.justProperty : "string" +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") +>justProperty : "string" >'string' : "string" diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt index b80fa4321a..b7506b736c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt @@ -1,4 +1,3 @@ -file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. @@ -16,13 +15,11 @@ index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECM export = a; ~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -==== file.js (1 errors) ==== +==== file.js (0 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; - ~~~~~~~~~~~~~~~~~~ -!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols index 406c1eb55f..401a532e63 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols @@ -14,9 +14,9 @@ const a = {}; >a : Symbol(a, Decl(file.js, 1, 5)) module.exports = a; ->module.exports : Symbol(a, Decl(file.js, 1, 5)) +>module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(a, Decl(file.js, 1, 5)) +>exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -34,8 +34,8 @@ const a = {}; >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; ->module.exports : Symbol(a, Decl(file.js, 2, 5)) +>module.exports : Symbol("file", Decl(file.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(a, Decl(file.js, 2, 5)) +>exports : Symbol("file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff index 17c8876eb0..52ff0e8be2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(file.js, 0, 0)) ->module : Symbol(export=, Decl(file.js, 1, 13)) ->exports : Symbol(export=, Decl(file.js, 1, 13)) -+>module.exports : Symbol(a, Decl(file.js, 1, 5)) ++>module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(a, Decl(file.js, 1, 5)) ++>exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -17,8 +17,8 @@ >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; -+>module.exports : Symbol(a, Decl(file.js, 2, 5)) ++>module.exports : Symbol("file", Decl(file.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(a, Decl(file.js, 2, 5)) ++>exports : Symbol("file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types index a2a34b8c70..0842290181 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types @@ -17,9 +17,9 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : {} ->module : { readonly a: {}; } ->exports : {} +>module.exports : typeof import("subfolder/file") +>module : { "subfolder/file": typeof import("subfolder/file"); } +>exports : typeof import("subfolder/file") >a : {} === index.js === @@ -40,8 +40,8 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : {} ->module : { readonly a: {}; } ->exports : {} +>module.exports : typeof import("file") +>module : { "file": typeof import("file"); } +>exports : typeof import("file") >a : {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt index b80fa4321a..b7506b736c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt @@ -1,4 +1,3 @@ -file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. @@ -16,13 +15,11 @@ index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECM export = a; ~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -==== file.js (1 errors) ==== +==== file.js (0 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; - ~~~~~~~~~~~~~~~~~~ -!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols index 406c1eb55f..401a532e63 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols @@ -14,9 +14,9 @@ const a = {}; >a : Symbol(a, Decl(file.js, 1, 5)) module.exports = a; ->module.exports : Symbol(a, Decl(file.js, 1, 5)) +>module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(a, Decl(file.js, 1, 5)) +>exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -34,8 +34,8 @@ const a = {}; >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; ->module.exports : Symbol(a, Decl(file.js, 2, 5)) +>module.exports : Symbol("file", Decl(file.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(a, Decl(file.js, 2, 5)) +>exports : Symbol("file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff index 25b089e7e8..8e46b6d1d2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(file.js, 0, 0)) ->module : Symbol(export=, Decl(file.js, 1, 13)) ->exports : Symbol(export=, Decl(file.js, 1, 13)) -+>module.exports : Symbol(a, Decl(file.js, 1, 5)) ++>module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(a, Decl(file.js, 1, 5)) ++>exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -17,8 +17,8 @@ >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; -+>module.exports : Symbol(a, Decl(file.js, 2, 5)) ++>module.exports : Symbol("file", Decl(file.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(a, Decl(file.js, 2, 5)) ++>exports : Symbol("file", Decl(file.js, 0, 0)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types index a2a34b8c70..0842290181 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types @@ -17,9 +17,9 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : {} ->module : { readonly a: {}; } ->exports : {} +>module.exports : typeof import("subfolder/file") +>module : { "subfolder/file": typeof import("subfolder/file"); } +>exports : typeof import("subfolder/file") >a : {} === index.js === @@ -40,8 +40,8 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : {} ->module : { readonly a: {}; } ->exports : {} +>module.exports : typeof import("file") +>module : { "file": typeof import("file"); } +>exports : typeof import("file") >a : {} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types index f3a738cd84..8423f1eb0e 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types @@ -35,10 +35,10 @@ const { A } = require("./a-ext"); /** @param {A} p */ function a(p) { p.x; } ->a : (p: A) => void ->p : A +>a : (p: any) => void +>p : any >p.x : any ->p : A +>p : any >x : any === b-ext.js === @@ -68,10 +68,10 @@ const { B } = require("./b-ext"); /** @param {B} p */ function b(p) { p.x; } ->b : (p: B) => void ->p : B +>b : (p: any) => void +>p : any >p.x : any ->p : B +>p : any >x : any === c-ext.js === @@ -95,10 +95,10 @@ const { C } = require("./c-ext"); /** @param {C} p */ function c(p) { p.x; } ->c : (p: C) => void ->p : C +>c : (p: any) => void +>p : any >p.x : any ->p : C +>p : any >x : any === d-ext.js === @@ -124,10 +124,10 @@ const { D } = require("./d-ext"); /** @param {D} p */ function d(p) { p.x; } ->d : (p: D) => void ->p : D +>d : (p: any) => void +>p : any >p.x : any ->p : D +>p : any >x : any === e-ext.js === diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols index 5a1120117c..b394693dae 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols @@ -38,9 +38,9 @@ declare var module: any; === minimatch.js === /// module.exports = minimatch ->module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>module.exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) >minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) minimatch.M = M diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff index 38c9315701..98acdbb310 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff @@ -44,9 +44,9 @@ ->module : Symbol(export=, Decl(minimatch.js, 0, 0)) ->exports : Symbol(export=, Decl(minimatch.js, 0, 0)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) -+>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>module.exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) minimatch.M = M diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types index 20ccb10834..ef34c45637 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types @@ -3,8 +3,8 @@ === use.js === /// var mini = require('./minimatch') ->mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ->require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>mini : typeof import("minimatch") +>require('./minimatch') : typeof import("minimatch") >require : any >'./minimatch' : "./minimatch" @@ -12,7 +12,7 @@ mini.M.defaults() >mini.M.defaults() : any >mini.M.defaults : (def: any) => any >mini.M : { (): void; defaults: (def: any) => any; } ->mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>mini : typeof import("minimatch") >M : { (): void; defaults: (def: any) => any; } >defaults : (def: any) => any @@ -20,7 +20,7 @@ var m = new mini.M() >m : any >new mini.M() : any >mini.M : { (): void; defaults: (def: any) => any; } ->mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>mini : typeof import("minimatch") >M : { (): void; defaults: (def: any) => any; } m.m() @@ -32,7 +32,7 @@ m.m() mini.filter() >mini.filter() : void >mini.filter : () => void ->mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>mini : typeof import("minimatch") >filter : () => void === types.d.ts === @@ -46,9 +46,9 @@ declare var module: any; /// module.exports = minimatch >module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ->module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ->module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } ->exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>module.exports : typeof import("minimatch") +>module : { "minimatch": typeof import("minimatch"); } +>exports : typeof import("minimatch") >minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } minimatch.M = M diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols index 32a138e1d0..34c0b1b75c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols @@ -11,9 +11,9 @@ declare var module: { exports: any}; /** @typedef {{ type: "b", y: 1 }} B */ /** @typedef {A | B} Both */ module.exports = C ->module.exports : Symbol(C, Decl(mod1.js, 4, 18)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(C, Decl(mod1.js, 4, 18)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff index 207aaa80f8..2faec0e7f5 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) ->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -+>module.exports : Symbol(C, Decl(mod1.js, 4, 18)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(C, Decl(mod1.js, 4, 18)) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index 83ab826c18..94d907cbe7 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -12,9 +12,9 @@ declare var module: { exports: any}; /** @typedef {A | B} Both */ module.exports = C >module.exports = C : () => void ->module.exports : () => void ->module : { C: () => void; } ->exports : () => void +>module.exports : typeof import("mod1") +>module : { "mod1": typeof import("mod1"); } +>exports : typeof import("mod1") >C : () => void function C() { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index ef2c18dda2..51e76e0712 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -6,13 +6,16 @@ mod1.js(10,1): error TS2309: An export assignment cannot be used in a module wit 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; }'. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (0 errors) ==== +==== use.js (1 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ var b; /** @type {mod.Baz} */ + ~~~ +!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 6ff7139c87..6e49c8f80c 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -13,7 +13,7 @@ var b; /** @type {mod.Baz} */ var bb; ->bb : number +>bb : Baz var bbb = new mod.Baz(); >bbb : Baz diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols index 903e7274bb..f99cdf7eac 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols @@ -9,9 +9,9 @@ ns.Foo = class {} >ns : Symbol(ns, Decl(mod2.js, 1, 5)) module.exports = ns; ->module.exports : Symbol(ns, Decl(mod2.js, 1, 5)) +>module.exports : Symbol("mod2", Decl(mod2.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol(ns, Decl(mod2.js, 1, 5)) +>exports : Symbol("mod2", Decl(mod2.js, 0, 0)) >ns : Symbol(ns, Decl(mod2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff index 9f1daabc85..f439129a68 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff @@ -18,9 +18,9 @@ ->module : Symbol(export=, Decl(mod2.js, 2, 17)) ->exports : Symbol(export=, Decl(mod2.js, 2, 17)) ->ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14)) -+>module.exports : Symbol(ns, Decl(mod2.js, 1, 5)) ++>module.exports : Symbol("mod2", Decl(mod2.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol(ns, Decl(mod2.js, 1, 5)) ++>exports : Symbol("mod2", Decl(mod2.js, 0, 0)) +>ns : Symbol(ns, Decl(mod2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types index 2cd97df031..375ddbcb77 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types @@ -15,9 +15,9 @@ ns.Foo = class {} module.exports = ns; >module.exports = ns : {} ->module.exports : {} ->module : { readonly ns: {}; } ->exports : {} +>module.exports : typeof import("mod2") +>module : { "mod2": typeof import("mod2"); } +>exports : typeof import("mod2") >ns : {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff index 410731570b..ed94b32906 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff @@ -3,7 +3,9 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+ExtendedClass.js(17,5): error TS1231: An export assignment must be at the top level of a file or module declaration. ++ExtendedClass.js(7,1): error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. ++ Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. ++ExtendedClass.js(17,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. +ExtendedClass.js(17,12): error TS2339: Property 'exports' does not exist on type '{}'. +ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type '{}'. + @@ -17,7 +19,7 @@ + } + export = BaseClass; + } -+==== ExtendedClass.js (3 errors) ==== ++==== ExtendedClass.js (4 errors) ==== + define("lib/ExtendedClass", ["deps/BaseClass"], + /** + * {typeof import("deps/BaseClass")} @@ -25,6 +27,9 @@ + * @returns + */ + (BaseClass) => { ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. ++!!! error TS2345: Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. + + const ExtendedClass = BaseClass.extends({ + f: function() { @@ -36,7 +41,7 @@ + const module = {}; + module.exports = ExtendedClass + ~~~~~~ -+!!! error TS1231: An export assignment must be at the top level of a file or module declaration. ++!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. + ~~~~~~~ +!!! error TS2339: Property 'exports' does not exist on type '{}'. + return module.exports; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff index df7286b7f1..1dbe07fee1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff @@ -24,7 +24,7 @@ (BaseClass) => { ->(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof import("deps/BaseClass")) => any ->BaseClass : typeof import("deps/BaseClass") -+>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof BaseClass) => any ++>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : {} +>BaseClass : typeof BaseClass const ExtendedClass = BaseClass.extends({ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff index 4a46c71ecb..33c390c357 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff @@ -6,8 +6,8 @@ const _item = require("./namespacer"); ->_item : typeof _item ->require("./namespacer") : typeof _item -+>_item : {} -+>require("./namespacer") : {} ++>_item : typeof import("namespacer") ++>require("./namespacer") : typeof import("namespacer") >require : any >"./namespacer" : "./namespacer" @@ -59,9 +59,9 @@ ->exports : typeof A ->A : typeof A +>module.exports = A : {} -+>module.exports : {} -+>module : { readonly A: {}; } -+>exports : {} ++>module.exports : typeof import("namespacey") ++>module : { "namespacey": typeof import("namespacey"); } ++>exports : typeof import("namespacey") +>A : {} === namespacer.js === @@ -105,8 +105,8 @@ ->exports : typeof B ->B : typeof B +>module.exports = B : {} -+>module.exports : {} -+>module : { readonly B: {}; } -+>exports : {} ++>module.exports : typeof import("namespacer") ++>module : { "namespacer": typeof import("namespacer"); } ++>exports : typeof import("namespacer") +>B : {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff index ecd1ddf5dc..1ee7714533 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff @@ -1,11 +1,14 @@ --- old.importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types +++ new.importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types -@@= skipped -18, +18 lines =@@ +@@= skipped -17, +17 lines =@@ + module.exports = Bar; >module.exports = Bar : typeof Bar - >module.exports : typeof Bar +->module.exports : typeof Bar ->module : { exports: typeof Bar; } -+>module : { Bar: typeof Bar; } - >exports : typeof Bar +->exports : typeof Bar ++>module.exports : typeof import("/index") ++>module : { "/index": typeof import("/index"); } ++>exports : typeof import("/index") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff index 028496c8a7..ea5139c94e 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff @@ -1,11 +1,14 @@ --- old.importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types +++ new.importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types -@@= skipped -18, +18 lines =@@ +@@= skipped -17, +17 lines =@@ + module.exports = Bar; >module.exports = Bar : typeof Bar - >module.exports : typeof Bar +->module.exports : typeof Bar ->module : { exports: typeof Bar; } -+>module : { Bar: typeof Bar; } - >exports : typeof Bar +->exports : typeof Bar ++>module.exports : typeof import("/index") ++>module : { "/index": typeof import("/index"); } ++>exports : typeof import("/index") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff index 64af18c39c..12b8945fb0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff @@ -1,11 +1,14 @@ --- old.javascriptCommonjsModule.types +++ new.javascriptCommonjsModule.types -@@= skipped -10, +10 lines =@@ +@@= skipped -9, +9 lines =@@ + module.exports = Bar; >module.exports = Bar : typeof Bar - >module.exports : typeof Bar +->module.exports : typeof Bar ->module : { exports: typeof Bar; } -+>module : { Bar: typeof Bar; } - >exports : typeof Bar +->exports : typeof Bar ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff index d0bf7f0d06..2bbedd477a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff @@ -1,16 +1,19 @@ --- old.javascriptImportDefaultBadExport.types +++ new.javascriptImportDefaultBadExport.types -@@= skipped -7, +7 lines =@@ +@@= skipped -6, +6 lines =@@ + module.exports = alias; >module.exports = alias : {} - >module.exports : {} +->module.exports : {} ->module : { exports: {}; } -+>module : { readonly alias: {}; } - >exports : {} +->exports : {} ++>module.exports : typeof import("/a") ++>module : { "/a": typeof import("/a"); } ++>exports : typeof import("/a") >alias : {} === /b.js === import a from "./a"; ->a : any -+>a : {} ++>a : typeof import("/a") diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff index 2779b86f3a..c36a59c495 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff @@ -46,8 +46,8 @@ + +module.exports = y; +>module.exports = y : { y: string; } -+>module.exports : { y: string; } -+>module : { y: { y: string; }; } -+>exports : { y: string; } ++>module.exports : typeof import("/node_modules/shortid/index") ++>module : { "/node_modules/shortid/index": typeof import("/node_modules/shortid/index"); } ++>exports : typeof import("/node_modules/shortid/index") +>y : { y: string; } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff index ed70bdbb43..c899ec8ec6 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff @@ -4,7 +4,7 @@ - @@= skipped --1, +1 lines =@@ +a.js(3,12): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+a.js(4,5): error TS1231: An export assignment must be at the top level of a file or module declaration. ++a.js(4,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. + + +==== a.js (2 errors) ==== @@ -15,6 +15,6 @@ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + module.exports = fn; + ~~~~~~ -+!!! error TS1231: An export assignment must be at the top level of a file or module declaration. ++!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff index 0654ff4e61..8d7a73094b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff @@ -1,22 +1,31 @@ --- old.truthinessCallExpressionCoercion4.types +++ new.truthinessCallExpressionCoercion4.types -@@= skipped -7, +7 lines =@@ - >typeof module === 'object' && module.exports : false | (() => void) +@@= skipped -4, +4 lines =@@ + >fn : () => void + + if (typeof module === 'object' && module.exports) { +->typeof module === 'object' && module.exports : false | (() => void) ++>typeof module === 'object' && module.exports : false | (typeof import("a")) >typeof module === 'object' : boolean >typeof module : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->module : { exports: () => void; } +>module : any >'object' : "object" - >module.exports : () => void +->module.exports : () => void ->module : { exports: () => void; } -+>module : { fn: () => void; } - >exports : () => void +->exports : () => void ++>module.exports : typeof import("a") ++>module : { "a": typeof import("a"); } ++>exports : typeof import("a") module.exports = fn; >module.exports = fn : () => void - >module.exports : () => void +->module.exports : () => void ->module : { exports: () => void; } -+>module : { fn: () => void; } - >exports : () => void +->exports : () => void ++>module.exports : typeof import("a") ++>module : { "a": typeof import("a"); } ++>exports : typeof import("a") >fn : () => void } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff index c3a4614698..ca88235c5e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff @@ -1,11 +1,14 @@ --- old.binderUninitializedModuleExportsAssignment.types +++ new.binderUninitializedModuleExportsAssignment.types -@@= skipped -11, +11 lines =@@ +@@= skipped -10, +10 lines =@@ + module.exports = loop2; >module.exports = loop2 : any - >module.exports : any +->module.exports : any ->module : { exports: any; } -+>module : { loop2: any; } - >exports : any +->exports : any ++>module.exports : typeof import("loop") ++>module : { "loop": typeof import("loop"); } ++>exports : typeof import("loop") >loop2 : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff index 00ec21d7b4..22dc9b535a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. ++use.js(1,30): error TS2694: Namespace '"mod1"' has no exported member 'Con'. + + +==== mod1.js (0 errors) ==== @@ -19,7 +19,7 @@ +==== use.js (1 errors) ==== + /** @param {import('./mod1').Con} k */ + ~~~ -+!!! error TS2694: Namespace 'C' has no exported member 'Con'. ++!!! error TS2694: Namespace '"mod1"' has no exported member 'Con'. + function f(k) { + if (1 === 2 - 1) { + // I guess basic math works! diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff index 49bec7cbe0..78033159b8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff @@ -10,9 +10,9 @@ ->exports : typeof C ->C : typeof C +>module.exports = C : () => void -+>module.exports : () => void -+>module : { C: () => void; } -+>exports : () => void ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") +>C : () => void function C() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff index 037be55ee5..c5626d8267 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff @@ -5,7 +5,7 @@ import Person = require("./mod1"); ->Person : typeof Person -+>Person : (name: string) => void ++>Person : typeof import("mod1") const m1 = new Person("Name") ->m1 : Person @@ -13,7 +13,7 @@ ->Person : typeof Person +>m1 : any +>new Person("Name") : any -+>Person : (name: string) => void ++>Person : typeof import("mod1") >"Name" : "Name" m1.thing; @@ -252,8 +252,8 @@ ->exports : typeof Person ->Person : typeof Person +>module.exports = Person : (name: string) => void -+>module.exports : (name: string) => void -+>module : { Person: (name: string) => void; } -+>exports : (name: string) => void ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") +>Person : (name: string) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff index 57a2edd65c..09a4de67cb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff @@ -8,19 +8,19 @@ +index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. +index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. +index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. -+validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. -+validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. -+validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. -+validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. -+validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. -+validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. -+validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. -+validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. -+validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. -+validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. -+validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. -+validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. -+validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ++validate.ts(3,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. ++validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. ++validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. ++validate.ts(6,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. ++validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. ++validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. ++validate.ts(10,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. ++validate.ts(11,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. ++validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. ++validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. ++validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. ++validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. ++validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. -==== validate.ts (4 errors) ==== @@ -29,50 +29,50 @@ import x = require("./"); x.name; + ~~~~ -+!!! error TS2339: Property 'name' does not exist on type '{}'. ++!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. x.middleInit; + ~~~~~~~~~~ -+!!! error TS2339: Property 'middleInit' does not exist on type '{}'. ++!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. x.lastName; + ~~~~~~~~ -+!!! error TS2339: Property 'lastName' does not exist on type '{}'. ++!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. x.zip; + ~~~ -+!!! error TS2339: Property 'zip' does not exist on type '{}'. ++!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. x.houseNumber; + ~~~~~~~~~~~ -+!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. ++!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. x.zipStr; + ~~~~~~ -+!!! error TS2339: Property 'zipStr' does not exist on type '{}'. ++!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. x.name = "Another"; + ~~~~ -+!!! error TS2339: Property 'name' does not exist on type '{}'. ++!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. x.zip = 98123; + ~~~ -+!!! error TS2339: Property 'zip' does not exist on type '{}'. ++!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. x.zipStr = "OK"; + ~~~~~~ -+!!! error TS2339: Property 'zipStr' does not exist on type '{}'. ++!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. x.lastName = "should fail"; ~~~~~~~~ -!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. -+!!! error TS2339: Property 'lastName' does not exist on type '{}'. ++!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. x.houseNumber = 12; // should also fail ~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. -+!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. ++!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. x.zipStr = 12; // should fail - ~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~~ -+!!! error TS2339: Property 'zipStr' does not exist on type '{}'. ++!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. x.middleInit = "R"; // should also fail ~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. -+!!! error TS2339: Property 'middleInit' does not exist on type '{}'. ++!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. -==== index.js (0 errors) ==== +==== index.js (3 errors) ==== diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff index 536c926ed7..2dc25ce197 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff @@ -5,14 +5,14 @@ // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); ->x : typeof x -+>x : {} ++>x : typeof import("index") x.name; ->x.name : string ->x : typeof x ->name : string +>x.name : any -+>x : {} ++>x : typeof import("index") +>name : any x.middleInit; @@ -20,7 +20,7 @@ ->x : typeof x ->middleInit : string +>x.middleInit : any -+>x : {} ++>x : typeof import("index") +>middleInit : any x.lastName; @@ -28,7 +28,7 @@ ->x : typeof x ->lastName : string +>x.lastName : any -+>x : {} ++>x : typeof import("index") +>lastName : any x.zip; @@ -36,7 +36,7 @@ ->x : typeof x ->zip : number +>x.zip : any -+>x : {} ++>x : typeof import("index") +>zip : any x.houseNumber; @@ -44,7 +44,7 @@ ->x : typeof x ->houseNumber : number +>x.houseNumber : any -+>x : {} ++>x : typeof import("index") +>houseNumber : any x.zipStr; @@ -52,7 +52,7 @@ ->x : typeof x ->zipStr : string +>x.zipStr : any -+>x : {} ++>x : typeof import("index") +>zipStr : any x.name = "Another"; @@ -61,7 +61,7 @@ ->x : typeof x ->name : string +>x.name : any -+>x : {} ++>x : typeof import("index") +>name : any >"Another" : "Another" @@ -71,7 +71,7 @@ ->x : typeof x ->zip : number +>x.zip : any -+>x : {} ++>x : typeof import("index") +>zip : any >98123 : 98123 @@ -81,7 +81,7 @@ ->x : typeof x ->zipStr : string +>x.zipStr : any -+>x : {} ++>x : typeof import("index") +>zipStr : any >"OK" : "OK" @@ -89,7 +89,7 @@ >x.lastName = "should fail" : "should fail" >x.lastName : any ->x : typeof x -+>x : {} ++>x : typeof import("index") >lastName : any >"should fail" : "should fail" @@ -97,7 +97,7 @@ >x.houseNumber = 12 : 12 >x.houseNumber : any ->x : typeof x -+>x : {} ++>x : typeof import("index") >houseNumber : any >12 : 12 @@ -107,7 +107,7 @@ ->x : typeof x ->zipStr : string +>x.zipStr : any -+>x : {} ++>x : typeof import("index") +>zipStr : any >12 : 12 @@ -115,7 +115,7 @@ >x.middleInit = "R" : "R" >x.middleInit : any ->x : typeof x -+>x : {} ++>x : typeof import("index") >middleInit : any >"R" : "R" @@ -302,8 +302,8 @@ ->exports : typeof x ->x : typeof x +>module.exports = x : {} -+>module.exports : {} -+>module : { readonly x: {}; } -+>exports : {} ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") +>x : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff index 87bcea7dd6..cda92b2776 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff @@ -1,15 +1,22 @@ --- old.commonJSImportClassTypeReference.types +++ new.commonJSImportClassTypeReference.types -@@= skipped -12, +12 lines =@@ - >k : K +@@= skipped -8, +8 lines =@@ + + /** @param {K} k */ + function f(k) { +->f : (k: K) => void +->k : K ++>f : (k: any) => void ++>k : any k.values() ->k.values() : K ->k.values : () => K +->k : K +->values : () => K +>k.values() : any +>k.values : any - >k : K -->values : () => K ++>k : any +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff index 1708ced17a..98fc873ed2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff @@ -1,15 +1,22 @@ --- old.commonJSImportExportedClassExpression.types +++ new.commonJSImportExportedClassExpression.types -@@= skipped -12, +12 lines =@@ - >k : K +@@= skipped -8, +8 lines =@@ + + /** @param {K} k */ + function f(k) { +->f : (k: K) => void +->k : K ++>f : (k: any) => void ++>k : any k.values() ->k.values() : void ->k.values : () => void +->k : K +->values : () => void +>k.values() : any +>k.values : any - >k : K -->values : () => void ++>k : any +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff index 85e59ebc64..d65801bf37 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff @@ -9,16 +9,22 @@ >require("./mod1") : typeof import("mod1") >require : any >"./mod1" : "./mod1" -@@= skipped -11, +11 lines =@@ - >k : K + + /** @param {K} k */ + function f(k) { +->f : (k: K) => void +->k : K ++>f : (k: any) => void ++>k : any k.values() ->k.values() : K ->k.values : () => K +->k : K +->values : () => K +>k.values() : any +>k.values : any - >k : K -->values : () => K ++>k : any +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff index 70e1af57c6..5815f96d85 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff @@ -6,8 +6,8 @@ const A = require("./other"); ->A : typeof A ->require("./other") : typeof A -+>A : () => void -+>require("./other") : () => void ++>A : typeof import("other") ++>require("./other") : typeof import("other") >require : (id: string) => any >"./other" : "./other" @@ -20,7 +20,7 @@ +>a : any +>new A().id : any +>new A() : any -+>A : () => void ++>A : typeof import("other") +>id : any const B = function() { this.id = 1; } @@ -95,8 +95,8 @@ ->exports : typeof A ->A : typeof A +>module.exports = A : () => void -+>module.exports : () => void -+>module : { A: () => void; } -+>exports : () => void ++>module.exports : typeof import("other") ++>module : { "other": typeof import("other"); } ++>exports : typeof import("other") +>A : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff index 005b72b658..0fa0617ad8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff @@ -20,7 +20,7 @@ /** @type {TestEnum} */ const tist = TestEnum.ADD ->tist : string -+>tist : TestEnum ++>tist : any >TestEnum.ADD : string >TestEnum : { ADD: string; REMOVE: string; } >ADD : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff index d2908b162b..4553b54340 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff @@ -1,18 +1,24 @@ --- old.exportNamespace_js.errors.txt +++ new.exportNamespace_js.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -b.js(1,1): error TS8006: 'export type' declarations can only be used in TypeScript files. - c.js(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. - - - ==== a.js (0 errors) ==== - export class A {} - +-c.js(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +- +- +-==== a.js (0 errors) ==== +- export class A {} +- -==== b.js (1 errors) ==== -+==== b.js (0 errors) ==== - export type * from './a'; +- export type * from './a'; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8006: 'export type' declarations can only be used in TypeScript files. - - ==== c.js (1 errors) ==== - import { A } from './b'; +- +-==== c.js (1 errors) ==== +- import { A } from './b'; +- A; +- ~ +-!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +-!!! related TS1377 b.js:1:1: 'A' was exported here. +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff index b829425316..70b52732ef 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff @@ -14,7 +14,7 @@ /** @type {MyEnum} */ const v = MyEnum.b; ->v : number -+>v : MyEnum ++>v : any >MyEnum.b : number >MyEnum : { a: number; b: number; } >b : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff index 5c4fda6af4..9bc6a7864c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff @@ -1,18 +1,21 @@ --- old.importAliasModuleExports.types +++ new.importAliasModuleExports.types -@@= skipped -10, +10 lines =@@ +@@= skipped -9, +9 lines =@@ + } module.exports = Alias; >module.exports = Alias : typeof Alias - >module.exports : typeof Alias +->module.exports : typeof Alias ->module : { exports: typeof Alias; } -+>module : { Alias: typeof Alias; } - >exports : typeof Alias +->exports : typeof Alias ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") >Alias : typeof Alias === main.js === import A from './mod1' ->A : typeof A -+>A : typeof Alias ++>A : typeof import("mod1") A.prototype.foo = 0 >A.prototype.foo = 0 : 0 @@ -21,7 +24,7 @@ ->A : typeof A ->prototype : A +>A.prototype : Alias -+>A : typeof Alias ++>A : typeof import("mod1") +>prototype : Alias >foo : any >0 : 0 @@ -33,7 +36,7 @@ ->A : typeof A ->prototype : A +>A.prototype : Alias -+>A : typeof Alias ++>A : typeof import("mod1") +>prototype : Alias >func : any >function() { this._func = 0; } : () => void @@ -54,19 +57,19 @@ ->A : typeof A ->prototype : A +>A.prototype : Alias -+>A : typeof Alias ++>A : typeof import("mod1") +>prototype : Alias >"def" : "def" >{ value: 0 } : { value: number; } >value : number -@@= skipped -46, +46 lines =@@ +@@= skipped -47, +47 lines =@@ new A().bar >new A().bar : () => number ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof Alias ++>A : typeof import("mod1") >bar : () => number new A().foo @@ -74,7 +77,7 @@ ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof Alias ++>A : typeof import("mod1") >foo : any new A().func() @@ -83,7 +86,7 @@ ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof Alias ++>A : typeof import("mod1") >func : any new A().def @@ -91,6 +94,6 @@ ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof Alias ++>A : typeof import("mod1") >def : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff index 436bf89b0c..fb5e6001f8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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(7,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. + + -+==== cls.js (2 errors) ==== ++==== cls.js (1 errors) ==== + const Bar = require("./bar"); + const Strings = { + a: "A", @@ -15,11 +14,10 @@ + }; + class Foo extends Bar {} + module.exports = Foo; -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. ++!!! related TS2728 cls.js:8:1: 'Strings' is declared here. + module.exports.Strings = Strings; -+ ~~~~~~~ -+!!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. +==== bar.js (0 errors) ==== + class Bar {} + module.exports = Bar; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff index f746697ab2..84459584da 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff @@ -1,34 +1,49 @@ --- old.jsDeclarationsClassExtendsVisibility.types +++ new.jsDeclarationsClassExtendsVisibility.types -@@= skipped -26, +26 lines =@@ +@@= skipped -1, +1 lines =@@ + + === cls.js === + const Bar = require("./bar"); +->Bar : typeof Bar +->require("./bar") : typeof Bar ++>Bar : typeof import("bar") ++>require("./bar") : typeof import("bar") + >require : any + >"./bar" : "./bar" + +@@= skipped -24, +24 lines =@@ + module.exports = Foo; >module.exports = Foo : typeof Foo - >module.exports : typeof Foo +->module.exports : typeof Foo ->module : { exports: typeof Foo; } -+>module : { Foo: typeof Foo; } - >exports : typeof Foo +->exports : typeof Foo ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } -->module.exports.Strings : { a: string; b: string; } -+>module.exports.Strings : any - >module.exports : typeof Foo + >module.exports.Strings : { a: string; b: string; } +->module.exports : typeof Foo ->module : { exports: typeof Foo; } -+>module : { Foo: typeof Foo; } - >exports : typeof Foo -+>Strings : any +->exports : typeof Foo ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") + >Strings : { a: string; b: string; } >Strings : { a: string; b: string; } -->Strings : { a: string; b: string; } - === bar.js === - class Bar {} @@= skipped -20, +20 lines =@@ + module.exports = Bar; >module.exports = Bar : typeof Bar - >module.exports : typeof Bar +->module.exports : typeof Bar ->module : { exports: typeof Bar; } -+>module : { Bar: typeof Bar; } - >exports : typeof Bar +->exports : typeof Bar ++>module.exports : typeof import("bar") ++>module : { "bar": typeof import("bar"); } ++>exports : typeof import("bar") >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff index 9f95f0d97c..eb9599af8f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff @@ -4,11 +4,10 @@ - @@= skipped --1, +1 lines =@@ +source.js(9,9): error TS2339: Property 'statische' does not exist on type 'typeof Handler'. -+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(15,1): error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. + + -+==== source.js (3 errors) ==== ++==== source.js (2 errors) ==== + class Handler { + static get OPTIONS() { + return 1; @@ -26,11 +25,10 @@ + } + + module.exports = Handler; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. ++!!! related TS2728 source.js:16:1: 'Strings' is declared here. + module.exports.Strings = Strings -+ ~~~~~~~ -+!!! error TS2339: Property 'Strings' does not exist on type 'typeof Handler'. + + /** + * @typedef {Object} HandlerOptions diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff index 36ebdcaf64..fbe113ce26 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff @@ -12,26 +12,27 @@ >function() { } : () => void const Strings = { -@@= skipped -21, +21 lines =@@ +@@= skipped -20, +20 lines =@@ + module.exports = Handler; >module.exports = Handler : typeof Handler - >module.exports : typeof Handler +->module.exports : typeof Handler ->module : { exports: typeof Handler; } -+>module : { Handler: typeof Handler; } - >exports : typeof Handler +->exports : typeof Handler ++>module.exports : typeof import("source") ++>module : { "source": typeof import("source"); } ++>exports : typeof import("source") >Handler : typeof Handler module.exports.Strings = Strings >module.exports.Strings = Strings : { a: string; b: string; } -->module.exports.Strings : { a: string; b: string; } -+>module.exports.Strings : any - >module.exports : typeof Handler + >module.exports.Strings : { a: string; b: string; } +->module.exports : typeof Handler ->module : { exports: typeof Handler; } -+>module : { Handler: typeof Handler; } - >exports : typeof Handler -+>Strings : any +->exports : typeof Handler ++>module.exports : typeof import("source") ++>module : { "source": typeof import("source"); } ++>exports : typeof import("source") + >Strings : { a: string; b: string; } >Strings : { a: string; b: string; } -->Strings : { a: string; b: string; } - /** - * @typedef {Object} HandlerOptions diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff index 3831550e5e..164288147d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff @@ -1,12 +1,15 @@ --- old.jsDeclarationsExportAssignedVisibility.types +++ new.jsDeclarationsExportAssignedVisibility.types -@@= skipped -23, +23 lines =@@ +@@= skipped -22, +22 lines =@@ + module.exports = Container; >module.exports = Container : typeof Container - >module.exports : typeof Container +->module.exports : typeof Container ->module : { exports: typeof Container; } -+>module : { Container: typeof Container; } - >exports : typeof Container +->exports : typeof Container ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") >Container : typeof Container === obj.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff index b930780c3b..195444d3b5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff @@ -70,9 +70,9 @@ ->exports : typeof ns ->ns : typeof ns +>module.exports = ns : typeof import("cls") -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") ++>module.exports : typeof import("cjs2") ++>module : { "cjs2": typeof import("cjs2"); } ++>exports : typeof import("cjs2") +>ns : typeof import("cls") === cjs3.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff index 6f997b9cdc..4497e8d133 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff @@ -23,9 +23,9 @@ ->exports : any ->ns : typeof ns +>module.exports = ns : typeof import("cls") -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") ++>module.exports : typeof import("bin") ++>module : { "bin": typeof import("bin"); } ++>exports : typeof import("bin") +>ns : typeof import("cls") === globalNs.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff index 4f0c0ca156..c85f2fda80 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff @@ -3,19 +3,17 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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(6,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. + + -+==== 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. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. ++!!! related TS2728 cls.js:7:1: 'Strings' is declared here. + module.exports.Strings = Strings; -+ ~~~~~~~ -+!!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff index 1289987dca..8f82395b6e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff @@ -1,23 +1,26 @@ --- old.jsDeclarationsExportSubAssignments.types +++ new.jsDeclarationsExportSubAssignments.types -@@= skipped -19, +19 lines =@@ +@@= skipped -18, +18 lines =@@ + module.exports = Foo; >module.exports = Foo : typeof Foo - >module.exports : typeof Foo +->module.exports : typeof Foo ->module : { exports: typeof Foo; } -+>module : { Foo: typeof Foo; } - >exports : typeof Foo +->exports : typeof Foo ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } -->module.exports.Strings : { a: string; b: string; } -+>module.exports.Strings : any - >module.exports : typeof Foo + >module.exports.Strings : { a: string; b: string; } +->module.exports : typeof Foo ->module : { exports: typeof Foo; } -+>module : { Foo: typeof Foo; } - >exports : typeof Foo -+>Strings : any +->exports : typeof Foo ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") + >Strings : { a: string; b: string; } >Strings : { a: string; b: string; } -->Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff index 6a9ada9701..4936aa1be8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff @@ -23,9 +23,9 @@ ->exports : typeof Timer ->Timer : typeof Timer +>module.exports = Timer : (timeout: number) => void -+>module.exports : (timeout: number) => void -+>module : { Timer: (timeout: number) => void; } -+>exports : (timeout: number) => void ++>module.exports : typeof import("timer") ++>module : { "timer": typeof import("timer"); } ++>exports : typeof import("timer") +>Timer : (timeout: number) => void === hook.js === @@ -53,9 +53,9 @@ ->exports : typeof Hook ->Hook : typeof Hook +>module.exports = Hook : (handle: HookHandler) => void -+>module.exports : (handle: HookHandler) => void -+>module : { Hook: (handle: HookHandler) => void; } -+>exports : (handle: HookHandler) => void ++>module.exports : typeof import("hook") ++>module : { "hook": typeof import("hook"); } ++>exports : typeof import("hook") +>Hook : (handle: HookHandler) => void === context.js === @@ -137,8 +137,8 @@ ->exports : { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; } ->Context : typeof Context +>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } -+>module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } -+>module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; }; } -+>exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>module.exports : typeof import("context") ++>module : { "context": typeof import("context"); } ++>exports : typeof import("context") +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff index a0d16ed5f0..bdb550f93f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff @@ -50,21 +50,32 @@ /** * @param {Point} p + */ + export function magnitude(p) { +->magnitude : (p: Point) => number +->p : Point ++>magnitude : (p: any) => number ++>p : any + + return Math.sqrt(p.x ** 2 + p.y ** 2); + >Math.sqrt(p.x ** 2 + p.y ** 2) : number @@= skipped -42, +42 lines =@@ >sqrt : (x: number) => number >p.x ** 2 + p.y ** 2 : number >p.x ** 2 : number ->p.x : number -+>p.x : any - >p : Point +->p : Point ->x : number ++>p.x : any ++>p : any +>x : any >2 : 2 >p.y ** 2 : number ->p.y : number -+>p.y : any - >p : Point +->p : Point ->y : number ++>p.y : any ++>p : any +>y : any >2 : 2 } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff index da667dfdb2..1db41d3143 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff @@ -10,9 +10,9 @@ ->exports : typeof MyClass ->MyClass : typeof MyClass +>module.exports = MyClass : { (): void; staticMethod: () => void; staticProperty: number; } -+>module.exports : { (): void; staticMethod: () => void; staticProperty: number; } -+>module : { MyClass: { (): void; staticMethod: () => void; staticProperty: number; }; } -+>exports : { (): void; staticMethod: () => void; staticProperty: number; } ++>module.exports : typeof import("source") ++>module : { "source": typeof import("source"); } ++>exports : typeof import("source") +>MyClass : { (): void; staticMethod: () => void; staticProperty: number; } function MyClass() {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff index 4e77a5275a..bc92d8edca 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff @@ -38,8 +38,8 @@ ->exports : typeof foo ->foo : typeof foo +>module.exports = foo : { (): void; foo: ???; default: ???; } -+>module.exports : { (): void; foo: ???; default: ???; } -+>module : { foo: { (): void; foo: ???; default: ???; }; } -+>exports : { (): void; foo: ???; default: ???; } ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") +>foo : { (): void; foo: ???; default: ???; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff index 66da7cbb1d..381a0f86f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff @@ -9,21 +9,23 @@ >{x: 12} : { x: number; } >x : number >12 : 12 -@@= skipped -8, +8 lines =@@ + module.exports = x; >module.exports = x : { x: number; } - >module.exports : { x: number; } +->module.exports : { x: number; } ->module : { exports: { x: number; }; } -+>module : { readonly x: { x: number; }; } - >exports : { x: number; } +->exports : { x: number; } ->x : Item ++>module.exports : typeof import("folder/mod1") ++>module : { "folder/mod1": typeof import("folder/mod1"); } ++>exports : typeof import("folder/mod1") +>x : { x: number; } === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : import("folder/mod1").Item[] -+>items : { x: number; }[] ++>items : typeof import("folder/mod1")[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number @@ -35,9 +37,9 @@ ->module : { exports: import("folder/mod1").Item[]; } ->exports : import("folder/mod1").Item[] ->items : import("folder/mod1").Item[] -+>module.exports = items : { x: number; }[] -+>module.exports : { x: number; }[] -+>module : { readonly items: { x: number; }[]; } -+>exports : { x: number; }[] -+>items : { x: number; }[] ++>module.exports = items : typeof import("folder/mod1")[] ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") ++>items : typeof import("folder/mod1")[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff index f58fad341b..6700f08bbd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff @@ -1,11 +1,15 @@ --- old.jsDeclarationsJson.types +++ new.jsDeclarationsJson.types -@@= skipped -9, +9 lines =@@ +@@= skipped -8, +8 lines =@@ + module.exports = j; >module.exports = j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } - >module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +->module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module : { exports: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } -+>module : { export=: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } - >exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +->exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") >j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } + === obj.json === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff index 716a901433..8ced3907de 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff @@ -1,11 +1,15 @@ --- old.jsDeclarationsPackageJson.types +++ new.jsDeclarationsPackageJson.types -@@= skipped -9, +9 lines =@@ +@@= skipped -8, +8 lines =@@ + module.exports = j; >module.exports = j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } - >module.exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } +->module.exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } ->module : { exports: { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; }; } -+>module : { export=: { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; }; } - >exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } +->exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") >j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } + === package.json === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff index 0e89ce5575..337e1446a2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +file.js(1,15): error TS1340: Module './base' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./base')'? + + -+==== base.js (1 errors) ==== ++==== base.js (0 errors) ==== + class Base { + constructor() {} + } @@ -19,8 +18,6 @@ + BaseFactory.Base = Base; + + module.exports = BaseFactory; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + +==== file.js (1 errors) ==== + /** @typedef {import('./base')} BaseFactory */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff index 74ace1313c..d826883a61 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff @@ -1,15 +1,19 @@ --- old.jsDeclarationsParameterTagReusesInputNodeInEmit1.types +++ new.jsDeclarationsParameterTagReusesInputNodeInEmit1.types -@@= skipped -26, +26 lines =@@ +@@= skipped -25, +25 lines =@@ + module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } - >module.exports : { (): Base; Base: typeof Base; } +->module.exports : { (): Base; Base: typeof Base; } ->module : { exports: { (): Base; Base: typeof Base; }; } -+>module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } - >exports : { (): Base; Base: typeof Base; } +->exports : { (): Base; Base: typeof Base; } ++>module.exports : typeof import("base") ++>module : { "base": typeof import("base"); } ++>exports : typeof import("base") >BaseFactory : { (): Base; Base: typeof Base; } -@@= skipped -21, +21 lines =@@ + === file.js === +@@= skipped -22, +22 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff deleted file mode 100644 index 6c777dd16e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt -+++ new.jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -+ -+ -+==== base.js (1 errors) ==== -+ class Base { -+ constructor() {} -+ } -+ -+ const BaseFactory = () => { -+ return new Base(); -+ }; -+ -+ BaseFactory.Base = Base; -+ -+ module.exports = BaseFactory; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -+ -+==== file.js (0 errors) ==== -+ /** @typedef {typeof import('./base')} BaseFactory */ -+ -+ /** -+ * -+ * @param {InstanceType} base -+ * @returns {InstanceType} -+ */ -+ const test = (base) => { -+ return base; -+ }; -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff index 4404d4fa58..a5fb9ebdb5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff @@ -1,15 +1,19 @@ --- old.jsDeclarationsParameterTagReusesInputNodeInEmit2.types +++ new.jsDeclarationsParameterTagReusesInputNodeInEmit2.types -@@= skipped -26, +26 lines =@@ +@@= skipped -25, +25 lines =@@ + module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } - >module.exports : { (): Base; Base: typeof Base; } +->module.exports : { (): Base; Base: typeof Base; } ->module : { exports: { (): Base; Base: typeof Base; }; } -+>module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } - >exports : { (): Base; Base: typeof Base; } +->exports : { (): Base; Base: typeof Base; } ++>module.exports : typeof import("base") ++>module : { "base": typeof import("base"); } ++>exports : typeof import("base") >BaseFactory : { (): Base; Base: typeof Base; } -@@= skipped -13, +13 lines =@@ + === file.js === +@@= skipped -14, +14 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff index 9a2661c062..e99bf4ee2d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff @@ -1,20 +1,23 @@ --- old.jsDeclarationsReexportAliasesEsModuleInterop.types +++ new.jsDeclarationsReexportAliasesEsModuleInterop.types -@@= skipped -6, +6 lines =@@ +@@= skipped -5, +5 lines =@@ + module.exports = Foo; >module.exports = Foo : typeof Foo - >module.exports : typeof Foo +->module.exports : typeof Foo ->module : { exports: typeof Foo; } -+>module : { Foo: typeof Foo; } - >exports : typeof Foo +->exports : typeof Foo ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") >Foo : typeof Foo === usage.js === import {default as Fooa} from "./cls"; ->default : typeof Fooa ->Fooa : typeof Fooa -+>default : typeof Foo -+>Fooa : typeof Foo ++>default : typeof import("cls") ++>Fooa : typeof import("cls") export const x = new Fooa(); ->x : Fooa @@ -22,11 +25,11 @@ ->Fooa : typeof Fooa +>x : Foo +>new Fooa() : Foo -+>Fooa : typeof Foo ++>Fooa : typeof import("cls") export {default as Foob} from "./cls"; ->default : typeof Fooa ->Foob : typeof Fooa -+>default : typeof Foo -+>Foob : typeof Foo ++>default : typeof import("cls") ++>Foob : typeof import("cls") diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff index 58686a8ded..c2ae83db00 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff @@ -15,11 +15,11 @@ render.addRectangle(); ->render.addRectangle() : import("rectangle").Rectangle ->render.addRectangle : () => import("rectangle").Rectangle -+>render.addRectangle() : Rectangle -+>render.addRectangle : () => Rectangle ++>render.addRectangle() : any ++>render.addRectangle : () => any >render : Render ->addRectangle : () => import("rectangle").Rectangle -+>addRectangle : () => Rectangle ++>addRectangle : () => any console.log("Objects", render.objects); >console.log("Objects", render.objects) : void @@ -70,7 +70,16 @@ >[] : undefined[] } /** -@@= skipped -19, +19 lines =@@ +@@= skipped -11, +11 lines =@@ + * @returns {Rectangle} the rect + */ + addRectangle() { +->addRectangle : () => Rectangle ++>addRectangle : () => any + + const obj = new Rectangle(); + >obj : Rectangle +@@= skipped -8, +8 lines =@@ >Rectangle : typeof Rectangle this.objects.push(obj); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff index 33db5def84..535344ed3b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff @@ -1,11 +1,14 @@ --- old.jsDeclarationsTypeReassignmentFromDeclaration.types +++ new.jsDeclarationsTypeReassignmentFromDeclaration.types -@@= skipped -19, +19 lines =@@ +@@= skipped -18, +18 lines =@@ + module.exports = items; >module.exports = items : Item[] - >module.exports : Item[] +->module.exports : Item[] ->module : { exports: Item[]; } -+>module : { readonly items: Item[]; } - >exports : Item[] +->exports : Item[] ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") >items : Item[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff index 96e75d15e0..45f9a66f89 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff @@ -20,9 +20,9 @@ ->exports : Item[] ->items : Item[] +>module.exports = items : any -+>module.exports : any -+>module : { readonly items: any; } -+>exports : any ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") +>items : any === some-mod.d.ts === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff index 486a0fd3c3..c8a9665c91 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff @@ -1,15 +1,19 @@ --- old.jsDeclarationsTypedefAndImportTypes.types +++ new.jsDeclarationsTypedefAndImportTypes.types -@@= skipped -19, +19 lines =@@ +@@= skipped -18, +18 lines =@@ + module.exports = Conn; >module.exports = Conn : typeof Conn - >module.exports : typeof Conn +->module.exports : typeof Conn ->module : { exports: typeof Conn; } -+>module : { Conn: typeof Conn; } - >exports : typeof Conn +->exports : typeof Conn ++>module.exports : typeof import("conn") ++>module : { "conn": typeof import("conn"); } ++>exports : typeof import("conn") >Conn : typeof Conn -@@= skipped -16, +16 lines =@@ + === usage.js === +@@= skipped -17, +17 lines =@@ * @param {Conn} c */ constructor(c) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff index d966bec7bd..fad1efb89a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff @@ -1,6 +1,17 @@ --- old.jsDeclarationsTypedefAndLatebound.types +++ new.jsDeclarationsTypedefAndLatebound.types -@@= skipped -32, +32 lines =@@ +@@= skipped -1, +1 lines =@@ + + === index.js === + const LazySet = require("./LazySet"); +->LazySet : typeof LazySet +->require("./LazySet") : typeof LazySet ++>LazySet : typeof import("LazySet") ++>require("./LazySet") : typeof import("LazySet") + >require : any + >"./LazySet" : "./LazySet" + +@@= skipped -31, +31 lines =@@ */ addAll(iterable) {} >addAll : (iterable: LazySet) => void @@ -9,12 +20,15 @@ [Symbol.iterator]() {} >[Symbol.iterator] : () => void -@@= skipped -12, +12 lines =@@ +@@= skipped -11, +11 lines =@@ + module.exports = LazySet; >module.exports = LazySet : typeof LazySet - >module.exports : typeof LazySet +->module.exports : typeof LazySet ->module : { exports: typeof LazySet; } -+>module : { LazySet: typeof LazySet; } - >exports : typeof LazySet +->exports : typeof LazySet ++>module.exports : typeof import("LazySet") ++>module : { "LazySet": typeof import("LazySet"); } ++>exports : typeof import("LazySet") >LazySet : typeof LazySet diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index ac237ffaed..e52de4e3ee 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -24,12 +24,15 @@ module.exports = MainThreadTasks; >module.exports = MainThreadTasks : typeof MainThreadTasks - >module.exports : typeof MainThreadTasks +->module.exports : typeof MainThreadTasks ->module : { exports: typeof MainThreadTasks; } -+>module : { MainThreadTasks: typeof MainThreadTasks; } - >exports : typeof MainThreadTasks +->exports : typeof MainThreadTasks ++>module.exports : typeof import("index") ++>module : { "index": typeof import("index"); } ++>exports : typeof import("index") >MainThreadTasks : typeof MainThreadTasks + === module.js === @@= skipped -25, +25 lines =@@ * @type {{[P in TaskGroupIds]: {id: P, label: string}}} */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff index e8fd4b4a33..49ec350cc9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff @@ -18,8 +18,8 @@ const D = require("./mod1"); ->D : typeof D ->require("./mod1") : typeof D -+>D : typeof Chunk -+>require("./mod1") : typeof Chunk ++>D : typeof import("mod1") ++>require("./mod1") : typeof import("mod1") >require : (name: string) => any >"./mod1" : "./mod1" @@ -38,12 +38,15 @@ === types.d.ts === declare function require(name: string): any; -@@= skipped -51, +51 lines =@@ +@@= skipped -50, +50 lines =@@ + } module.exports = Chunk; >module.exports = Chunk : typeof Chunk - >module.exports : typeof Chunk +->module.exports : typeof Chunk ->module : { exports: typeof Chunk; } -+>module : { Chunk: typeof Chunk; } - >exports : typeof Chunk +->exports : typeof Chunk ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") >Chunk : typeof Chunk diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff index 63eba2591e..9ec9ff7521 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff @@ -1,6 +1,16 @@ --- old.jsdocTypeReferenceToImportOfClassExpression.types +++ new.jsdocTypeReferenceToImportOfClassExpression.types -@@= skipped -9, +9 lines =@@ +@@= skipped -1, +1 lines =@@ + + === MC.js === + const MW = require("./MW"); +->MW : typeof MW +->require("./MW") : typeof MW ++>MW : typeof import("MW") ++>require("./MW") : typeof import("MW") + >require : any + >"./MW" : "./MW" + /** @typedef {number} Cictema */ module.exports = class MC { @@ -19,7 +29,15 @@ watch() { >watch : () => MW -@@= skipped -27, +27 lines =@@ + + return new MW(this); + >new MW(this) : MW +->MW : typeof MW ++>MW : typeof import("MW") + >this : this + } + }; +@@= skipped -35, +35 lines =@@ * @param {MC} compiler the compiler */ constructor(compiler) { @@ -39,9 +57,11 @@ module.exports = MW; >module.exports = MW : typeof MW - >module.exports : typeof MW +->module.exports : typeof MW ->module : { exports: typeof MW; } -+>module : { MW: typeof MW; } - >exports : typeof MW +->exports : typeof MW ++>module.exports : typeof import("MW") ++>module : { "MW": typeof import("MW"); } ++>exports : typeof import("MW") >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff index 94dd3dc913..1c05597744 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff @@ -1,6 +1,17 @@ --- old.jsdocTypeReferenceToImportOfFunctionExpression.types +++ new.jsdocTypeReferenceToImportOfFunctionExpression.types -@@= skipped -10, +10 lines =@@ +@@= skipped -1, +1 lines =@@ + + === MC.js === + const MW = require("./MW"); +->MW : typeof MW +->require("./MW") : typeof MW ++>MW : typeof import("MW") ++>require("./MW") : typeof import("MW") + >require : any + >"./MW" : "./MW" + +@@= skipped -9, +9 lines =@@ /** @class */ module.exports = function MC() { @@ -19,7 +30,16 @@ /** @type {any} */ var x = {} -@@= skipped -29, +29 lines =@@ +@@= skipped -14, +14 lines =@@ + + return new MW(x); + >new MW(x) : MW +->MW : typeof MW ++>MW : typeof import("MW") + >x : any + + }; +@@= skipped -15, +15 lines =@@ * @param {MC} compiler the compiler */ constructor(compiler) { @@ -39,9 +59,11 @@ module.exports = MW; >module.exports = MW : typeof MW - >module.exports : typeof MW +->module.exports : typeof MW ->module : { exports: typeof MW; } -+>module : { MW: typeof MW; } - >exports : typeof MW +->exports : typeof MW ++>module.exports : typeof import("MW") ++>module : { "MW": typeof import("MW"); } ++>exports : typeof import("MW") >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff index ae5c12ff25..7d38f2bbca 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff @@ -3,19 +3,25 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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,1): error TS2349: This expression is not callable. ++ Type '{}' has no call signatures. ++Eloquent.js(5,1): error TS1233: An export declaration can only be used at the top level of a namespace or module. + + +==== Eloquent.js (2 errors) ==== + // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript + (function() { ++ ~~~~~~~~~~~~~ + exports.bigOak = 1 ++ ~~~~~~~~~~~~~~~~~~ + exports.everywhere = 2 ++ ~~~~~~~~~~~~~~~~~~~~~~ + 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. ++ ~~~~~~ ++!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. + })() ++ ~~ ++!!! error TS2349: This expression is not callable. ++!!! error TS2349: Type '{}' has no call signatures. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff index c4a00470eb..c956394d25 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff @@ -1,6 +1,19 @@ --- old.moduleExportAliasExports.types +++ new.moduleExportAliasExports.types -@@= skipped -23, +23 lines =@@ +@@= skipped -2, +2 lines =@@ + === Eloquent.js === + // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript + (function() { +->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : void +->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : () => void +->function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : () => void ++>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : any ++>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : {} ++>function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : {} + + exports.bigOak = 1 + >exports.bigOak = 1 : 1 +@@= skipped -21, +21 lines =@@ module.exports = exports >module.exports = exports : typeof import("Eloquent") >module.exports : typeof import("Eloquent") diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff index a70a1cd90d..2e9c60442b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff @@ -3,21 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+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,1): error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. + + -+==== bug28014.js (3 errors) ==== ++==== bug28014.js (1 errors) ==== + exports.version = 1 -+ ~~~~~~~ -+!!! error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. + function alias() { } + 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. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. ++!!! related TS2728 bug28014.js:1:1: 'version' is declared here. + +==== importer.js (0 errors) ==== + import('./bug28014') diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff index 296dd3626d..cf14e58294 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff @@ -1,15 +1,12 @@ --- old.moduleExportAliasImported.types +++ new.moduleExportAliasImported.types -@@= skipped -2, +2 lines =@@ - === bug28014.js === +@@= skipped -3, +3 lines =@@ exports.version = 1 >exports.version = 1 : 1 -->exports.version : 1 + >exports.version : 1 ->exports : typeof alias -->version : 1 -+>exports.version : any +>exports : typeof import("bug28014") -+>version : any + >version : 1 >1 : 1 function alias() { } @@ -23,14 +20,14 @@ ->exports : typeof alias ->alias : typeof alias +>module.exports = alias : () => void -+>module.exports : () => void -+>module : { alias: () => void; } -+>exports : () => void ++>module.exports : typeof import("bug28014") ++>module : { "bug28014": typeof import("bug28014"); } ++>exports : typeof import("bug28014") +>alias : () => void === importer.js === import('./bug28014') ->import('./bug28014') : Promise<{ (): void; version: 1; }> -+>import('./bug28014') : Promise<() => void> ++>import('./bug28014') : Promise >'./bug28014' : "./bug28014" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff index 6df2407fde..014c649410 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff @@ -3,11 +3,10 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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(9,1): error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. + + -+==== axios.js (2 errors) ==== ++==== axios.js (1 errors) ==== + class Axios { + constructor() { + } @@ -17,9 +16,8 @@ + // 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. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. ++!!! related TS2728 axios.js:10:1: 'default' is declared here. + module.exports.default = axios; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'Axios'. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff index d01eaabcb1..6ac69a12b3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff @@ -9,22 +9,20 @@ ->module : { exports: { m(): void; default: Axios; }; } ->exports : { m(): void; default: Axios; } +>module.exports = axios : Axios -+>module.exports : Axios -+>module : { axios: Axios; } -+>exports : Axios ++>module.exports : typeof import("axios") ++>module : { "axios": typeof import("axios"); } ++>exports : typeof import("axios") >axios : Axios module.exports.default = axios; >module.exports.default = axios : Axios -->module.exports.default : Axios + >module.exports.default : Axios ->module.exports : { m(): void; default: Axios; } ->module : { exports: { m(): void; default: Axios; }; } ->exports : { m(): void; default: Axios; } -->default : Axios -+>module.exports.default : any -+>module.exports : Axios -+>module : { axios: Axios; } -+>exports : Axios -+>default : any ++>module.exports : typeof import("axios") ++>module : { "axios": typeof import("axios"); } ++>exports : typeof import("axios") + >default : Axios >axios : Axios diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff index 7792808c23..355666c74f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff @@ -3,16 +3,14 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 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,1): error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. + + -+==== 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. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. ++!!! related TS2728 axios.js:3:1: 'default' is declared here. + module.exports.default = axios -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '{}'. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff index d9bbf26cbb..cb698e7d60 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff @@ -15,9 +15,9 @@ ->exports : typeof axios ->axios : typeof axios +>module.exports = axios : {} -+>module.exports : {} -+>module : { axios: {}; } -+>exports : {} ++>module.exports : typeof import("axios") ++>module : { "axios": typeof import("axios"); } ++>exports : typeof import("axios") +>axios : {} module.exports.default = axios @@ -29,10 +29,10 @@ ->default : typeof axios ->axios : typeof axios +>module.exports.default = axios : {} -+>module.exports.default : any -+>module.exports : {} -+>module : { axios: {}; } -+>exports : {} -+>default : any ++>module.exports.default : {} ++>module.exports : typeof import("axios") ++>module : { "axios": typeof import("axios"); } ++>exports : typeof import("axios") ++>default : {} +>axios : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff index 45be2a7d6b..0b6b7554f5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff @@ -9,38 +9,35 @@ -mod1.js(4,1): error TS2323: Cannot redeclare exported variable 'bothBefore'. -mod1.js(5,1): error TS2323: Cannot redeclare exported variable 'bothAfter'. -mod1.js(10,1): error TS2323: Cannot redeclare exported variable 'bothAfter'. -+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; }'. ++a.js(4,17): error TS2339: Property 'toFixed' does not exist on type '"string"'. ++a.js(5,16): error TS2339: Property 'toFixed' does not exist on type '"string"'. ++mod1.js(6,1): error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. --==== a.js (2 errors) ==== -+==== a.js (1 errors) ==== - /// - var mod1 = require('./mod1') + ==== a.js (2 errors) ==== +@@= skipped -13, +8 lines =@@ mod1.justExport.toFixed() mod1.bothBefore.toFixed() // error -- ~~~~~~~ + ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. ++!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.bothAfter.toFixed() -- ~~~~~~~ + ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. ++!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.justProperty.length -+ ~~~~~~~~~~~~ -+!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ==== 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 (1 errors) ==== /// module.exports.bothBefore = 'string' - ~~~~~~~~~~~~~~~~~~~~~~~~~ +- ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothBefore'. -+!!! error TS2322: Type 'string' is not assignable to type 'number'. A.justExport = 4 A.bothBefore = 2 - ~~~~~~~~~~~~ @@ -49,16 +46,14 @@ - ~~~~~~~~~~~ -!!! 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. ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. ++!!! related TS2728 mod1.js:11:1: 'justProperty' is declared here. function A() { this.p = 1 } module.exports.bothAfter = 'string' - ~~~~~~~~~~~~~~~~~~~~~~~~ +- ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. -+!!! error TS2322: Type 'string' is not assignable to type 'number'. module.exports.justProperty = 'string' -+ ~~~~~~~~~~~~ -+!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff index 23d0e8f7a9..5fc12d4da7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff @@ -6,8 +6,8 @@ var mod1 = require('./mod1') ->mod1 : typeof mod1 ->require('./mod1') : typeof mod1 -+>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>mod1 : typeof import("mod1") ++>require('./mod1') : typeof import("mod1") >require : (name: string) => any >'./mod1' : "./mod1" @@ -16,52 +16,40 @@ >mod1.justExport.toFixed : (fractionDigits?: number) => string >mod1.justExport : number ->mod1 : typeof mod1 -+>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>mod1 : typeof import("mod1") >justExport : number >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error -->mod1.bothBefore.toFixed() : any -->mod1.bothBefore.toFixed : any + >mod1.bothBefore.toFixed() : any + >mod1.bothBefore.toFixed : any ->mod1.bothBefore : number | "string" ->mod1 : typeof mod1 ->bothBefore : number | "string" -->toFixed : any -+>mod1.bothBefore.toFixed() : string -+>mod1.bothBefore.toFixed : (fractionDigits?: number) => string -+>mod1.bothBefore : number -+>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>bothBefore : number -+>toFixed : (fractionDigits?: number) => string ++>mod1.bothBefore : "string" ++>mod1 : typeof import("mod1") ++>bothBefore : "string" + >toFixed : any mod1.bothAfter.toFixed() -->mod1.bothAfter.toFixed() : any -->mod1.bothAfter.toFixed : any + >mod1.bothAfter.toFixed() : any + >mod1.bothAfter.toFixed : any ->mod1.bothAfter : number | "string" ->mod1 : typeof mod1 ->bothAfter : number | "string" -->toFixed : any -+>mod1.bothAfter.toFixed() : string -+>mod1.bothAfter.toFixed : (fractionDigits?: number) => string -+>mod1.bothAfter : number -+>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>bothAfter : number -+>toFixed : (fractionDigits?: number) => string ++>mod1.bothAfter : "string" ++>mod1 : typeof import("mod1") ++>bothAfter : "string" + >toFixed : any mod1.justProperty.length -->mod1.justProperty.length : number -->mod1.justProperty : "string" + >mod1.justProperty.length : number + >mod1.justProperty : "string" ->mod1 : typeof mod1 -->justProperty : "string" -->length : number -+>mod1.justProperty.length : any -+>mod1.justProperty : any -+>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>justProperty : any -+>length : any ++>mod1 : typeof import("mod1") + >justProperty : "string" + >length : number - === requires.d.ts === - declare var module: { exports: any }; @@= skipped -40, +40 lines =@@ /// module.exports.bothBefore = 'string' @@ -71,11 +59,11 @@ ->module : { exports: typeof A; } ->exports : typeof A ->bothBefore : number | "string" -+>module.exports.bothBefore : number -+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } -+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>bothBefore : number ++>module.exports.bothBefore : "string" ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") ++>bothBefore : "string" >'string' : "string" A.justExport = 4 @@ -113,9 +101,9 @@ ->exports : typeof A ->A : typeof A +>module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } -+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } function A() { @@ -137,24 +125,22 @@ ->module : { exports: typeof A; } ->exports : typeof A ->bothAfter : number | "string" -+>module.exports.bothAfter : number -+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } -+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>bothAfter : number ++>module.exports.bothAfter : "string" ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") ++>bothAfter : "string" >'string' : "string" module.exports.justProperty = 'string' >module.exports.justProperty = 'string' : "string" -->module.exports.justProperty : "string" + >module.exports.justProperty : "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A -->justProperty : "string" -+>module.exports.justProperty : any -+>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } -+>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>justProperty : any ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") + >justProperty : "string" >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff index 2dac119c36..b5770b0e92 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff @@ -2,7 +2,6 @@ +++ new.nodeModulesAllowJsExportAssignment(module=node16).errors.txt @@= skipped -0, +0 lines =@@ -file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. @@ -28,15 +27,14 @@ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ~~~~~~~~~~~ -!!! error TS8003: 'export =' can only be used in TypeScript files. - ==== file.js (1 errors) ==== +-==== file.js (1 errors) ==== ++==== file.js (0 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff index e2f961ea64..44f7ca9d8e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff @@ -1,15 +1,19 @@ --- old.nodeModulesAllowJsExportAssignment(module=node16).types +++ new.nodeModulesAllowJsExportAssignment(module=node16).types -@@= skipped -17, +17 lines =@@ +@@= skipped -16, +16 lines =@@ + module.exports = a; >module.exports = a : {} - >module.exports : {} +->module.exports : {} ->module : { exports: {}; } -+>module : { readonly a: {}; } - >exports : {} +->exports : {} ++>module.exports : typeof import("subfolder/file") ++>module : { "subfolder/file": typeof import("subfolder/file"); } ++>exports : typeof import("subfolder/file") >a : {} -@@= skipped -21, +21 lines =@@ + === index.js === +@@= skipped -22, +22 lines =@@ >{} : {} module.exports = a; @@ -18,8 +22,8 @@ ->module : any ->exports : any +>module.exports = a : {} -+>module.exports : {} -+>module : { readonly a: {}; } -+>exports : {} ++>module.exports : typeof import("file") ++>module : { "file": typeof import("file"); } ++>exports : typeof import("file") >a : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff index a3ea3773fb..93db0ab644 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff @@ -2,7 +2,6 @@ +++ new.nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. @@ -28,15 +27,14 @@ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ~~~~~~~~~~~ -!!! error TS8003: 'export =' can only be used in TypeScript files. - ==== file.js (1 errors) ==== +-==== file.js (1 errors) ==== ++==== file.js (0 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff index 542c8c9c7b..488e7dab60 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff @@ -1,15 +1,19 @@ --- old.nodeModulesAllowJsExportAssignment(module=nodenext).types +++ new.nodeModulesAllowJsExportAssignment(module=nodenext).types -@@= skipped -17, +17 lines =@@ +@@= skipped -16, +16 lines =@@ + module.exports = a; >module.exports = a : {} - >module.exports : {} +->module.exports : {} ->module : { exports: {}; } -+>module : { readonly a: {}; } - >exports : {} +->exports : {} ++>module.exports : typeof import("subfolder/file") ++>module : { "subfolder/file": typeof import("subfolder/file"); } ++>exports : typeof import("subfolder/file") >a : {} -@@= skipped -21, +21 lines =@@ + === index.js === +@@= skipped -22, +22 lines =@@ >{} : {} module.exports = a; @@ -18,8 +22,8 @@ ->module : any ->exports : any +>module.exports = a : {} -+>module.exports : {} -+>module : { readonly a: {}; } -+>exports : {} ++>module.exports : typeof import("file") ++>module : { "file": typeof import("file"); } ++>exports : typeof import("file") >a : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff index 73a750af67..bce6d38de8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff @@ -31,26 +31,35 @@ >require("./a-ext") : typeof import("a-ext") >require : (id: string) => any >"./a-ext" : "./a-ext" -@@= skipped -9, +9 lines =@@ + + /** @param {A} p */ function a(p) { p.x; } - >a : (p: A) => void - >p : A +->a : (p: A) => void +->p : A ->p.x : number -+>p.x : any - >p : A +->p : A ->x : number ++>a : (p: any) => void ++>p : any ++>p.x : any ++>p : any +>x : any === b-ext.js === exports.B = class { -@@= skipped -33, +33 lines =@@ +@@= skipped -40, +40 lines =@@ + + /** @param {B} p */ function b(p) { p.x; } - >b : (p: B) => void - >p : B +->b : (p: B) => void +->p : B ->p.x : number -+>p.x : any - >p : B +->p : B ->x : number ++>b : (p: any) => void ++>p : any ++>p.x : any ++>p : any +>x : any === c-ext.js === @@ -74,14 +83,18 @@ >require("./c-ext") : typeof import("c-ext") >require : (id: string) => any >"./c-ext" : "./c-ext" -@@= skipped -27, +27 lines =@@ + + /** @param {C} p */ function c(p) { p.x; } - >c : (p: C) => void - >p : C +->c : (p: C) => void +->p : C ->p.x : number -+>p.x : any - >p : C +->p : C ->x : number ++>c : (p: any) => void ++>p : any ++>p.x : any ++>p : any +>x : any === d-ext.js === @@ -99,7 +112,7 @@ >x : any >1 : 1 -@@= skipped -20, +20 lines =@@ +@@= skipped -49, +49 lines =@@ === d.js === const { D } = require("./d-ext"); @@ -108,19 +121,23 @@ >require("./d-ext") : typeof import("d-ext") >require : (id: string) => any >"./d-ext" : "./d-ext" -@@= skipped -9, +9 lines =@@ + + /** @param {D} p */ function d(p) { p.x; } - >d : (p: D) => void - >p : D +->d : (p: D) => void +->p : D ->p.x : number -+>p.x : any - >p : D +->p : D ->x : number ++>d : (p: any) => void ++>p : any ++>p.x : any ++>p : any +>x : any === e-ext.js === export class E { -@@= skipped -29, +29 lines =@@ +@@= skipped -38, +38 lines =@@ function e(p) { p.x; } >e : (p: E) => void >p : E diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff index 07106b9f41..e049d82c35 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff @@ -6,8 +6,8 @@ var mini = require('./minimatch') ->mini : typeof mini ->require('./minimatch') : typeof mini -+>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } -+>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>mini : typeof import("minimatch") ++>require('./minimatch') : typeof import("minimatch") >require : any >'./minimatch' : "./minimatch" @@ -18,7 +18,7 @@ ->mini : typeof mini ->M : typeof M +>mini.M : { (): void; defaults: (def: any) => any; } -+>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>mini : typeof import("minimatch") +>M : { (): void; defaults: (def: any) => any; } >defaults : (def: any) => any @@ -31,7 +31,7 @@ +>m : any +>new mini.M() : any +>mini.M : { (): void; defaults: (def: any) => any; } -+>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>mini : typeof import("minimatch") +>M : { (): void; defaults: (def: any) => any; } m.m() @@ -48,7 +48,7 @@ >mini.filter() : void >mini.filter : () => void ->mini : typeof mini -+>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>mini : typeof import("minimatch") >filter : () => void === types.d.ts === @@ -62,9 +62,9 @@ ->exports : typeof minimatch ->minimatch : typeof minimatch +>module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } -+>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } -+>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } -+>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>module.exports : typeof import("minimatch") ++>module : { "minimatch": typeof import("minimatch"); } ++>exports : typeof import("minimatch") +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } minimatch.M = M diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff index 30f0ff3b5f..3a087b89d8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff @@ -10,9 +10,9 @@ ->exports : typeof C ->C : typeof C +>module.exports = C : () => void -+>module.exports : () => void -+>module : { C: () => void; } -+>exports : () => void ++>module.exports : typeof import("mod1") ++>module : { "mod1": typeof import("mod1"); } ++>exports : typeof import("mod1") +>C : () => void function C() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index abe8829172..6694396202 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -11,10 +11,17 @@ +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; }'. ++use.js(4,12): error TS2503: Cannot find namespace 'mod'. - ==== use.js (0 errors) ==== -@@= skipped -11, +15 lines =@@ +-==== use.js (0 errors) ==== ++==== use.js (1 errors) ==== + var mod = require('./mod1.js'); + /** @type {import("./mod1.js").Baz} */ + var b; + /** @type {mod.Baz} */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); @@ -23,7 +30,7 @@ // error /** @typedef {number} Foo */ -@@= skipped -12, +12 lines =@@ +@@= skipped -23, +30 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index c6acb76186..6044b381cd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -11,7 +11,14 @@ >require : any >'./mod1.js' : "./mod1.js" -@@= skipped -17, +17 lines =@@ +@@= skipped -11, +11 lines =@@ + + /** @type {mod.Baz} */ + var bb; +->bb : number ++>bb : Baz + + var bbb = new mod.Baz(); >bbb : Baz >new mod.Baz() : Baz >mod.Baz : typeof Baz @@ -20,7 +27,7 @@ >Baz : typeof Baz === mod1.js === -@@= skipped -13, +13 lines =@@ +@@= skipped -19, +19 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } >exports.Bar = class { } : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff index 968f4002a1..beaba830fd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff @@ -25,9 +25,9 @@ ->exports : typeof ns ->ns : typeof ns +>module.exports = ns : {} -+>module.exports : {} -+>module : { readonly ns: {}; } -+>exports : {} ++>module.exports : typeof import("mod2") ++>module : { "mod2": typeof import("mod2"); } ++>exports : typeof import("mod2") +>ns : {} From 3c5ec1860de1e0d333bdd662c0c087b3bf8b11ad Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 16 May 2025 08:20:18 -0700 Subject: [PATCH 5/5] Revert "Add JSExportDeclaration" This reverts commit 1cffb6ec0ec1329f6eac0012b65dc7f1b7b48b56. --- internal/api/encoder/encoder.go | 4 +- internal/ast/ast.go | 22 +-- internal/ast/kind.go | 1 - internal/ast/kind_stringer_generated.go | 17 +-- internal/ast/utilities.go | 10 +- internal/binder/binder.go | 4 +- internal/binder/referenceresolver.go | 2 - internal/checker/checker.go | 137 ++++++------------ internal/checker/grammarchecks.go | 3 +- internal/checker/utilities.go | 2 +- internal/ls/utilities.go | 2 +- internal/parser/reparser.go | 6 +- internal/printer/namegenerator.go | 2 +- internal/printer/printer.go | 2 +- internal/transformers/typeeraser.go | 2 +- .../amdLikeInputDeclarationEmit.errors.txt | 11 +- .../amdLikeInputDeclarationEmit.types | 2 +- ...nmentDefineProperrtyPotentialMerge.symbols | 8 +- ...DefineProperrtyPotentialMerge.symbols.diff | 8 +- ...ignmentDefineProperrtyPotentialMerge.types | 16 +- ...Script(verbatimmodulesyntax=false).symbols | 4 +- ...t(verbatimmodulesyntax=false).symbols.diff | 4 +- ...vaScript(verbatimmodulesyntax=false).types | 6 +- ...aScript(verbatimmodulesyntax=true).symbols | 4 +- ...pt(verbatimmodulesyntax=true).symbols.diff | 4 +- ...avaScript(verbatimmodulesyntax=true).types | 6 +- .../compiler/javascriptCommonjsModule.symbols | 4 +- .../javascriptCommonjsModule.symbols.diff | 4 +- .../compiler/javascriptCommonjsModule.types | 6 +- .../javascriptImportDefaultBadExport.symbols | 4 +- ...ascriptImportDefaultBadExport.symbols.diff | 4 +- .../javascriptImportDefaultBadExport.types | 8 +- ...maxNodeModuleJsDepthDefaultsToZero.symbols | 4 +- ...deModuleJsDepthDefaultsToZero.symbols.diff | 4 +- .../maxNodeModuleJsDepthDefaultsToZero.types | 6 +- ...uthinessCallExpressionCoercion4.errors.txt | 4 +- .../truthinessCallExpressionCoercion4.symbols | 8 +- ...hinessCallExpressionCoercion4.symbols.diff | 8 +- .../truthinessCallExpressionCoercion4.types | 14 +- ...initializedModuleExportsAssignment.symbols | 4 +- ...alizedModuleExportsAssignment.symbols.diff | 4 +- ...UninitializedModuleExportsAssignment.types | 6 +- .../callbackCrossModule.errors.txt | 4 +- .../conformance/callbackCrossModule.symbols | 4 +- .../callbackCrossModule.symbols.diff | 4 +- .../conformance/callbackCrossModule.types | 6 +- ...portsObjectAssignPrototypeProperty.symbols | 4 +- ...ObjectAssignPrototypeProperty.symbols.diff | 4 +- ...ExportsObjectAssignPrototypeProperty.types | 10 +- .../checkObjectDefineProperty.errors.txt | 52 +++---- .../checkObjectDefineProperty.symbols | 4 +- .../checkObjectDefineProperty.symbols.diff | 4 +- .../checkObjectDefineProperty.types | 34 ++--- .../commonJSImportClassTypeReference.types | 6 +- ...ommonJSImportExportedClassExpression.types | 6 +- ...mmonJSImportNestedClassTypeReference.types | 6 +- .../conformance/constructorFunctions2.symbols | 4 +- .../constructorFunctions2.symbols.diff | 4 +- .../conformance/constructorFunctions2.types | 12 +- .../conformance/enumTagImported.types | 2 +- .../conformance/exportNamespace11.errors.txt | 14 ++ .../exportNamespace11.errors.txt.diff | 19 --- .../conformance/exportNamespace11.symbols | 2 - .../exportNamespace11.symbols.diff | 3 - .../conformance/exportNamespace11.types | 6 +- .../conformance/exportNamespace11.types.diff | 10 +- .../conformance/exportNamespace12.errors.txt | 20 +++ .../exportNamespace12.errors.txt.diff | 25 ---- .../conformance/exportNamespace12.js | 3 +- .../conformance/exportNamespace12.js.diff | 4 +- .../conformance/exportNamespace12.symbols | 2 - .../exportNamespace12.symbols.diff | 3 - .../conformance/exportNamespace12.types | 4 +- .../conformance/exportNamespace12.types.diff | 10 +- .../conformance/exportNamespace4.errors.txt | 6 +- .../exportNamespace4.errors.txt.diff | 21 --- .../submodule/conformance/exportNamespace4.js | 3 +- .../conformance/exportNamespace4.js.diff | 9 +- .../conformance/exportNamespace5.errors.txt | 34 +++++ .../exportNamespace5.errors.txt.diff | 39 ----- .../submodule/conformance/exportNamespace5.js | 4 +- .../conformance/exportNamespace5.js.diff | 4 +- .../conformance/exportNamespace6.errors.txt | 24 +++ .../exportNamespace6.errors.txt.diff | 29 ---- .../submodule/conformance/exportNamespace6.js | 5 +- .../conformance/exportNamespace6.js.diff | 5 +- .../conformance/exportNamespace7.errors.txt | 46 ++++++ .../exportNamespace7.errors.txt.diff | 51 ------- .../submodule/conformance/exportNamespace7.js | 11 +- .../conformance/exportNamespace7.js.diff | 11 +- .../conformance/exportNamespace8.errors.txt | 6 +- .../exportNamespace8.errors.txt.diff | 22 --- .../submodule/conformance/exportNamespace8.js | 2 +- .../conformance/exportNamespace8.js.diff | 2 +- .../conformance/exportNamespace_js.errors.txt | 16 ++ .../exportedEnumTypeAndValue.types | 2 +- .../importAliasModuleExports.symbols | 4 +- .../importAliasModuleExports.symbols.diff | 4 +- .../importAliasModuleExports.types | 22 +-- ...larationsClassExtendsVisibility.errors.txt | 12 +- ...DeclarationsClassExtendsVisibility.symbols | 14 +- ...rationsClassExtendsVisibility.symbols.diff | 19 +-- ...jsDeclarationsClassExtendsVisibility.types | 26 ++-- .../jsDeclarationsClassStatic.errors.txt | 12 +- .../jsDeclarationsClassStatic.symbols | 10 +- .../jsDeclarationsClassStatic.symbols.diff | 13 +- .../jsDeclarationsClassStatic.types | 16 +- ...clarationsExportAssignedVisibility.symbols | 4 +- ...tionsExportAssignedVisibility.symbols.diff | 4 +- ...DeclarationsExportAssignedVisibility.types | 6 +- .../jsDeclarationsExportForms.symbols | 4 +- .../jsDeclarationsExportForms.symbols.diff | 4 +- .../jsDeclarationsExportForms.types | 6 +- .../jsDeclarationsExportFormsErr.symbols | 4 +- .../jsDeclarationsExportFormsErr.symbols.diff | 4 +- .../jsDeclarationsExportFormsErr.types | 6 +- ...eclarationsExportSubAssignments.errors.txt | 14 +- ...jsDeclarationsExportSubAssignments.symbols | 10 +- ...larationsExportSubAssignments.symbols.diff | 12 +- .../jsDeclarationsExportSubAssignments.types | 16 +- ...FunctionClassesCjsExportAssignment.symbols | 12 +- ...ionClassesCjsExportAssignment.symbols.diff | 12 +- ...nsFunctionClassesCjsExportAssignment.types | 18 +-- .../jsDeclarationsFunctionLikeClasses.types | 8 +- ...eclarationsFunctionPrototypeStatic.symbols | 4 +- ...ationsFunctionPrototypeStatic.symbols.diff | 4 +- ...sDeclarationsFunctionPrototypeStatic.types | 6 +- ...sFunctionWithDefaultAssignedMember.symbols | 4 +- ...tionWithDefaultAssignedMember.symbols.diff | 4 +- ...onsFunctionWithDefaultAssignedMember.types | 6 +- .../jsDeclarationsImportTypeBundled.symbols | 8 +- ...DeclarationsImportTypeBundled.symbols.diff | 8 +- .../jsDeclarationsImportTypeBundled.types | 18 +-- .../conformance/jsDeclarationsJson.symbols | 4 +- .../jsDeclarationsJson.symbols.diff | 4 +- .../conformance/jsDeclarationsJson.types | 6 +- .../jsDeclarationsPackageJson.symbols | 4 +- .../jsDeclarationsPackageJson.symbols.diff | 4 +- .../jsDeclarationsPackageJson.types | 6 +- ...ameterTagReusesInputNodeInEmit1.errors.txt | 5 +- ...ParameterTagReusesInputNodeInEmit1.symbols | 4 +- ...eterTagReusesInputNodeInEmit1.symbols.diff | 4 +- ...nsParameterTagReusesInputNodeInEmit1.types | 6 +- ...ameterTagReusesInputNodeInEmit2.errors.txt | 30 ++++ ...ParameterTagReusesInputNodeInEmit2.symbols | 4 +- ...eterTagReusesInputNodeInEmit2.symbols.diff | 4 +- ...nsParameterTagReusesInputNodeInEmit2.types | 6 +- ...ionsReexportAliasesEsModuleInterop.symbols | 8 +- ...eexportAliasesEsModuleInterop.symbols.diff | 8 +- ...ationsReexportAliasesEsModuleInterop.types | 16 +- ...onsReferenceToClassInstanceCrossFile.types | 8 +- ...onsTypeReassignmentFromDeclaration.symbols | 4 +- ...peReassignmentFromDeclaration.symbols.diff | 4 +- ...tionsTypeReassignmentFromDeclaration.types | 6 +- ...nsTypeReassignmentFromDeclaration2.symbols | 4 +- ...eReassignmentFromDeclaration2.symbols.diff | 4 +- ...ionsTypeReassignmentFromDeclaration2.types | 6 +- ...sDeclarationsTypedefAndImportTypes.symbols | 4 +- ...arationsTypedefAndImportTypes.symbols.diff | 4 +- .../jsDeclarationsTypedefAndImportTypes.types | 6 +- .../jsDeclarationsTypedefAndLatebound.symbols | 4 +- ...clarationsTypedefAndLatebound.symbols.diff | 4 +- .../jsDeclarationsTypedefAndLatebound.types | 10 +- ...TypedefPropertyAndExportAssignment.symbols | 4 +- ...efPropertyAndExportAssignment.symbols.diff | 4 +- ...nsTypedefPropertyAndExportAssignment.types | 6 +- .../conformance/jsdocImportType.symbols | 4 +- .../conformance/jsdocImportType.symbols.diff | 4 +- .../conformance/jsdocImportType.types | 10 +- ...ReferenceToImportOfClassExpression.symbols | 4 +- ...enceToImportOfClassExpression.symbols.diff | 4 +- ...peReferenceToImportOfClassExpression.types | 12 +- ...erenceToImportOfFunctionExpression.symbols | 4 +- ...eToImportOfFunctionExpression.symbols.diff | 4 +- ...eferenceToImportOfFunctionExpression.types | 12 +- .../moduleExportAliasExports.errors.txt | 16 +- .../moduleExportAliasExports.types | 6 +- .../moduleExportAliasImported.errors.txt | 15 +- .../moduleExportAliasImported.symbols | 6 +- .../moduleExportAliasImported.symbols.diff | 11 +- .../moduleExportAliasImported.types | 12 +- .../moduleExportAssignment5.errors.txt | 12 +- .../moduleExportAssignment5.symbols | 10 +- .../moduleExportAssignment5.symbols.diff | 12 +- .../conformance/moduleExportAssignment5.types | 16 +- ...ExportPropertyAssignmentDefault.errors.txt | 12 +- ...uleExportPropertyAssignmentDefault.symbols | 10 +- ...portPropertyAssignmentDefault.symbols.diff | 12 +- ...oduleExportPropertyAssignmentDefault.types | 16 +- ...rtWithExportPropertyAssignment4.errors.txt | 29 ++-- ...xportWithExportPropertyAssignment4.symbols | 42 +++--- ...WithExportPropertyAssignment4.symbols.diff | 44 +++--- ...eExportWithExportPropertyAssignment4.types | 76 +++++----- ...ExportAssignment(module=node16).errors.txt | 5 +- ...wJsExportAssignment(module=node16).symbols | 8 +- ...portAssignment(module=node16).symbols.diff | 8 +- ...lowJsExportAssignment(module=node16).types | 12 +- ...portAssignment(module=nodenext).errors.txt | 5 +- ...sExportAssignment(module=nodenext).symbols | 8 +- ...rtAssignment(module=nodenext).symbols.diff | 8 +- ...wJsExportAssignment(module=nodenext).types | 12 +- .../typeFromParamTagForFunction.types | 24 +-- .../typeFromPropertyAssignment17.symbols | 4 +- .../typeFromPropertyAssignment17.symbols.diff | 4 +- .../typeFromPropertyAssignment17.types | 16 +- .../conformance/typedefCrossModule.symbols | 4 +- .../typedefCrossModule.symbols.diff | 4 +- .../conformance/typedefCrossModule.types | 6 +- .../typedefCrossModule2.errors.txt | 5 +- .../conformance/typedefCrossModule2.types | 2 +- .../conformance/typedefCrossModule3.symbols | 4 +- .../typedefCrossModule3.symbols.diff | 4 +- .../conformance/typedefCrossModule3.types | 6 +- ...mdLikeInputDeclarationEmit.errors.txt.diff | 11 +- .../amdLikeInputDeclarationEmit.types.diff | 2 +- ...ntDefineProperrtyPotentialMerge.types.diff | 16 +- ...ipt(verbatimmodulesyntax=false).types.diff | 11 +- ...ript(verbatimmodulesyntax=true).types.diff | 11 +- .../javascriptCommonjsModule.types.diff | 11 +- ...avascriptImportDefaultBadExport.types.diff | 13 +- ...NodeModuleJsDepthDefaultsToZero.types.diff | 6 +- ...essCallExpressionCoercion4.errors.txt.diff | 4 +- ...uthinessCallExpressionCoercion4.types.diff | 25 +--- ...tializedModuleExportsAssignment.types.diff | 11 +- .../callbackCrossModule.errors.txt.diff | 4 +- .../callbackCrossModule.types.diff | 6 +- ...tsObjectAssignPrototypeProperty.types.diff | 10 +- .../checkObjectDefineProperty.errors.txt.diff | 52 +++---- .../checkObjectDefineProperty.types.diff | 34 ++--- ...ommonJSImportClassTypeReference.types.diff | 15 +- ...JSImportExportedClassExpression.types.diff | 15 +- ...SImportNestedClassTypeReference.types.diff | 14 +- .../constructorFunctions2.types.diff | 12 +- .../conformance/enumTagImported.types.diff | 2 +- .../exportNamespace_js.errors.txt.diff | 30 ++-- .../exportedEnumTypeAndValue.types.diff | 2 +- .../importAliasModuleExports.types.diff | 29 ++-- ...ionsClassExtendsVisibility.errors.txt.diff | 12 +- ...larationsClassExtendsVisibility.types.diff | 47 ++---- .../jsDeclarationsClassStatic.errors.txt.diff | 12 +- .../jsDeclarationsClassStatic.types.diff | 27 ++-- ...rationsExportAssignedVisibility.types.diff | 11 +- .../jsDeclarationsExportForms.types.diff | 6 +- .../jsDeclarationsExportFormsErr.types.diff | 6 +- ...ationsExportSubAssignments.errors.txt.diff | 12 +- ...eclarationsExportSubAssignments.types.diff | 25 ++-- ...ctionClassesCjsExportAssignment.types.diff | 18 +-- ...DeclarationsFunctionLikeClasses.types.diff | 19 +-- ...arationsFunctionPrototypeStatic.types.diff | 6 +- ...nctionWithDefaultAssignedMember.types.diff | 6 +- ...jsDeclarationsImportTypeBundled.types.diff | 22 ++- .../conformance/jsDeclarationsJson.types.diff | 12 +- .../jsDeclarationsPackageJson.types.diff | 12 +- ...rTagReusesInputNodeInEmit1.errors.txt.diff | 5 +- ...ameterTagReusesInputNodeInEmit1.types.diff | 14 +- ...rTagReusesInputNodeInEmit2.errors.txt.diff | 35 +++++ ...ameterTagReusesInputNodeInEmit2.types.diff | 14 +- ...sReexportAliasesEsModuleInterop.types.diff | 21 ++- ...ferenceToClassInstanceCrossFile.types.diff | 17 +-- ...TypeReassignmentFromDeclaration.types.diff | 11 +- ...ypeReassignmentFromDeclaration2.types.diff | 6 +- ...clarationsTypedefAndImportTypes.types.diff | 14 +- ...DeclarationsTypedefAndLatebound.types.diff | 24 +-- ...edefPropertyAndExportAssignment.types.diff | 9 +- .../conformance/jsdocImportType.types.diff | 15 +- ...erenceToImportOfClassExpression.types.diff | 30 +--- ...nceToImportOfFunctionExpression.types.diff | 32 +--- .../moduleExportAliasExports.errors.txt.diff | 16 +- .../moduleExportAliasExports.types.diff | 15 +- .../moduleExportAliasImported.errors.txt.diff | 15 +- .../moduleExportAliasImported.types.diff | 17 ++- .../moduleExportAssignment5.errors.txt.diff | 12 +- .../moduleExportAssignment5.types.diff | 18 ++- ...tPropertyAssignmentDefault.errors.txt.diff | 12 +- ...ExportPropertyAssignmentDefault.types.diff | 16 +- ...hExportPropertyAssignment4.errors.txt.diff | 39 ++--- ...rtWithExportPropertyAssignment4.types.diff | 90 +++++++----- ...tAssignment(module=node16).errors.txt.diff | 6 +- ...ExportAssignment(module=node16).types.diff | 20 +-- ...ssignment(module=nodenext).errors.txt.diff | 6 +- ...portAssignment(module=nodenext).types.diff | 20 +-- .../typeFromParamTagForFunction.types.diff | 61 +++----- .../typeFromPropertyAssignment17.types.diff | 16 +- .../conformance/typedefCrossModule.types.diff | 6 +- .../typedefCrossModule2.errors.txt.diff | 13 +- .../typedefCrossModule2.types.diff | 11 +- .../typedefCrossModule3.types.diff | 6 +- 287 files changed, 1570 insertions(+), 1846 deletions(-) create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt create mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff diff --git a/internal/api/encoder/encoder.go b/internal/api/encoder/encoder.go index 9aaf947bd5..5a1502eba3 100644 --- a/internal/api/encoder/encoder.go +++ b/internal/api/encoder/encoder.go @@ -474,7 +474,7 @@ func getChildrenPropertyMask(node *ast.Node) uint8 { case ast.KindNamespaceExportDeclaration: n := node.AsNamespaceExportDeclaration() return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: n := node.AsExportDeclaration() return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.ExportClause != nil) << 1) | (boolToByte(n.ModuleSpecifier != nil) << 2) | (boolToByte(n.Attributes != nil) << 3) case ast.KindExportSpecifier: @@ -733,7 +733,7 @@ func getNodeDefinedData(node *ast.Node) uint32 { case ast.KindExportAssignment: n := node.AsExportAssignment() return uint32(boolToByte(n.IsExportEquals)) << 24 - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: n := node.AsExportDeclaration() return uint32(boolToByte(n.IsTypeOnly)) << 24 case ast.KindBlock: diff --git a/internal/ast/ast.go b/internal/ast/ast.go index a51a5ae96a..67f0afc4e3 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -753,7 +753,7 @@ func (n *Node) ModuleSpecifier() *Expression { switch n.Kind { case KindImportDeclaration: return n.AsImportDeclaration().ModuleSpecifier - case KindExportDeclaration, KindJSExportDeclaration: + case KindExportDeclaration: return n.AsExportDeclaration().ModuleSpecifier case KindJSDocImportTag: return n.AsJSDocImportTag().ModuleSpecifier @@ -4482,27 +4482,19 @@ type ExportDeclaration struct { Attributes *ImportAttributesNode // ImportAttributesNode. Optional } -func (f *NodeFactory) newExportOrJSExportDeclaration(kind Kind, modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { +func (f *NodeFactory) NewExportDeclaration(modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { data := &ExportDeclaration{} data.modifiers = modifiers data.IsTypeOnly = isTypeOnly data.ExportClause = exportClause data.ModuleSpecifier = moduleSpecifier data.Attributes = attributes - return f.newNode(kind, data) -} - -func (f *NodeFactory) NewExportDeclaration(modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { - return f.newExportOrJSExportDeclaration(KindExportDeclaration, modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) -} - -func (f *NodeFactory) NewJSExportDeclaration(moduleSpecifier *Expression) *Node { - return f.newExportOrJSExportDeclaration(KindJSExportDeclaration, nil /*modifiers*/, false /*isTypeOnly*/, nil /*exportClause*/, moduleSpecifier, nil /*attributes*/) + return f.newNode(KindExportDeclaration, data) } func (f *NodeFactory) UpdateExportDeclaration(node *ExportDeclaration, modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { if modifiers != node.modifiers || exportClause != node.ExportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes { - return updateNode(f.newExportOrJSExportDeclaration(node.Kind, modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node.AsNode(), f.hooks) + return updateNode(f.NewExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node.AsNode(), f.hooks) } return node.AsNode() } @@ -4516,7 +4508,7 @@ func (node *ExportDeclaration) VisitEachChild(v *NodeVisitor) *Node { } func (node *ExportDeclaration) Clone(f NodeFactoryCoercible) *Node { - return cloneNode(f.AsNodeFactory().newExportOrJSExportDeclaration(node.Kind, node.Modifiers(), node.IsTypeOnly, node.ExportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) + return cloneNode(f.AsNodeFactory().NewExportDeclaration(node.Modifiers(), node.IsTypeOnly, node.ExportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) } func (node *ExportDeclaration) computeSubtreeFacts() SubtreeFacts { @@ -4531,10 +4523,6 @@ func IsExportDeclaration(node *Node) bool { return node.Kind == KindExportDeclaration } -func IsJSExportDeclaration(node *Node) bool { - return node.Kind == KindJSExportDeclaration -} - // NamespaceExport type NamespaceExport struct { diff --git a/internal/ast/kind.go b/internal/ast/kind.go index 607d95af2a..3107c895bd 100644 --- a/internal/ast/kind.go +++ b/internal/ast/kind.go @@ -380,7 +380,6 @@ const ( // Reparsed JS nodes KindJSTypeAliasDeclaration KindJSExportAssignment - KindJSExportDeclaration KindCommonJSExport // Transformation nodes KindNotEmittedStatement diff --git a/internal/ast/kind_stringer_generated.go b/internal/ast/kind_stringer_generated.go index 73f47085ea..329adfa55d 100644 --- a/internal/ast/kind_stringer_generated.go +++ b/internal/ast/kind_stringer_generated.go @@ -355,18 +355,17 @@ func _() { _ = x[KindSyntaxList-344] _ = x[KindJSTypeAliasDeclaration-345] _ = x[KindJSExportAssignment-346] - _ = x[KindJSExportDeclaration-347] - _ = x[KindCommonJSExport-348] - _ = x[KindNotEmittedStatement-349] - _ = x[KindPartiallyEmittedExpression-350] - _ = x[KindCommaListExpression-351] - _ = x[KindSyntheticReferenceExpression-352] - _ = x[KindCount-353] + _ = x[KindCommonJSExport-347] + _ = x[KindNotEmittedStatement-348] + _ = x[KindPartiallyEmittedExpression-349] + _ = x[KindCommaListExpression-350] + _ = x[KindSyntheticReferenceExpression-351] + _ = x[KindCount-352] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindJSExportDeclarationKindCommonJSExportKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindCommonJSExportKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6596, 6618, 6641, 6659, 6682, 6712, 6735, 6767, 6776} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3141, 3165, 3182, 3195, 3208, 3229, 3252, 3271, 3292, 3323, 3338, 3353, 3368, 3385, 3407, 3425, 3442, 3459, 3475, 3494, 3507, 3522, 3535, 3548, 3564, 3576, 3589, 3609, 3628, 3641, 3662, 3674, 3690, 3711, 3725, 3740, 3760, 3783, 3810, 3824, 3848, 3871, 3889, 3915, 3942, 3970, 3997, 4015, 4032, 4060, 4087, 4114, 4136, 4153, 4173, 4193, 4211, 4230, 4255, 4281, 4301, 4326, 4348, 4367, 4384, 4403, 4424, 4455, 4471, 4492, 4508, 4531, 4554, 4570, 4595, 4604, 4622, 4643, 4666, 4681, 4696, 4714, 4730, 4748, 4766, 4787, 4805, 4824, 4841, 4860, 4880, 4898, 4914, 4935, 4958, 4985, 5008, 5028, 5052, 5076, 5095, 5116, 5131, 5144, 5174, 5201, 5222, 5238, 5257, 5273, 5292, 5312, 5333, 5349, 5368, 5387, 5409, 5436, 5450, 5475, 5496, 5517, 5532, 5554, 5576, 5592, 5609, 5631, 5648, 5669, 5683, 5700, 5718, 5733, 5753, 5772, 5794, 5825, 5845, 5859, 5873, 5883, 5906, 5928, 5947, 5963, 5984, 6008, 6029, 6050, 6059, 6072, 6092, 6110, 6123, 6140, 6158, 6170, 6190, 6212, 6234, 6252, 6271, 6292, 6312, 6332, 6352, 6372, 6393, 6411, 6427, 6443, 6463, 6482, 6497, 6517, 6538, 6556, 6570, 6596, 6618, 6636, 6659, 6689, 6712, 6744, 6753} func (i Kind) String() string { if i < 0 || i >= Kind(len(_Kind_index)-1) { diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index ebc345633c..ffe9baee60 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -648,7 +648,6 @@ func isDeclarationStatementKind(kind Kind) bool { KindImportDeclaration, KindImportEqualsDeclaration, KindExportDeclaration, - KindJSExportDeclaration, KindExportAssignment, KindJSExportAssignment, KindNamespaceExportDeclaration: @@ -1678,7 +1677,7 @@ func GetExternalModuleName(node *Node) *Expression { switch node.Kind { case KindImportDeclaration: return node.AsImportDeclaration().ModuleSpecifier - case KindExportDeclaration, KindJSExportDeclaration: + case KindExportDeclaration: return node.AsExportDeclaration().ModuleSpecifier case KindJSDocImportTag: return node.AsJSDocImportTag().ModuleSpecifier @@ -1704,7 +1703,7 @@ func GetImportAttributes(node *Node) *Node { switch node.Kind { case KindImportDeclaration: return node.AsImportDeclaration().Attributes - case KindExportDeclaration, KindJSExportDeclaration: + case KindExportDeclaration: return node.AsExportDeclaration().Attributes } panic("Unhandled case in getImportAttributes") @@ -2056,8 +2055,7 @@ func GetMeaningFromDeclaration(node *Node) SemanticMeaning { KindImportDeclaration, KindExportAssignment, KindJSExportAssignment, - KindExportDeclaration, - KindJSExportDeclaration: + KindExportDeclaration: return SemanticMeaningAll // An external module can be a Value @@ -2348,7 +2346,7 @@ func GetNamespaceDeclarationNode(node *Node) *Node { } case KindImportEqualsDeclaration: return node - case KindExportDeclaration, KindJSExportDeclaration: + case KindExportDeclaration: exportClause := node.AsExportDeclaration().ExportClause if exportClause != nil && IsNamespaceExport(exportClause) { return exportClause diff --git a/internal/binder/binder.go b/internal/binder/binder.go index e9eb9e9ccf..90fe6ffb7a 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -376,7 +376,7 @@ func (b *Binder) getDeclarationName(node *ast.Node) string { return ast.InternalSymbolNameNew case ast.KindIndexSignature: return ast.InternalSymbolNameIndex - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: return ast.InternalSymbolNameExportStar case ast.KindSourceFile: return ast.InternalSymbolNameExportEquals @@ -728,7 +728,7 @@ func (b *Binder) bind(node *ast.Node) bool { b.bindNamespaceExportDeclaration(node) case ast.KindImportClause: b.bindImportClause(node) - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: b.bindExportDeclaration(node) case ast.KindExportAssignment, ast.KindJSExportAssignment: b.bindExportAssignment(node) diff --git a/internal/binder/referenceresolver.go b/internal/binder/referenceresolver.go index 8adae57ba7..8fbe5297e3 100644 --- a/internal/binder/referenceresolver.go +++ b/internal/binder/referenceresolver.go @@ -112,8 +112,6 @@ func (r *referenceResolver) isTypeOnlyAliasDeclaration(symbol *ast.Symbol) bool switch node.Kind { case ast.KindImportEqualsDeclaration, ast.KindExportDeclaration: return node.IsTypeOnly() - case ast.KindJSExportDeclaration: - return false case ast.KindImportClause, ast.KindImportSpecifier, ast.KindExportSpecifier: if node.IsTypeOnly() { return true diff --git a/internal/checker/checker.go b/internal/checker/checker.go index f0554a930b..eeb7cc8859 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -2209,7 +2209,7 @@ func (c *Checker) checkSourceElementWorker(node *ast.Node) { c.checkImportDeclaration(node) case ast.KindImportEqualsDeclaration: c.checkImportEqualsDeclaration(node) - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: c.checkExportDeclaration(node) case ast.KindExportAssignment, ast.KindJSExportAssignment: c.checkExportAssignment(node) @@ -4890,7 +4890,7 @@ func (c *Checker) checkModuleAugmentationElement(node *ast.Node) { for _, decl := range node.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { c.checkModuleAugmentationElement(decl) } - case ast.KindExportAssignment, ast.KindJSExportAssignment, ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportAssignment, ast.KindJSExportAssignment, ast.KindExportDeclaration: c.grammarErrorOnFirstToken(node, diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations) case ast.KindImportEqualsDeclaration: // import a = e.x; in module augmentation is ok, but not import a = require('fs) @@ -4963,9 +4963,6 @@ func (c *Checker) checkExternalImportOrExportDeclaration(node *ast.Node) bool { // Should be a parse error. return false } - if node.Kind == ast.KindJSExportDeclaration { - return true - } if !ast.IsStringLiteral(moduleName) { c.error(moduleName, diagnostics.String_literal_expected) return false @@ -5081,7 +5078,7 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { func isExclusivelyTypeOnlyImportOrExport(node *ast.Node) bool { switch node.Kind { - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: return node.AsExportDeclaration().IsTypeOnly case ast.KindImportDeclaration: if importClause := node.AsImportDeclaration().ImportClause; importClause != nil { @@ -5175,9 +5172,6 @@ func (c *Checker) checkExportDeclaration(node *ast.Node) { if !ast.IsSourceFile(node.Parent) && !inAmbientExternalModule && !inAmbientNamespaceDeclaration { c.error(node, diagnostics.Export_declarations_are_not_permitted_in_a_namespace) } - } else if node.Kind == ast.KindJSExportDeclaration { - // export * from foo, reparsed from `module.exports = foo` - // TODO: Nothing to check that I can think of } else { // export * from "foo" // export * as ns from "foo"; @@ -13624,7 +13618,7 @@ func (c *Checker) getTargetOfImportEqualsDeclaration(node *ast.Node, dontResolve moduleReference = getExternalModuleImportEqualsDeclarationExpression(node) } immediate := c.resolveExternalModuleName(node, moduleReference, false /*ignoreErrors*/) - resolved := c.resolveExternalModuleSymbol(immediate, false /*dontResolveAlias*/) + resolved := c.resolveExternalModuleSymbol(immediate, dontResolveAlias) c.markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false /*overwriteEmpty*/, nil, "") return resolved } @@ -13669,7 +13663,7 @@ func (c *Checker) checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(nod decl := node.AsImportEqualsDeclaration() if c.markSymbolOfAliasDeclarationIfTypeOnly(node, nil /*immediateTarget*/, resolved, false /*overwriteEmpty*/, nil, "") && !decl.IsTypeOnly { typeOnlyDeclaration := c.getTypeOnlyAliasDeclaration(c.getSymbolOfDeclaration(node)) - isExport := ast.NodeKindIs(typeOnlyDeclaration, ast.KindExportSpecifier, ast.KindExportDeclaration, ast.KindJSExportDeclaration) + isExport := ast.NodeKindIs(typeOnlyDeclaration, ast.KindExportSpecifier, ast.KindExportDeclaration) message := core.IfElse(isExport, diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type, diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type) @@ -14115,7 +14109,6 @@ func (c *Checker) getTargetOfExportAssignment(node *ast.Node, dontResolveAlias b return resolved } -// TODO: Is this still used? func (c *Checker) getTargetOfBinaryExpression(node *ast.Node, dontResolveAlias bool) *ast.Symbol { resolved := c.getTargetOfAliasLikeExpression(node.AsBinaryExpression().Right, dontResolveAlias) c.markSymbolOfAliasDeclarationIfTypeOnly(node, nil /*immediateTarget*/, resolved, false /*overwriteEmpty*/, nil, "") @@ -14182,7 +14175,7 @@ func getModuleSpecifierFromNode(node *ast.Node) *ast.Node { switch node.Kind { case ast.KindImportDeclaration: return node.AsImportDeclaration().ModuleSpecifier - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: return node.AsExportDeclaration().ModuleSpecifier } panic("Unhandled case in getModuleSpecifierFromNode") @@ -14527,29 +14520,7 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign if resolveLocation == nil { resolveLocation = name } - symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, nil, true /*isUse*/, false /*excludeGlobals*/)) - if symbol == nil && meaning == ast.SymbolFlagsType && !dontResolveAlias && ast.IsInJSFile(name) { - symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, ast.SymbolFlagsAlias, nil, true /*isUse*/, false /*excludeGlobals*/)) - if symbol == nil || symbol.Flags&ast.SymbolFlagsAlias == 0 { - c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) - return nil - } else { - target := c.resolveAlias(symbol) - if target.Flags&ast.SymbolFlagsValueModule != 0 && c.getExportsOfModule(target)[ast.InternalSymbolNameExportStar] != nil { - exportstar := c.getExportsOfModule(target)[ast.InternalSymbolNameExportStar] - if core.Some(exportstar.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportDeclaration }) { - for _, node := range exportstar.Declarations { - if node.Kind == ast.KindJSExportDeclaration { - return c.getTargetOfAliasLikeExpression(node.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) - } - } - } - } - } - c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) - } else { - c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) - } + symbol = c.getMergedSymbol(c.resolveName(resolveLocation, name.AsIdentifier().Text, meaning, message, true /*isUse*/, false /*excludeGlobals*/)) case ast.KindQualifiedName: qualified := name.AsQualifiedName() symbol = c.resolveQualifiedName(name, qualified.Left, qualified.Right, meaning, ignoreErrors, dontResolveAlias, location) @@ -14574,9 +14545,24 @@ func (c *Checker) resolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ign } func (c *Checker) resolveQualifiedName(name *ast.Node, left *ast.Node, right *ast.Node, meaning ast.SymbolFlags, ignoreErrors bool, dontResolveAlias bool, location *ast.Node) *ast.Symbol { - namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) + namespace := c.resolveEntityName(left, ast.SymbolFlagsNamespace, true /*ignoreErrors*/, false /*dontResolveAlias*/, location) if namespace == nil || ast.NodeIsMissing(right) { - return nil + var immediate *ast.Symbol + alias := c.resolveEntityName(left, ast.SymbolFlagsAlias, true /*ignoreErrors*/, true /*dontResolveAlias*/, location) + if alias != nil { + immediate = c.getImmediateAliasedSymbol(alias) + if immediate != nil && !core.Some(immediate.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { + immediate = nil + } + } + if immediate == nil { + if !ignoreErrors { + c.resolveEntityName(left, ast.SymbolFlagsNamespace, ignoreErrors, false /*dontResolveAlias*/, location) + } + return nil + } else { + namespace = immediate + } } if namespace == c.unknownSymbol { return namespace @@ -14906,21 +14892,8 @@ func (c *Checker) getExportsOfModuleWorker(moduleSymbol *ast.Symbol) (exports as nestedSymbols := make(ast.SymbolTable) lookupTable := make(ExportCollisionTable) for _, node := range exportStars.Declarations { - var resolved *ast.Symbol - if node.Kind == ast.KindJSExportDeclaration { - resolved = c.getTargetOfAliasLikeExpression(node.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) - if resolved != nil && resolved.ValueDeclaration != nil && ast.IsVariableDeclaration(resolved.ValueDeclaration) { - initializer := resolved.ValueDeclaration.Initializer() - if initializer != nil && ast.IsFunctionExpressionOrArrowFunction(initializer) { - initSymbol := c.getSymbolOfNode(initializer) - exportedSymbols := visit(initSymbol, node, isTypeOnly) - c.extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node) - } - } - } else { - resolved = c.resolveExternalModuleName(node, node.AsExportDeclaration().ModuleSpecifier, false /*ignoreErrors*/) - } - exportedSymbols := visit(resolved, node, isTypeOnly) + resolvedModule := c.resolveExternalModuleName(node, node.AsExportDeclaration().ModuleSpecifier, false /*ignoreErrors*/) + exportedSymbols := visit(resolvedModule, node, isTypeOnly || node.AsExportDeclaration().IsTypeOnly) c.extendExportSymbols(nestedSymbols, exportedSymbols, lookupTable, node) } for id, s := range lookupTable { @@ -18264,6 +18237,8 @@ func (c *Checker) getSignaturesOfSymbol(symbol *ast.Symbol) []*Signature { continue } } + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would suppress checks that the two are compatible. result = append(result, c.getSignatureFromDeclaration(decl)) } return result @@ -19105,32 +19080,18 @@ func (c *Checker) resolveAnonymousTypeMembers(t *Type) { } } d.indexInfos = indexInfos - s := symbol - if members[ast.InternalSymbolNameExportStar] != nil && - core.Some(members[ast.InternalSymbolNameExportStar].Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportDeclaration }) { - // dereference `export * as id` to see whether it is a function or class that should contribute signatures - // TODO: This might need recursive deference like getExportsOfModuleWorker does (although resolving aliases might take care of that) - for _, node := range members[ast.InternalSymbolNameExportStar].Declarations { - if node.Kind == ast.KindJSExportDeclaration { - s2 := c.getTargetOfAliasLikeExpression(node.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) - if s2 != nil { - s = s2 - } - } - } - } // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are // in the process of resolving (see issue #6072). The temporarily empty signature list // will never be observed because a qualified name can't reference signatures. - if s.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0 { - d.signatures = c.getSignaturesOfSymbol(s) + if symbol.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0 { + d.signatures = c.getSignaturesOfSymbol(symbol) d.callSignatureCount = len(d.signatures) } // And likewise for construct signatures for classes - if s.Flags&ast.SymbolFlagsClass != 0 { - classType := c.getDeclaredTypeOfClassOrInterface(s) - constructSignatures := c.getSignaturesOfSymbol(s.Members[ast.InternalSymbolNameConstructor]) + if symbol.Flags&ast.SymbolFlagsClass != 0 { + classType := c.getDeclaredTypeOfClassOrInterface(symbol) + constructSignatures := c.getSignaturesOfSymbol(symbol.Members[ast.InternalSymbolNameConstructor]) if len(constructSignatures) == 0 { constructSignatures = c.getDefaultConstructSignatures(classType) } @@ -22884,9 +22845,20 @@ func (c *Checker) getTypeFromImportTypeNode(node *ast.Node) *Type { } next := core.OrElse(symbolFromModule, symbolFromVariable) if next == nil { - c.error(current, diagnostics.Namespace_0_has_no_exported_member_1, c.getFullyQualifiedName(currentNamespace, nil), scanner.DeclarationNameToString(current)) - links.resolvedType = c.errorType - return links.resolvedType + var symbolFromImmediateModule *ast.Symbol + if currentNamespace == moduleSymbol { + immediateModuleSymbol := c.resolveExternalModuleSymbol(innerModuleSymbol, true /*dontResolveAlias*/) + if immediateModuleSymbol != nil && core.Some(immediateModuleSymbol.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportAssignment }) { + symbolFromImmediateModule = c.getSymbol(c.getExportsOfSymbol(immediateModuleSymbol), current.Text(), meaning) + } + } + if symbolFromImmediateModule != nil { + next = symbolFromImmediateModule + } else { + c.error(current, diagnostics.Namespace_0_has_no_exported_member_1, c.getFullyQualifiedName(currentNamespace, nil), scanner.DeclarationNameToString(current)) + links.resolvedType = c.errorType + return links.resolvedType + } } c.symbolNodeLinks.Get(current).resolvedSymbol = next c.symbolNodeLinks.Get(current.Parent).resolvedSymbol = next @@ -22897,24 +22869,9 @@ func (c *Checker) getTypeFromImportTypeNode(node *ast.Node) *Type { if moduleSymbol.Flags&targetMeaning != 0 { links.resolvedType = c.resolveImportSymbolType(node, moduleSymbol, targetMeaning) } else { - if moduleSymbol.Flags&ast.SymbolFlagsValueModule != 0 && c.getExportsOfModule(moduleSymbol)[ast.InternalSymbolNameExportStar] != nil { - exportstar := c.getExportsOfModule(moduleSymbol)[ast.InternalSymbolNameExportStar] - if core.Some(exportstar.Declarations, func(d *ast.Node) bool { return d.Kind == ast.KindJSExportDeclaration }) { - for _, decl := range exportstar.Declarations { - if decl.Kind == ast.KindJSExportDeclaration { - s := c.getTargetOfAliasLikeExpression(decl.AsExportDeclaration().ModuleSpecifier, false /*dontResolveAlias*/) - if s.Flags&targetMeaning != 0 { - links.resolvedType = c.resolveImportSymbolType(node, s, targetMeaning) - return links.resolvedType - } - } - } - } - } message := core.IfElse(targetMeaning == ast.SymbolFlagsValue, diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here, diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0) - c.error(node, message, n.Argument.AsLiteralTypeNode().Literal.Text()) c.symbolNodeLinks.Get(node).resolvedSymbol = c.unknownSymbol links.resolvedType = c.errorType diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index bf3356a3ba..6e61fdaaf8 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -600,7 +600,6 @@ func (c *Checker) findFirstIllegalModifier(node *ast.Node) *ast.Node { ast.KindImportDeclaration, ast.KindImportEqualsDeclaration, ast.KindExportDeclaration, - ast.KindJSExportDeclaration, ast.KindExportAssignment, ast.KindJSExportAssignment, ast.KindFunctionExpression, @@ -2022,7 +2021,7 @@ func (c *Checker) checkGrammarTopLevelElementForRequiredDeclareModifier(node *as // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if node.Kind == ast.KindInterfaceDeclaration || node.Kind == ast.KindTypeAliasDeclaration || node.Kind == ast.KindImportDeclaration || node.Kind == ast.KindImportEqualsDeclaration || node.Kind == ast.KindExportDeclaration || node.Kind == ast.KindJSExportDeclaration || node.Kind == ast.KindExportAssignment || node.Kind == ast.KindJSExportAssignment || node.Kind == ast.KindNamespaceExportDeclaration || ast.HasSyntacticModifier(node, ast.ModifierFlagsAmbient|ast.ModifierFlagsExport|ast.ModifierFlagsDefault) { + if node.Kind == ast.KindInterfaceDeclaration || node.Kind == ast.KindTypeAliasDeclaration || node.Kind == ast.KindImportDeclaration || node.Kind == ast.KindImportEqualsDeclaration || node.Kind == ast.KindExportDeclaration || node.Kind == ast.KindExportAssignment || node.Kind == ast.KindJSExportAssignment || node.Kind == ast.KindNamespaceExportDeclaration || ast.HasSyntacticModifier(node, ast.ModifierFlagsAmbient|ast.ModifierFlagsExport|ast.ModifierFlagsDefault) { return false } diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index e52537aaa9..4c22427383 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -309,7 +309,7 @@ func canHaveSymbol(node *ast.Node) bool { case ast.KindArrowFunction, ast.KindBinaryExpression, ast.KindBindingElement, ast.KindCallExpression, ast.KindCallSignature, ast.KindClassDeclaration, ast.KindClassExpression, ast.KindClassStaticBlockDeclaration, ast.KindConstructor, ast.KindConstructorType, ast.KindConstructSignature, ast.KindElementAccessExpression, ast.KindEnumDeclaration, ast.KindEnumMember, ast.KindExportAssignment, ast.KindJSExportAssignment, - ast.KindExportDeclaration, ast.KindJSExportDeclaration, ast.KindExportSpecifier, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindFunctionType, + ast.KindExportDeclaration, ast.KindExportSpecifier, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindFunctionType, ast.KindGetAccessor, ast.KindIdentifier, ast.KindImportClause, ast.KindImportEqualsDeclaration, ast.KindImportSpecifier, ast.KindIndexSignature, ast.KindInterfaceDeclaration, ast.KindJSDocSignature, ast.KindJSDocTypeLiteral, ast.KindJsxAttribute, ast.KindJsxAttributes, ast.KindJsxSpreadAttribute, ast.KindMappedType, ast.KindMethodDeclaration, diff --git a/internal/ls/utilities.go b/internal/ls/utilities.go index 54954ab5e8..719588ae09 100644 --- a/internal/ls/utilities.go +++ b/internal/ls/utilities.go @@ -20,7 +20,7 @@ func isInString(file *ast.SourceFile, position int, previousToken *ast.Node) boo func tryGetImportFromModuleSpecifier(node *ast.StringLiteralLike) *ast.Node { switch node.Parent.Kind { - case ast.KindImportDeclaration, ast.KindExportDeclaration, ast.KindJSExportDeclaration, ast.KindJSDocImportTag: + case ast.KindImportDeclaration, ast.KindExportDeclaration, ast.KindJSDocImportTag: return node.Parent case ast.KindExternalModuleReference: return node.Parent.Parent diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index ff3bffab89..dd2cb4f36b 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -34,11 +34,7 @@ func (p *Parser) reparseCommonJS(node *ast.Node) { var export *ast.Node switch kind { case jsDeclarationKindModuleExports: - if bin.Right.Kind == ast.KindIdentifier { - export = p.factory.NewJSExportDeclaration(bin.Right) - } else { - export = p.factory.NewJSExportAssignment(bin.Right) - } + export = p.factory.NewJSExportAssignment(bin.Right) case jsDeclarationKindExportsProperty: nodes := p.nodeSlicePool.NewSlice(1) nodes[0] = p.factory.NewModifier(ast.KindExportKeyword) diff --git a/internal/printer/namegenerator.go b/internal/printer/namegenerator.go index f3d8be85d0..274e68ebc0 100644 --- a/internal/printer/namegenerator.go +++ b/internal/printer/namegenerator.go @@ -158,7 +158,7 @@ func (g *NameGenerator) generateNameForNode(node *ast.Node, privateName bool, fl panic("Generated name for a module or enum cannot be private and may have neither a prefix nor suffix") } return g.generateNameForModuleOrEnum(node) - case ast.KindImportDeclaration, ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindImportDeclaration, ast.KindExportDeclaration: if privateName || len(prefix) > 0 || len(suffix) > 0 { panic("Generated name for an import or export cannot be private and may have neither a prefix nor suffix") } diff --git a/internal/printer/printer.go b/internal/printer/printer.go index 6fb2cf48ca..a88f2af874 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -3957,7 +3957,7 @@ func (p *Printer) emitStatement(node *ast.Statement) { p.emitImportDeclaration(node.AsImportDeclaration()) case ast.KindExportAssignment, ast.KindJSExportAssignment: p.emitExportAssignment(node.AsExportAssignment()) - case ast.KindExportDeclaration, ast.KindJSExportDeclaration: + case ast.KindExportDeclaration: p.emitExportDeclaration(node.AsExportDeclaration()) case ast.KindCommonJSExport: p.emitCommonJSExport(node.AsCommonJSExport()) diff --git a/internal/transformers/typeeraser.go b/internal/transformers/typeeraser.go index 6a4a84c020..c2eaa6d748 100644 --- a/internal/transformers/typeeraser.go +++ b/internal/transformers/typeeraser.go @@ -95,7 +95,7 @@ func (tx *TypeEraserTransformer) visit(node *ast.Node) *ast.Node { ast.KindIndexSignature: return nil - case ast.KindJSExportAssignment, ast.KindJSExportDeclaration: + case ast.KindJSExportAssignment: // reparsed commonjs are elided return nil case ast.KindTypeAliasDeclaration, diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt index df5d21ebc0..1fafa07a86 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.errors.txt @@ -1,6 +1,4 @@ -ExtendedClass.js(7,1): error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. - Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. -ExtendedClass.js(17,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. +ExtendedClass.js(17,5): error TS1231: An export assignment must be at the top level of a file or module declaration. ExtendedClass.js(17,12): error TS2339: Property 'exports' does not exist on type '{}'. ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type '{}'. @@ -14,7 +12,7 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type } export = BaseClass; } -==== ExtendedClass.js (4 errors) ==== +==== ExtendedClass.js (3 errors) ==== define("lib/ExtendedClass", ["deps/BaseClass"], /** * {typeof import("deps/BaseClass")} @@ -22,9 +20,6 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type * @returns */ (BaseClass) => { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. -!!! error TS2345: Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. const ExtendedClass = BaseClass.extends({ f: function() { @@ -36,7 +31,7 @@ ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type const module = {}; module.exports = ExtendedClass ~~~~~~ -!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. +!!! error TS1231: An export assignment must be at the top level of a file or module declaration. ~~~~~~~ !!! error TS2339: Property 'exports' does not exist on type '{}'. return module.exports; diff --git a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types index cdb506c2af..176cd065be 100644 --- a/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types +++ b/testdata/baselines/reference/submodule/compiler/amdLikeInputDeclarationEmit.types @@ -36,7 +36,7 @@ define("lib/ExtendedClass", ["deps/BaseClass"], * @returns */ (BaseClass) => { ->(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : {} +>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof BaseClass) => any >BaseClass : typeof BaseClass const ExtendedClass = BaseClass.extends({ diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols index 7f42df0ae3..fb39c7c530 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols @@ -26,9 +26,9 @@ A.bar = class Q {} >Q : Symbol(Q, Decl(namespacey.js, 1, 7)) module.exports = A; ->module.exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) +>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) >module : Symbol(module.exports) ->exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) +>exports : Symbol(A, Decl(namespacey.js, 0, 5)) >A : Symbol(A, Decl(namespacey.js, 0, 5)) === namespacer.js === @@ -47,8 +47,8 @@ Object.defineProperty(B, "NS", { value: "why though", writable: true }); >writable : Symbol(writable, Decl(namespacer.js, 2, 53)) module.exports = B; ->module.exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) +>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) >module : Symbol(module.exports) ->exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) +>exports : Symbol(B, Decl(namespacer.js, 0, 5)) >B : Symbol(B, Decl(namespacer.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff index 3ae4831f69..b59f9153cc 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff @@ -37,9 +37,9 @@ ->module : Symbol(export=, Decl(namespacey.js, 1, 18)) ->exports : Symbol(export=, Decl(namespacey.js, 1, 18)) ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) -+>module.exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) ++>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("namespacey", Decl(namespacey.js, 0, 0)) ++>exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>A : Symbol(A, Decl(namespacey.js, 0, 5)) === namespacer.js === @@ -72,8 +72,8 @@ ->module : Symbol(export=, Decl(namespacer.js, 2, 72)) ->exports : Symbol(export=, Decl(namespacer.js, 2, 72)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) -+>module.exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) ++>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("namespacer", Decl(namespacer.js, 0, 0)) ++>exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types index c9f9c8a096..a8380c7361 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types @@ -2,8 +2,8 @@ === index.js === const _item = require("./namespacer"); ->_item : typeof import("namespacer") ->require("./namespacer") : typeof import("namespacer") +>_item : {} +>require("./namespacer") : {} >require : any >"./namespacer" : "./namespacer" @@ -40,9 +40,9 @@ A.bar = class Q {} module.exports = A; >module.exports = A : {} ->module.exports : typeof import("namespacey") ->module : { "namespacey": typeof import("namespacey"); } ->exports : typeof import("namespacey") +>module.exports : {} +>module : { readonly A: {}; } +>exports : {} >A : {} === namespacer.js === @@ -74,8 +74,8 @@ Object.defineProperty(B, "NS", { value: "why though", writable: true }); module.exports = B; >module.exports = B : {} ->module.exports : typeof import("namespacer") ->module : { "namespacer": typeof import("namespacer"); } ->exports : typeof import("namespacer") +>module.exports : {} +>module : { readonly B: {}; } +>exports : {} >B : {} diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols index e8fa5dbeff..285cda7771 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols @@ -17,8 +17,8 @@ class Bar extends Foo {} >Foo : Symbol(Foo, Decl(index.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol("/index", Decl(index.js, 0, 0)) +>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) >module : Symbol(module.exports) ->exports : Symbol("/index", Decl(index.js, 0, 0)) +>exports : Symbol(Bar, Decl(index.js, 0, 12)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff index f7c2413cc8..c22c0e260b 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).symbols.diff @@ -16,8 +16,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 2, 24)) ->exports : Symbol(export=, Decl(index.js, 2, 24)) -+>module.exports : Symbol("/index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) +>module : Symbol(module.exports) -+>exports : Symbol("/index", Decl(index.js, 0, 0)) ++>exports : Symbol(Bar, Decl(index.js, 0, 12)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types index 7e9a0d769f..f7a302d8e7 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types @@ -18,8 +18,8 @@ class Bar extends Foo {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof import("/index") ->module : { "/index": typeof import("/index"); } ->exports : typeof import("/index") +>module.exports : typeof Bar +>module : { Bar: typeof Bar; } +>exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols index e8fa5dbeff..285cda7771 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols @@ -17,8 +17,8 @@ class Bar extends Foo {} >Foo : Symbol(Foo, Decl(index.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol("/index", Decl(index.js, 0, 0)) +>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) >module : Symbol(module.exports) ->exports : Symbol("/index", Decl(index.js, 0, 0)) +>exports : Symbol(Bar, Decl(index.js, 0, 12)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff index c4d14b2b9e..a8542a07f3 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).symbols.diff @@ -16,8 +16,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 2, 24)) ->exports : Symbol(export=, Decl(index.js, 2, 24)) -+>module.exports : Symbol("/index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) +>module : Symbol(module.exports) -+>exports : Symbol("/index", Decl(index.js, 0, 0)) ++>exports : Symbol(Bar, Decl(index.js, 0, 12)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types index 7e9a0d769f..f7a302d8e7 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types @@ -18,8 +18,8 @@ class Bar extends Foo {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof import("/index") ->module : { "/index": typeof import("/index"); } ->exports : typeof import("/index") +>module.exports : typeof Bar +>module : { Bar: typeof Bar; } +>exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols index e5b2733bb0..bf438af52c 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols +++ b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols @@ -9,8 +9,8 @@ class Bar extends Foo {} >Foo : Symbol(Foo, Decl(index.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(Bar, Decl(index.js, 0, 12)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff index c078ecd8a8..6698b104d6 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.symbols.diff @@ -7,8 +7,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 2, 24)) ->exports : Symbol(export=, Decl(index.js, 2, 24)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(Bar, Decl(index.js, 0, 12)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(Bar, Decl(index.js, 0, 12)) >Bar : Symbol(Bar, Decl(index.js, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types index 9f8ef2822f..bae91c5459 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types +++ b/testdata/baselines/reference/submodule/compiler/javascriptCommonjsModule.types @@ -10,8 +10,8 @@ class Bar extends Foo {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : typeof Bar +>module : { Bar: typeof Bar; } +>exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols index b5c6a24ae6..e1364018d2 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols +++ b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols @@ -5,9 +5,9 @@ const alias = {}; >alias : Symbol(alias, Decl(a.js, 0, 5)) module.exports = alias; ->module.exports : Symbol("/a", Decl(a.js, 0, 0)) +>module.exports : Symbol(alias, Decl(a.js, 0, 5)) >module : Symbol(module.exports) ->exports : Symbol("/a", Decl(a.js, 0, 0)) +>exports : Symbol(alias, Decl(a.js, 0, 5)) >alias : Symbol(alias, Decl(a.js, 0, 5)) === /b.js === diff --git a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff index 12f86c1b12..49b75e9dcf 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(a.js, 0, 0)) ->module : Symbol(export=, Decl(a.js, 0, 17)) ->exports : Symbol(export=, Decl(a.js, 0, 17)) -+>module.exports : Symbol("/a", Decl(a.js, 0, 0)) ++>module.exports : Symbol(alias, Decl(a.js, 0, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("/a", Decl(a.js, 0, 0)) ++>exports : Symbol(alias, Decl(a.js, 0, 5)) >alias : Symbol(alias, Decl(a.js, 0, 5)) === /b.js === diff --git a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types index c2d91e04de..b1ae2fc014 100644 --- a/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types +++ b/testdata/baselines/reference/submodule/compiler/javascriptImportDefaultBadExport.types @@ -7,12 +7,12 @@ const alias = {}; module.exports = alias; >module.exports = alias : {} ->module.exports : typeof import("/a") ->module : { "/a": typeof import("/a"); } ->exports : typeof import("/a") +>module.exports : {} +>module : { readonly alias: {}; } +>exports : {} >alias : {} === /b.js === import a from "./a"; ->a : typeof import("/a") +>a : {} diff --git a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols index 1b5b62bef9..17104ab2ab 100644 --- a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols +++ b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols @@ -41,8 +41,8 @@ var y = { y: 'foo' }; >y : Symbol(y, Decl(index.js, 1, 9)) module.exports = y; ->module.exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) +>module.exports : Symbol(y, Decl(index.js, 1, 3)) >module : Symbol(module.exports) ->exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) +>exports : Symbol(y, Decl(index.js, 1, 3)) >y : Symbol(y, Decl(index.js, 1, 3)) diff --git a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff index 7ca8b8d98e..f65a01da1c 100644 --- a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.symbols.diff @@ -33,8 +33,8 @@ +>y : Symbol(y, Decl(index.js, 1, 9)) + +module.exports = y; -+>module.exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(y, Decl(index.js, 1, 3)) +>module : Symbol(module.exports) -+>exports : Symbol("/node_modules/shortid/index", Decl(index.js, 0, 0)) ++>exports : Symbol(y, Decl(index.js, 1, 3)) +>y : Symbol(y, Decl(index.js, 1, 3)) + diff --git a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types index c57aa2b33c..04e5662c06 100644 --- a/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types +++ b/testdata/baselines/reference/submodule/compiler/maxNodeModuleJsDepthDefaultsToZero.types @@ -50,8 +50,8 @@ var y = { y: 'foo' }; module.exports = y; >module.exports = y : { y: string; } ->module.exports : typeof import("/node_modules/shortid/index") ->module : { "/node_modules/shortid/index": typeof import("/node_modules/shortid/index"); } ->exports : typeof import("/node_modules/shortid/index") +>module.exports : { y: string; } +>module : { y: { y: string; }; } +>exports : { y: string; } >y : { y: string; } diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt index aba768686f..1e6ac9586c 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.errors.txt @@ -1,5 +1,5 @@ a.js(3,12): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -a.js(4,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. +a.js(4,5): error TS1231: An export assignment must be at the top level of a file or module declaration. ==== a.js (2 errors) ==== @@ -10,6 +10,6 @@ a.js(4,5): error TS1233: An export declaration can only be used at the top level !!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. module.exports = fn; ~~~~~~ -!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. +!!! error TS1231: An export assignment must be at the top level of a file or module declaration. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols index cfb3c19253..e7ec94d877 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols @@ -5,14 +5,14 @@ function fn() {} >fn : Symbol(fn, Decl(a.js, 0, 0)) if (typeof module === 'object' && module.exports) { ->module.exports : Symbol("a", Decl(a.js, 0, 0)) +>module.exports : Symbol(fn, Decl(a.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("a", Decl(a.js, 0, 0)) +>exports : Symbol(fn, Decl(a.js, 0, 0)) module.exports = fn; ->module.exports : Symbol("a", Decl(a.js, 0, 0)) +>module.exports : Symbol(fn, Decl(a.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("a", Decl(a.js, 0, 0)) +>exports : Symbol(fn, Decl(a.js, 0, 0)) >fn : Symbol(fn, Decl(a.js, 0, 0)) } diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff index 4d8b70ffb9..542b1b3da3 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.symbols.diff @@ -8,17 +8,17 @@ ->module.exports : Symbol(module.exports, Decl(a.js, 0, 0)) ->module : Symbol(module, Decl(a.js, 2, 51)) ->exports : Symbol(module.exports, Decl(a.js, 0, 0)) -+>module.exports : Symbol("a", Decl(a.js, 0, 0)) ++>module.exports : Symbol(fn, Decl(a.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("a", Decl(a.js, 0, 0)) ++>exports : Symbol(fn, Decl(a.js, 0, 0)) module.exports = fn; ->module.exports : Symbol(module.exports, Decl(a.js, 0, 0)) ->module : Symbol(export=, Decl(a.js, 2, 51)) ->exports : Symbol(export=, Decl(a.js, 2, 51)) -+>module.exports : Symbol("a", Decl(a.js, 0, 0)) ++>module.exports : Symbol(fn, Decl(a.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("a", Decl(a.js, 0, 0)) ++>exports : Symbol(fn, Decl(a.js, 0, 0)) >fn : Symbol(fn, Decl(a.js, 0, 0)) } diff --git a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types index e2dedf89c0..86ae1b1225 100644 --- a/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types +++ b/testdata/baselines/reference/submodule/compiler/truthinessCallExpressionCoercion4.types @@ -5,20 +5,20 @@ function fn() {} >fn : () => void if (typeof module === 'object' && module.exports) { ->typeof module === 'object' && module.exports : false | (typeof import("a")) +>typeof module === 'object' && module.exports : false | (() => void) >typeof module === 'object' : boolean >typeof module : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" >module : any >'object' : "object" ->module.exports : typeof import("a") ->module : { "a": typeof import("a"); } ->exports : typeof import("a") +>module.exports : () => void +>module : { fn: () => void; } +>exports : () => void module.exports = fn; >module.exports = fn : () => void ->module.exports : typeof import("a") ->module : { "a": typeof import("a"); } ->exports : typeof import("a") +>module.exports : () => void +>module : { fn: () => void; } +>exports : () => void >fn : () => void } diff --git a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols index f82dd5c264..cf0725a551 100644 --- a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols @@ -10,8 +10,8 @@ var loop2 = loop1; >loop1 : Symbol(loop1, Decl(loop.js, 0, 3)) module.exports = loop2; ->module.exports : Symbol("loop", Decl(loop.js, 0, 0)) +>module.exports : Symbol(loop2, Decl(loop.js, 1, 3)) >module : Symbol(module.exports) ->exports : Symbol("loop", Decl(loop.js, 0, 0)) +>exports : Symbol(loop2, Decl(loop.js, 1, 3)) >loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff index ae419993e3..9c22a5dc9c 100644 --- a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.symbols.diff @@ -7,8 +7,8 @@ ->module.exports : Symbol(module.exports, Decl(loop.js, 0, 0)) ->module : Symbol(export=, Decl(loop.js, 1, 18)) ->exports : Symbol(export=, Decl(loop.js, 1, 18)) -+>module.exports : Symbol("loop", Decl(loop.js, 0, 0)) ++>module.exports : Symbol(loop2, Decl(loop.js, 1, 3)) +>module : Symbol(module.exports) -+>exports : Symbol("loop", Decl(loop.js, 0, 0)) ++>exports : Symbol(loop2, Decl(loop.js, 1, 3)) >loop2 : Symbol(loop2, Decl(loop.js, 1, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types index da2b055d30..6724f06fcc 100644 --- a/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/binderUninitializedModuleExportsAssignment.types @@ -11,8 +11,8 @@ var loop2 = loop1; module.exports = loop2; >module.exports = loop2 : any ->module.exports : typeof import("loop") ->module : { "loop": typeof import("loop"); } ->exports : typeof import("loop") +>module.exports : any +>module : { loop2: any; } +>exports : any >loop2 : any diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt index 713849341c..d1c4231be8 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.errors.txt @@ -1,4 +1,4 @@ -use.js(1,30): error TS2694: Namespace '"mod1"' has no exported member 'Con'. +use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. ==== mod1.js (0 errors) ==== @@ -14,7 +14,7 @@ use.js(1,30): error TS2694: Namespace '"mod1"' has no exported member 'Con'. ==== use.js (1 errors) ==== /** @param {import('./mod1').Con} k */ ~~~ -!!! error TS2694: Namespace '"mod1"' has no exported member 'Con'. +!!! error TS2694: Namespace 'C' has no exported member 'Con'. function f(k) { if (1 === 2 - 1) { // I guess basic math works! diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols index 8d90284925..a3c308ae21 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols @@ -6,9 +6,9 @@ * @return {any} I don't even know what this should return */ module.exports = C ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(C, Decl(mod1.js, 4, 18)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(C, Decl(mod1.js, 4, 18)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff index c84101f5c5..d6547a6d1a 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) ->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(C, Decl(mod1.js, 4, 18)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(C, Decl(mod1.js, 4, 18)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types index d4bb49b1c0..f014c62629 100644 --- a/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/callbackCrossModule.types @@ -7,9 +7,9 @@ */ module.exports = C >module.exports = C : () => void ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") +>module.exports : () => void +>module : { C: () => void; } +>exports : () => void >C : () => void function C() { diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols index 43164254e4..6b6cc08719 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols @@ -130,8 +130,8 @@ Object.defineProperty(Person.prototype, "setonlyAccessor", { } }); module.exports = Person; ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(Person, Decl(mod1.js, 0, 0)) >Person : Symbol(Person, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff index 808712ef45..a09b927c21 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff @@ -185,8 +185,8 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 19, 3)) ->exports : Symbol(export=, Decl(mod1.js, 19, 3)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(Person, Decl(mod1.js, 0, 0)) >Person : Symbol(Person, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types index 8b3afda6de..3fe63091c2 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types @@ -4,12 +4,12 @@ import "./"; import Person = require("./mod1"); ->Person : typeof import("mod1") +>Person : (name: string) => void const m1 = new Person("Name") >m1 : any >new Person("Name") : any ->Person : typeof import("mod1") +>Person : (name: string) => void >"Name" : "Name" m1.thing; @@ -215,8 +215,8 @@ Object.defineProperty(Person.prototype, "setonlyAccessor", { }); module.exports = Person; >module.exports = Person : (name: string) => void ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") +>module.exports : (name: string) => void +>module : { Person: (name: string) => void; } +>exports : (name: string) => void >Person : (name: string) => void diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt index f8d0962ba5..26d070eca5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt @@ -1,19 +1,19 @@ index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. -validate.ts(3,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. -validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. -validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. -validate.ts(6,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. -validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. -validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. -validate.ts(10,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. -validate.ts(11,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. -validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. -validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. -validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. -validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. -validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. +validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. +validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. +validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. +validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. +validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. +validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. +validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. +validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ==== validate.ts (13 errors) ==== @@ -21,45 +21,45 @@ validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type 't import x = require("./"); x.name; ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'name' does not exist on type '{}'. x.middleInit; ~~~~~~~~~~ -!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'middleInit' does not exist on type '{}'. x.lastName; ~~~~~~~~ -!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.zip; ~~~ -!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'zip' does not exist on type '{}'. x.houseNumber; ~~~~~~~~~~~ -!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr; ~~~~~~ -!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.name = "Another"; ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'name' does not exist on type '{}'. x.zip = 98123; ~~~ -!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'zip' does not exist on type '{}'. x.zipStr = "OK"; ~~~~~~ -!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.lastName = "should fail"; ~~~~~~~~ -!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.houseNumber = 12; // should also fail ~~~~~~~~~~~ -!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr = 12; // should fail ~~~~~~ -!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.middleInit = "R"; // should also fail ~~~~~~~~~~ -!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. +!!! error TS2339: Property 'middleInit' does not exist on type '{}'. ==== index.js (3 errors) ==== const x = {}; diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols index 03df866de0..fb8fb1c8c0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols @@ -161,8 +161,8 @@ match(() => expected, (x = expected) => void 0); >expected : Symbol(expected, Decl(index.js, 32, 5)) module.exports = x; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(x, Decl(index.js, 0, 5)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(x, Decl(index.js, 0, 5)) >x : Symbol(x, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff index e9fa2dc18b..58073b8baa 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff @@ -200,8 +200,8 @@ ->module : Symbol(export=, Decl(index.js, 41, 48)) ->exports : Symbol(export=, Decl(index.js, 41, 48)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(x, Decl(index.js, 0, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(x, Decl(index.js, 0, 5)) +>x : Symbol(x, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types index a2c56f08ac..7a23ea5f67 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types @@ -3,84 +3,84 @@ === validate.ts === // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); ->x : typeof import("index") +>x : {} x.name; >x.name : any ->x : typeof import("index") +>x : {} >name : any x.middleInit; >x.middleInit : any ->x : typeof import("index") +>x : {} >middleInit : any x.lastName; >x.lastName : any ->x : typeof import("index") +>x : {} >lastName : any x.zip; >x.zip : any ->x : typeof import("index") +>x : {} >zip : any x.houseNumber; >x.houseNumber : any ->x : typeof import("index") +>x : {} >houseNumber : any x.zipStr; >x.zipStr : any ->x : typeof import("index") +>x : {} >zipStr : any x.name = "Another"; >x.name = "Another" : "Another" >x.name : any ->x : typeof import("index") +>x : {} >name : any >"Another" : "Another" x.zip = 98123; >x.zip = 98123 : 98123 >x.zip : any ->x : typeof import("index") +>x : {} >zip : any >98123 : 98123 x.zipStr = "OK"; >x.zipStr = "OK" : "OK" >x.zipStr : any ->x : typeof import("index") +>x : {} >zipStr : any >"OK" : "OK" x.lastName = "should fail"; >x.lastName = "should fail" : "should fail" >x.lastName : any ->x : typeof import("index") +>x : {} >lastName : any >"should fail" : "should fail" x.houseNumber = 12; // should also fail >x.houseNumber = 12 : 12 >x.houseNumber : any ->x : typeof import("index") +>x : {} >houseNumber : any >12 : 12 x.zipStr = 12; // should fail >x.zipStr = 12 : 12 >x.zipStr : any ->x : typeof import("index") +>x : {} >zipStr : any >12 : 12 x.middleInit = "R"; // should also fail >x.middleInit = "R" : "R" >x.middleInit : any ->x : typeof import("index") +>x : {} >middleInit : any >"R" : "R" @@ -251,8 +251,8 @@ match(() => expected, (x = expected) => void 0); module.exports = x; >module.exports = x : {} ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : {} +>module : { readonly x: {}; } +>exports : {} >x : {} diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types index c2642ed445..7c31947da1 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportClassTypeReference.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: any) => void ->k : any +>f : (k: K) => void +>k : K k.values() >k.values() : any >k.values : any ->k : any +>k : K >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types index 287d076177..00dcff55ca 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportExportedClassExpression.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: any) => void ->k : any +>f : (k: K) => void +>k : K k.values() >k.values() : any >k.values : any ->k : any +>k : K >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types index fe24af79d4..417be9ccc8 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.types @@ -9,13 +9,13 @@ const { K } = require("./mod1"); /** @param {K} k */ function f(k) { ->f : (k: any) => void ->k : any +>f : (k: K) => void +>k : K k.values() >k.values() : any >k.values : any ->k : any +>k : K >values : any } diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols index ecd9a4be5d..6f2ed5343e 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols @@ -42,8 +42,8 @@ function A() { this.id = 1; } >A : Symbol(A, Decl(other.js, 0, 0)) module.exports = A; ->module.exports : Symbol("other", Decl(other.js, 0, 0)) +>module.exports : Symbol(A, Decl(other.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("other", Decl(other.js, 0, 0)) +>exports : Symbol(A, Decl(other.js, 0, 0)) >A : Symbol(A, Decl(other.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff index c4e63fdf41..6784d0c9f5 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.symbols.diff @@ -50,8 +50,8 @@ ->module.exports : Symbol(module.exports, Decl(other.js, 0, 0)) ->module : Symbol(export=, Decl(other.js, 0, 29)) ->exports : Symbol(export=, Decl(other.js, 0, 29)) -+>module.exports : Symbol("other", Decl(other.js, 0, 0)) ++>module.exports : Symbol(A, Decl(other.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("other", Decl(other.js, 0, 0)) ++>exports : Symbol(A, Decl(other.js, 0, 0)) >A : Symbol(A, Decl(other.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types index 734def5f5c..f513861801 100644 --- a/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types +++ b/testdata/baselines/reference/submodule/conformance/constructorFunctions2.types @@ -11,8 +11,8 @@ declare var module: any, exports: any; === index.js === const A = require("./other"); ->A : typeof import("other") ->require("./other") : typeof import("other") +>A : () => void +>require("./other") : () => void >require : (id: string) => any >"./other" : "./other" @@ -20,7 +20,7 @@ const a = new A().id; >a : any >new A().id : any >new A() : any ->A : typeof import("other") +>A : () => void >id : any const B = function() { this.id = 1; } @@ -72,8 +72,8 @@ function A() { this.id = 1; } module.exports = A; >module.exports = A : () => void ->module.exports : typeof import("other") ->module : { "other": typeof import("other"); } ->exports : typeof import("other") +>module.exports : () => void +>module : { A: () => void; } +>exports : () => void >A : () => void diff --git a/testdata/baselines/reference/submodule/conformance/enumTagImported.types b/testdata/baselines/reference/submodule/conformance/enumTagImported.types index c64b14e80a..a7e576e4d9 100644 --- a/testdata/baselines/reference/submodule/conformance/enumTagImported.types +++ b/testdata/baselines/reference/submodule/conformance/enumTagImported.types @@ -18,7 +18,7 @@ import { TestEnum } from "./mod1" /** @type {TestEnum} */ const tist = TestEnum.ADD ->tist : any +>tist : TestEnum >TestEnum.ADD : string >TestEnum : { ADD: string; REMOVE: string; } >ADD : string diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt new file mode 100644 index 0000000000..28338d4764 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt @@ -0,0 +1,14 @@ +main.ts(2,52): error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. + + +==== main.ts (1 errors) ==== + import * as intermediate from './intermediate' + const ghost: intermediate.Ghost = new intermediate.Ghost() + ~~~~~ +!!! error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. + +==== intermediate.ts (0 errors) ==== + export type * from './ghost' + +==== ghost.ts (0 errors) ==== + export class Ghost {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff deleted file mode 100644 index bfaa4ba1ad..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.exportNamespace11.errors.txt -+++ new.exportNamespace11.errors.txt -@@= skipped -0, +-1 lines =@@ --main.ts(2,52): error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. -- -- --==== main.ts (1 errors) ==== -- import * as intermediate from './intermediate' -- const ghost: intermediate.Ghost = new intermediate.Ghost() -- ~~~~~ --!!! error TS2339: Property 'Ghost' does not exist on type 'typeof import("intermediate")'. -- --==== intermediate.ts (0 errors) ==== -- export type * from './ghost' -- --==== ghost.ts (0 errors) ==== -- export class Ghost {} -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols index 1e517ecca1..c5a74a5c0c 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols @@ -8,9 +8,7 @@ const ghost: intermediate.Ghost = new intermediate.Ghost() >ghost : Symbol(ghost, Decl(main.ts, 1, 5)) >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) >Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) ->intermediate.Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) ->Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) === intermediate.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff index 3bb741b2e3..6d5f34034e 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.symbols.diff @@ -6,9 +6,6 @@ >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) ->Ghost : Symbol(intermediate.Ghost, Decl(ghost.ts, 0, 0)) +>Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) -+>intermediate.Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) >intermediate : Symbol(intermediate, Decl(main.ts, 0, 6)) -+>Ghost : Symbol(Ghost, Decl(ghost.ts, 0, 0)) === intermediate.ts === - diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types index 8314e8ca64..25914ac276 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types @@ -7,10 +7,10 @@ import * as intermediate from './intermediate' const ghost: intermediate.Ghost = new intermediate.Ghost() >ghost : Ghost >intermediate : any ->new intermediate.Ghost() : Ghost ->intermediate.Ghost : typeof Ghost +>new intermediate.Ghost() : any +>intermediate.Ghost : any >intermediate : typeof import("intermediate") ->Ghost : typeof Ghost +>Ghost : any === intermediate.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff index 33d9f0dd01..9e6e09dcc3 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace11.types.diff @@ -11,14 +11,10 @@ ->ghost : intermediate.Ghost +>ghost : Ghost >intermediate : any -->new intermediate.Ghost() : any -->intermediate.Ghost : any + >new intermediate.Ghost() : any + >intermediate.Ghost : any ->intermediate : typeof intermediate -->Ghost : any -+>new intermediate.Ghost() : Ghost -+>intermediate.Ghost : typeof Ghost +>intermediate : typeof import("intermediate") -+>Ghost : typeof Ghost + >Ghost : any === intermediate.ts === - diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt new file mode 100644 index 0000000000..885f1e3acb --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt @@ -0,0 +1,20 @@ +main.ts(3,13): error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. +main.ts(4,19): error TS2339: Property 'c' does not exist on type 'typeof import("types")'. + + +==== main.ts (2 errors) ==== + import { c } from './types' + import * as types from './types' + console.log(c) // Fails as expected, import is still allowed though. + ~ +!!! error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 types.ts:1:1: 'c' was exported here. + console.log(types.c) // Expected an error here. + ~ +!!! error TS2339: Property 'c' does not exist on type 'typeof import("types")'. + +==== types.ts (0 errors) ==== + export type * from './values' + +==== values.ts (0 errors) ==== + export const c = 10 \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff deleted file mode 100644 index 968bd57750..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.errors.txt.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.exportNamespace12.errors.txt -+++ new.exportNamespace12.errors.txt -@@= skipped -0, +-1 lines =@@ --main.ts(3,13): error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. --main.ts(4,19): error TS2339: Property 'c' does not exist on type 'typeof import("types")'. -- -- --==== main.ts (2 errors) ==== -- import { c } from './types' -- import * as types from './types' -- console.log(c) // Fails as expected, import is still allowed though. -- ~ --!!! error TS1362: 'c' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 types.ts:1:1: 'c' was exported here. -- console.log(types.c) // Expected an error here. -- ~ --!!! error TS2339: Property 'c' does not exist on type 'typeof import("types")'. -- --==== types.ts (0 errors) ==== -- export type * from './values' -- --==== values.ts (0 errors) ==== -- export const c = 10 -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js index a8aff59270..3b60d6bde4 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js @@ -23,7 +23,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const types_1 = require("./types"); const types = require("./types"); -console.log(types_1.c); // Fails as expected, import is still allowed though. +console.log(c); // Fails as expected, import is still allowed though. console.log(types.c); // Expected an error here. diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff index d74a7ebfd4..0894e55c79 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.js.diff @@ -5,8 +5,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var types = require("./types"); --console.log(c); // Fails as expected, import is still allowed though. -+const types_1 = require("./types"); +const types = require("./types"); -+console.log(types_1.c); // Fails as expected, import is still allowed though. + console.log(c); // Fails as expected, import is still allowed though. console.log(types.c); // Expected an error here. diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols index c096ce0089..f77f7b2336 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols @@ -17,9 +17,7 @@ console.log(types.c) // Expected an error here. >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) ->types.c : Symbol(c, Decl(values.ts, 0, 12)) >types : Symbol(types, Decl(main.ts, 1, 6)) ->c : Symbol(c, Decl(values.ts, 0, 12)) === types.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff index 7f65586976..157acc1c26 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.symbols.diff @@ -17,9 +17,6 @@ >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) -+>types.c : Symbol(c, Decl(values.ts, 0, 12)) >types : Symbol(types, Decl(main.ts, 1, 6)) -+>c : Symbol(c, Decl(values.ts, 0, 12)) === types.ts === - diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types index 086a2782cc..1c1e76275d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types @@ -19,9 +19,9 @@ console.log(types.c) // Expected an error here. >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->types.c : 10 +>types.c : any >types : typeof import("types") ->c : 10 +>c : any === types.ts === diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff index 6ab7e84f99..01af2c2941 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace12.types.diff @@ -9,16 +9,12 @@ console.log(c) // Fails as expected, import is still allowed though. >console.log(c) : void -@@= skipped -14, +14 lines =@@ - >console.log : (...data: any[]) => void +@@= skipped -15, +15 lines =@@ >console : Console >log : (...data: any[]) => void -->types.c : any + >types.c : any ->types : typeof types -->c : any -+>types.c : 10 +>types : typeof import("types") -+>c : 10 + >c : any === types.ts === - diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt index 1a827be564..2b1270b838 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt @@ -1,3 +1,4 @@ +d.ts(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. e.ts(2,1): error TS1362: 'ns' cannot be used as a value because it was exported using 'export type'. @@ -10,9 +11,12 @@ e.ts(2,1): error TS1362: 'ns' cannot be used as a value because it was exported ==== c.ts (0 errors) ==== export type * as ns from './a'; -==== d.ts (0 errors) ==== +==== d.ts (1 errors) ==== import { A } from './b'; A; + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 b.ts:1:1: 'A' was exported here. ==== e.ts (1 errors) ==== import { ns } from './c'; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff deleted file mode 100644 index 0946df3e23..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.exportNamespace4.errors.txt -+++ new.exportNamespace4.errors.txt -@@= skipped -0, +0 lines =@@ --d.ts(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. - e.ts(2,1): error TS1362: 'ns' cannot be used as a value because it was exported using 'export type'. - - -@@= skipped -10, +9 lines =@@ - ==== c.ts (0 errors) ==== - export type * as ns from './a'; - --==== d.ts (1 errors) ==== -+==== d.ts (0 errors) ==== - import { A } from './b'; - A; -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 b.ts:1:1: 'A' was exported here. - - ==== e.ts (1 errors) ==== - import { ns } from './c'; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js index 297b00294b..14a8fe977b 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js @@ -34,8 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [d.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const b_1 = require("./b"); -b_1.A; +A; //// [e.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff index 663cfe808c..7d65ea430e 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace4.js.diff @@ -14,14 +14,7 @@ exports.A = A; //// [b.js] "use strict"; -@@= skipped -15, +12 lines =@@ - //// [d.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --A; -+const b_1 = require("./b"); -+b_1.A; - //// [e.js] +@@= skipped -20, +17 lines =@@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); ns.A; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt new file mode 100644 index 0000000000..d94580faee --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt @@ -0,0 +1,34 @@ +/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +/c.ts(3,17): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. + + +==== /a.ts (0 errors) ==== + export class A {} + export class B {} + export class X {} + +==== /b.ts (0 errors) ==== + export type * from "./a"; + export { X } from "./a"; + +==== /c.ts (2 errors) ==== + import { A, B as C, X } from "./b"; + let _: A = new A(); // Error + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /b.ts:1:1: 'A' was exported here. + let __: C = new C(); // Error + ~ +!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /b.ts:1:1: 'C' was exported here. + let ___: X = new X(); // Ok + +==== /d.ts (0 errors) ==== + export type * from "./a"; + export * from "./a"; + +==== /e.ts (0 errors) ==== + import { A, B, X } from "./d"; + let _: A = new A(); // Ok + let __: B = new B(); // Ok + let ___: X = new X(); // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff deleted file mode 100644 index 7e8bed63f3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace5.errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.exportNamespace5.errors.txt -+++ new.exportNamespace5.errors.txt -@@= skipped -0, +-1 lines =@@ --/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --/c.ts(3,17): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. -- -- --==== /a.ts (0 errors) ==== -- export class A {} -- export class B {} -- export class X {} -- --==== /b.ts (0 errors) ==== -- export type * from "./a"; -- export { X } from "./a"; -- --==== /c.ts (2 errors) ==== -- import { A, B as C, X } from "./b"; -- let _: A = new A(); // Error -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /b.ts:1:1: 'A' was exported here. -- let __: C = new C(); // Error -- ~ --!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /b.ts:1:1: 'C' was exported here. -- let ___: X = new X(); // Ok -- --==== /d.ts (0 errors) ==== -- export type * from "./a"; -- export * from "./a"; -- --==== /e.ts (0 errors) ==== -- import { A, B, X } from "./d"; -- let _: A = new A(); // Ok -- let __: B = new B(); // Ok -- let ___: X = new X(); // Ok -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js index 4388ba5d35..ae43edb08d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js @@ -48,8 +48,8 @@ Object.defineProperty(exports, "X", { enumerable: true, get: function () { retur "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const b_1 = require("./b"); -let _ = new b_1.A(); // Error -let __ = new b_1.B(); // Error +let _ = new A(); // Error +let __ = new C(); // Error let ___ = new b_1.X(); // Ok //// [d.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff index 64b4bda13c..5dc65f7e77 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace5.js.diff @@ -43,8 +43,8 @@ -var __ = new C(); // Error -var ___ = new b_1.X(); // Ok +const b_1 = require("./b"); -+let _ = new b_1.A(); // Error -+let __ = new b_1.B(); // Error ++let _ = new A(); // Error ++let __ = new C(); // Error +let ___ = new b_1.X(); // Ok //// [d.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt new file mode 100644 index 0000000000..b639df1663 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt @@ -0,0 +1,24 @@ +/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +/d.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. + + +==== /a.ts (0 errors) ==== + export class A {} + export class B {} + +==== /b.ts (0 errors) ==== + export type * from "./a"; + +==== /c.ts (0 errors) ==== + export * from "./b"; + +==== /d.ts (2 errors) ==== + import { A, B } from "./c"; + let _: A = new A(); // Error + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /b.ts:1:1: 'A' was exported here. + let __: B = new B(); // Error + ~ +!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /b.ts:1:1: 'B' was exported here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff deleted file mode 100644 index cf7b8c80c2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace6.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.exportNamespace6.errors.txt -+++ new.exportNamespace6.errors.txt -@@= skipped -0, +-1 lines =@@ --/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --/d.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. -- -- --==== /a.ts (0 errors) ==== -- export class A {} -- export class B {} -- --==== /b.ts (0 errors) ==== -- export type * from "./a"; -- --==== /c.ts (0 errors) ==== -- export * from "./b"; -- --==== /d.ts (2 errors) ==== -- import { A, B } from "./c"; -- let _: A = new A(); // Error -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /b.ts:1:1: 'A' was exported here. -- let __: B = new B(); // Error -- ~ --!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /b.ts:1:1: 'B' was exported here. -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js index 8ef15e73ed..36cd8e08a9 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js @@ -49,6 +49,5 @@ __exportStar(require("./b"), exports); //// [d.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const c_1 = require("./c"); -let _ = new c_1.A(); // Error -let __ = new c_1.B(); // Error +let _ = new A(); // Error +let __ = new B(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff index 35d58c4382..bcf69c391d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace6.js.diff @@ -28,6 +28,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _ = new A(); // Error -var __ = new B(); // Error -+const c_1 = require("./c"); -+let _ = new c_1.A(); // Error -+let __ = new c_1.B(); // Error ++let _ = new A(); // Error ++let __ = new B(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt new file mode 100644 index 0000000000..c713c7ec4e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt @@ -0,0 +1,46 @@ +/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +/c.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +/e.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +/e.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +/e.ts(4,18): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. + + +==== /a.ts (0 errors) ==== + export class A {} + export class B {} + export class C {} + +==== /b.ts (0 errors) ==== + export type * from "./a"; + export class C {} + +==== /c.ts (2 errors) ==== + import { A, B, C } from "./b"; + let _: A = new A(); // Error + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /b.ts:1:1: 'A' was exported here. + let __: B = new B(); // Error + ~ +!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /b.ts:1:1: 'B' was exported here. + let ___: C = new C(); // Ok + +==== /d.ts (0 errors) ==== + export type * from "./b"; + +==== /e.ts (3 errors) ==== + import { A, B, C } from "./d"; + let _: A = new A(); // Error + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /d.ts:1:1: 'A' was exported here. + let __: B = new B(); // Error + ~ +!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /d.ts:1:1: 'B' was exported here. + let ___: C = new C(); // Error + ~ +!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /d.ts:1:1: 'C' was exported here. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff deleted file mode 100644 index 9e0b8f8d28..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace7.errors.txt.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.exportNamespace7.errors.txt -+++ new.exportNamespace7.errors.txt -@@= skipped -0, +-1 lines =@@ --/c.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --/c.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. --/e.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --/e.ts(3,17): error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. --/e.ts(4,18): error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. -- -- --==== /a.ts (0 errors) ==== -- export class A {} -- export class B {} -- export class C {} -- --==== /b.ts (0 errors) ==== -- export type * from "./a"; -- export class C {} -- --==== /c.ts (2 errors) ==== -- import { A, B, C } from "./b"; -- let _: A = new A(); // Error -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /b.ts:1:1: 'A' was exported here. -- let __: B = new B(); // Error -- ~ --!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /b.ts:1:1: 'B' was exported here. -- let ___: C = new C(); // Ok -- --==== /d.ts (0 errors) ==== -- export type * from "./b"; -- --==== /e.ts (3 errors) ==== -- import { A, B, C } from "./d"; -- let _: A = new A(); // Error -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /d.ts:1:1: 'A' was exported here. -- let __: B = new B(); // Error -- ~ --!!! error TS1362: 'B' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /d.ts:1:1: 'B' was exported here. -- let ___: C = new C(); // Error -- ~ --!!! error TS1362: 'C' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /d.ts:1:1: 'C' was exported here. -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js index 0e0702c2a9..faea07cd5d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js @@ -49,8 +49,8 @@ exports.C = C; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const b_1 = require("./b"); -let _ = new b_1.A(); // Error -let __ = new b_1.B(); // Error +let _ = new A(); // Error +let __ = new B(); // Error let ___ = new b_1.C(); // Ok //// [d.js] "use strict"; @@ -58,7 +58,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [e.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const d_1 = require("./d"); -let _ = new d_1.A(); // Error -let __ = new d_1.B(); // Error -let ___ = new d_1.C(); // Error +let _ = new A(); // Error +let __ = new B(); // Error +let ___ = new C(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff index f3d5613cfc..f925079c86 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace7.js.diff @@ -48,8 +48,8 @@ -var __ = new B(); // Error -var ___ = new b_1.C(); // Ok +const b_1 = require("./b"); -+let _ = new b_1.A(); // Error -+let __ = new b_1.B(); // Error ++let _ = new A(); // Error ++let __ = new B(); // Error +let ___ = new b_1.C(); // Ok //// [d.js] "use strict"; @@ -60,7 +60,6 @@ -var _ = new A(); // Error -var __ = new B(); // Error -var ___ = new C(); // Error -+const d_1 = require("./d"); -+let _ = new d_1.A(); // Error -+let __ = new d_1.B(); // Error -+let ___ = new d_1.C(); // Error ++let _ = new A(); // Error ++let __ = new B(); // Error ++let ___ = new C(); // Error diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt index 905173619f..8ee301e187 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt @@ -1,4 +1,5 @@ /c.ts(2,1): error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. +/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. ==== /a.ts (0 errors) ==== @@ -15,9 +16,12 @@ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. -==== /d.ts (0 errors) ==== +==== /d.ts (1 errors) ==== import { A, B, C } from "./c"; let _: A = new A(); // Error + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /c.ts:1:1: 'A' was exported here. let __: B = new B(); // Ok let ___: C = new C(); // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff deleted file mode 100644 index 3c0842309b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.exportNamespace8.errors.txt -+++ new.exportNamespace8.errors.txt -@@= skipped -0, +0 lines =@@ - /c.ts(2,1): error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. --/d.ts(2,16): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. - - - ==== /a.ts (0 errors) ==== -@@= skipped -15, +14 lines =@@ - ~~~~~~~~~~~~~~~~~~~~ - !!! error TS2308: Module "./a" has already exported a member named 'B'. Consider explicitly re-exporting to resolve the ambiguity. - --==== /d.ts (1 errors) ==== -+==== /d.ts (0 errors) ==== - import { A, B, C } from "./c"; - let _: A = new A(); // Error -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /c.ts:1:1: 'A' was exported here. - let __: B = new B(); // Ok - let ___: C = new C(); // Ok - diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js index b45eb4da50..188abb9396 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js @@ -61,6 +61,6 @@ __exportStar(require("./b"), exports); // Collision error "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const c_1 = require("./c"); -let _ = new c_1.A(); // Error +let _ = new A(); // Error let __ = new c_1.B(); // Ok let ___ = new c_1.C(); // Ok diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff index c685d2885d..00e09e3f48 100644 --- a/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace8.js.diff @@ -51,6 +51,6 @@ -var __ = new c_1.B(); // Ok -var ___ = new c_1.C(); // Ok +const c_1 = require("./c"); -+let _ = new c_1.A(); // Error ++let _ = new A(); // Error +let __ = new c_1.B(); // Ok +let ___ = new c_1.C(); // Ok diff --git a/testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt new file mode 100644 index 0000000000..bea8c5ca84 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/exportNamespace_js.errors.txt @@ -0,0 +1,16 @@ +c.js(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. + + +==== a.js (0 errors) ==== + export class A {} + +==== b.js (0 errors) ==== + export type * from './a'; + +==== c.js (1 errors) ==== + import { A } from './b'; + A; + ~ +!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 b.js:1:1: 'A' was exported here. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types index 0ae87c6ec9..ac3b962eb8 100644 --- a/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types +++ b/testdata/baselines/reference/submodule/conformance/exportedEnumTypeAndValue.types @@ -24,7 +24,7 @@ import MyEnum from "./def"; /** @type {MyEnum} */ const v = MyEnum.b; ->v : any +>v : MyEnum >MyEnum.b : number >MyEnum : { a: number; b: number; } >b : number diff --git a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols index 998ef14bdb..304a0ff5e1 100644 --- a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols +++ b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols @@ -8,9 +8,9 @@ class Alias { >bar : Symbol(bar, Decl(mod1.js, 0, 13)) } module.exports = Alias; ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(Alias, Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(Alias, Decl(mod1.js, 0, 0)) >Alias : Symbol(Alias, Decl(mod1.js, 0, 0)) === main.js === diff --git a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff index 9da468d200..0a7bebfb48 100644 --- a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.symbols.diff @@ -11,9 +11,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 2, 1)) ->exports : Symbol(export=, Decl(mod1.js, 2, 1)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(Alias, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(Alias, Decl(mod1.js, 0, 0)) >Alias : Symbol(Alias, Decl(mod1.js, 0, 0)) === main.js === diff --git a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types index 7f13c9f5df..35aaf499c6 100644 --- a/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types +++ b/testdata/baselines/reference/submodule/conformance/importAliasModuleExports.types @@ -10,20 +10,20 @@ class Alias { } module.exports = Alias; >module.exports = Alias : typeof Alias ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") +>module.exports : typeof Alias +>module : { Alias: typeof Alias; } +>exports : typeof Alias >Alias : typeof Alias === main.js === import A from './mod1' ->A : typeof import("mod1") +>A : typeof Alias A.prototype.foo = 0 >A.prototype.foo = 0 : 0 >A.prototype.foo : any >A.prototype : Alias ->A : typeof import("mod1") +>A : typeof Alias >prototype : Alias >foo : any >0 : 0 @@ -32,7 +32,7 @@ A.prototype.func = function() { this._func = 0; } >A.prototype.func = function() { this._func = 0; } : () => void >A.prototype.func : any >A.prototype : Alias ->A : typeof import("mod1") +>A : typeof Alias >prototype : Alias >func : any >function() { this._func = 0; } : () => void @@ -48,7 +48,7 @@ Object.defineProperty(A.prototype, "def", { value: 0 }); >Object : ObjectConstructor >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T >A.prototype : Alias ->A : typeof import("mod1") +>A : typeof Alias >prototype : Alias >"def" : "def" >{ value: 0 } : { value: number; } @@ -58,25 +58,25 @@ Object.defineProperty(A.prototype, "def", { value: 0 }); new A().bar >new A().bar : () => number >new A() : Alias ->A : typeof import("mod1") +>A : typeof Alias >bar : () => number new A().foo >new A().foo : any >new A() : Alias ->A : typeof import("mod1") +>A : typeof Alias >foo : any new A().func() >new A().func() : any >new A().func : any >new A() : Alias ->A : typeof import("mod1") +>A : typeof Alias >func : any new A().def >new A().def : any >new A() : Alias ->A : typeof import("mod1") +>A : typeof Alias >def : any diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt index c0a51caec6..cbb4b6d57d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.errors.txt @@ -1,7 +1,8 @@ -cls.js(7,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. +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 (1 errors) ==== +==== cls.js (2 errors) ==== const Bar = require("./bar"); const Strings = { a: "A", @@ -9,10 +10,11 @@ cls.js(7,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' bu }; class Foo extends Bar {} module.exports = Foo; - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. -!!! related TS2728 cls.js:8:1: 'Strings' is declared here. + ~~~~~~~~~~~~~~~~~~~~ +!!! 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'. ==== bar.js (0 errors) ==== class Bar {} module.exports = Bar; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols index e533cb0973..bd1cc110ec 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols @@ -21,17 +21,15 @@ class Foo extends Bar {} >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) module.exports = Foo; ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) +>exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Foo : Symbol(Foo, Decl(cls.js, 4, 2)) module.exports.Strings = Strings; ->module.exports.Strings : Symbol(Strings, Decl(cls.js, 6, 21)) ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) ->Strings : Symbol(Strings, Decl(cls.js, 6, 21)) +>exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) === bar.js === @@ -39,8 +37,8 @@ class Bar {} >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol("bar", Decl(bar.js, 0, 0)) +>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("bar", Decl(bar.js, 0, 0)) +>exports : Symbol(Bar, Decl(bar.js, 0, 0)) >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff index a47869272f..e18c727ca3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff @@ -7,31 +7,32 @@ ->module.exports : Symbol(module.exports, Decl(cls.js, 0, 0)) ->module : Symbol(export=, Decl(cls.js, 5, 24)) ->exports : Symbol(export=, Decl(cls.js, 5, 24)) -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Foo : Symbol(Foo, Decl(cls.js, 4, 2)) module.exports.Strings = Strings; - >module.exports.Strings : Symbol(Strings, Decl(cls.js, 6, 21)) +->module.exports.Strings : Symbol(Strings, Decl(cls.js, 6, 21)) ->module.exports : Symbol(Strings, Decl(cls.js, 6, 21)) ->module : Symbol(module, Decl(cls.js, 5, 24)) ->exports : Symbol(module.exports, Decl(cls.js, 0, 0)) -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +->Strings : Symbol(Strings, Decl(cls.js, 6, 21)) ++>module.exports : Symbol(Foo, Decl(cls.js, 4, 2)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) - >Strings : Symbol(Strings, Decl(cls.js, 6, 21)) ++>exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) -@@= skipped -18, +18 lines =@@ + === bar.js === +@@= skipped -18, +16 lines =@@ >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) module.exports = Bar; ->module.exports : Symbol(module.exports, Decl(bar.js, 0, 0)) ->module : Symbol(export=, Decl(bar.js, 0, 12)) ->exports : Symbol(export=, Decl(bar.js, 0, 12)) -+>module.exports : Symbol("bar", Decl(bar.js, 0, 0)) ++>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("bar", Decl(bar.js, 0, 0)) ++>exports : Symbol(Bar, Decl(bar.js, 0, 0)) >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types index ce0c764652..d2474b76c9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types @@ -2,8 +2,8 @@ === cls.js === const Bar = require("./bar"); ->Bar : typeof import("bar") ->require("./bar") : typeof import("bar") +>Bar : typeof Bar +>require("./bar") : typeof Bar >require : any >"./bar" : "./bar" @@ -26,18 +26,18 @@ class Foo extends Bar {} module.exports = Foo; >module.exports = Foo : typeof Foo ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") +>module.exports : typeof Foo +>module : { Foo: typeof Foo; } +>exports : typeof Foo >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } ->module.exports.Strings : { a: string; b: string; } ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") ->Strings : { a: string; b: string; } +>module.exports.Strings : any +>module.exports : typeof Foo +>module : { Foo: typeof Foo; } +>exports : typeof Foo +>Strings : any >Strings : { a: string; b: string; } === bar.js === @@ -46,8 +46,8 @@ class Bar {} module.exports = Bar; >module.exports = Bar : typeof Bar ->module.exports : typeof import("bar") ->module : { "bar": typeof import("bar"); } ->exports : typeof import("bar") +>module.exports : typeof Bar +>module : { Bar: typeof Bar; } +>exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt index 624c41ba68..ca8208ac52 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.errors.txt @@ -1,8 +1,9 @@ source.js(9,9): error TS2339: Property 'statische' does not exist on type 'typeof Handler'. -source.js(15,1): error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. +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 (3 errors) ==== class Handler { static get OPTIONS() { return 1; @@ -20,10 +21,11 @@ source.js(15,1): error TS2741: Property 'Strings' is missing in type 'typeof Han } module.exports = Handler; - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. -!!! related TS2728 source.js:16:1: 'Strings' is declared here. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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'. /** * @typedef {Object} HandlerOptions diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols index d7fb25e9b6..899a405f27 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols @@ -28,17 +28,15 @@ const Strings = { } module.exports = Handler; ->module.exports : Symbol("source", Decl(source.js, 0, 0)) +>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("source", Decl(source.js, 0, 0)) +>exports : Symbol(Handler, Decl(source.js, 0, 0)) >Handler : Symbol(Handler, Decl(source.js, 0, 0)) module.exports.Strings = Strings ->module.exports.Strings : Symbol(Strings, Decl(source.js, 14, 25)) ->module.exports : Symbol("source", Decl(source.js, 0, 0)) +>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("source", Decl(source.js, 0, 0)) ->Strings : Symbol(Strings, Decl(source.js, 14, 25)) +>exports : Symbol(Handler, Decl(source.js, 0, 0)) >Strings : Symbol(Strings, Decl(source.js, 9, 5)) /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff index dbb88bb6d3..3d495c8667 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.symbols.diff @@ -35,19 +35,20 @@ ->module : Symbol(export=, Decl(source.js, 12, 1)) ->exports : Symbol(export=, Decl(source.js, 12, 1)) ->Handler : Symbol(Handler, Decl(source.js, 0, 0), Decl(source.js, 7, 1)) -+>module.exports : Symbol("source", Decl(source.js, 0, 0)) ++>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("source", Decl(source.js, 0, 0)) ++>exports : Symbol(Handler, Decl(source.js, 0, 0)) +>Handler : Symbol(Handler, Decl(source.js, 0, 0)) module.exports.Strings = Strings - >module.exports.Strings : Symbol(Strings, Decl(source.js, 14, 25)) +->module.exports.Strings : Symbol(Strings, Decl(source.js, 14, 25)) ->module.exports : Symbol(Strings, Decl(source.js, 14, 25)) ->module : Symbol(module, Decl(source.js, 12, 1)) ->exports : Symbol(module.exports, Decl(source.js, 0, 0)) -+>module.exports : Symbol("source", Decl(source.js, 0, 0)) +->Strings : Symbol(Strings, Decl(source.js, 14, 25)) ++>module.exports : Symbol(Handler, Decl(source.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("source", Decl(source.js, 0, 0)) - >Strings : Symbol(Strings, Decl(source.js, 14, 25)) ++>exports : Symbol(Handler, Decl(source.js, 0, 0)) >Strings : Symbol(Strings, Decl(source.js, 9, 5)) + /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types index c186fd20a6..732245046e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.types @@ -37,18 +37,18 @@ const Strings = { module.exports = Handler; >module.exports = Handler : typeof Handler ->module.exports : typeof import("source") ->module : { "source": typeof import("source"); } ->exports : typeof import("source") +>module.exports : typeof Handler +>module : { Handler: typeof Handler; } +>exports : typeof Handler >Handler : typeof Handler module.exports.Strings = Strings >module.exports.Strings = Strings : { a: string; b: string; } ->module.exports.Strings : { a: string; b: string; } ->module.exports : typeof import("source") ->module : { "source": typeof import("source"); } ->exports : typeof import("source") ->Strings : { a: string; b: string; } +>module.exports.Strings : any +>module.exports : typeof Handler +>module : { Handler: typeof Handler; } +>exports : typeof Handler +>Strings : any >Strings : { a: string; b: string; } /** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols index 72e5be4118..89d7829634 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols @@ -17,9 +17,9 @@ class Container { } module.exports = Container; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(Container, Decl(index.js, 0, 29)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(Container, Decl(index.js, 0, 29)) >Container : Symbol(Container, Decl(index.js, 0, 29)) === obj.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff index f31880e2fb..1e3e65d778 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff @@ -15,9 +15,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 6, 1)) ->exports : Symbol(export=, Decl(index.js, 6, 1)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(Container, Decl(index.js, 0, 29)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(Container, Decl(index.js, 0, 29)) >Container : Symbol(Container, Decl(index.js, 0, 29)) === obj.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types index a0b06fe4c2..1b123a62e8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types @@ -23,9 +23,9 @@ class Container { module.exports = Container; >module.exports = Container : typeof Container ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : typeof Container +>module : { Container: typeof Container; } +>exports : typeof Container >Container : typeof Container === obj.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols index e3d56db2ef..716a94e9ae 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols @@ -65,9 +65,9 @@ const ns = require("./cls"); >"./cls" : Symbol("cls", Decl(cls.js, 0, 0)) module.exports = ns; ->module.exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) >ns : Symbol(ns, Decl(cjs2.js, 0, 5)) === cjs3.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff index d2820ea48a..b302986532 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.symbols.diff @@ -27,9 +27,9 @@ ->module.exports : Symbol(module.exports, Decl(cjs2.js, 0, 0)) ->module : Symbol(export=, Decl(cjs2.js, 0, 28)) ->exports : Symbol(export=, Decl(cjs2.js, 0, 28)) -+>module.exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("cjs2", Decl(cjs2.js, 0, 0)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) >ns : Symbol(ns, Decl(cjs2.js, 0, 5)) === cjs3.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types index d5b8e43499..0d9eaa2848 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportForms.types @@ -70,9 +70,9 @@ const ns = require("./cls"); module.exports = ns; >module.exports = ns : typeof import("cls") ->module.exports : typeof import("cjs2") ->module : { "cjs2": typeof import("cjs2"); } ->exports : typeof import("cjs2") +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") >ns : typeof import("cls") === cjs3.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols index 294ada5721..34204ffe6a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols @@ -16,9 +16,9 @@ import * as ns from "./cls"; >ns : Symbol(ns, Decl(bin.js, 0, 6)) module.exports = ns; // We refuse to bind cjs module exports assignments in the same file we find an import in ->module.exports : Symbol("bin", Decl(bin.js, 0, 0)) +>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("bin", Decl(bin.js, 0, 0)) +>exports : Symbol("cls", Decl(cls.js, 0, 0)) >ns : Symbol(ns, Decl(bin.js, 0, 6)) === globalNs.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff index 4ee27b7498..6706cd8bd1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.symbols.diff @@ -4,9 +4,9 @@ >ns : Symbol(ns, Decl(bin.js, 0, 6)) module.exports = ns; // We refuse to bind cjs module exports assignments in the same file we find an import in -+>module.exports : Symbol("bin", Decl(bin.js, 0, 0)) ++>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("bin", Decl(bin.js, 0, 0)) ++>exports : Symbol("cls", Decl(cls.js, 0, 0)) >ns : Symbol(ns, Decl(bin.js, 0, 6)) === globalNs.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types index 4aee73567c..e641d5289b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportFormsErr.types @@ -17,9 +17,9 @@ import * as ns from "./cls"; module.exports = ns; // We refuse to bind cjs module exports assignments in the same file we find an import in >module.exports = ns : typeof import("cls") ->module.exports : typeof import("bin") ->module : { "bin": typeof import("bin"); } ->exports : typeof import("bin") +>module.exports : typeof import("cls") +>module : { "cls": typeof import("cls"); } +>exports : typeof import("cls") >ns : typeof import("cls") === globalNs.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt index 817ed8f7a2..3c8079cefa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.errors.txt @@ -1,14 +1,16 @@ -cls.js(6,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. +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 (1 errors) ==== +==== cls.js (2 errors) ==== const Strings = { a: "A", b: "B" }; class Foo {} module.exports = Foo; - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. -!!! related TS2728 cls.js:7:1: 'Strings' is declared here. - module.exports.Strings = Strings; \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~ +!!! 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/jsDeclarationsExportSubAssignments.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols index e69d74a67e..b68cc7cae5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols @@ -15,16 +15,14 @@ class Foo {} >Foo : Symbol(Foo, Decl(cls.js, 3, 2)) module.exports = Foo; ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) +>exports : Symbol(Foo, Decl(cls.js, 3, 2)) >Foo : Symbol(Foo, Decl(cls.js, 3, 2)) module.exports.Strings = Strings; ->module.exports.Strings : Symbol(Strings, Decl(cls.js, 5, 21)) ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) ->Strings : Symbol(Strings, Decl(cls.js, 5, 21)) +>exports : Symbol(Foo, Decl(cls.js, 3, 2)) >Strings : Symbol(Strings, Decl(cls.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff index 68dca6f807..1b0ce33d43 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.symbols.diff @@ -7,19 +7,19 @@ ->module.exports : Symbol(module.exports, Decl(cls.js, 0, 0)) ->module : Symbol(export=, Decl(cls.js, 4, 12)) ->exports : Symbol(export=, Decl(cls.js, 4, 12)) -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>exports : Symbol(Foo, Decl(cls.js, 3, 2)) >Foo : Symbol(Foo, Decl(cls.js, 3, 2)) module.exports.Strings = Strings; - >module.exports.Strings : Symbol(Strings, Decl(cls.js, 5, 21)) +->module.exports.Strings : Symbol(Strings, Decl(cls.js, 5, 21)) ->module.exports : Symbol(Strings, Decl(cls.js, 5, 21)) ->module : Symbol(module, Decl(cls.js, 4, 12)) ->exports : Symbol(module.exports, Decl(cls.js, 0, 0)) -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +->Strings : Symbol(Strings, Decl(cls.js, 5, 21)) ++>module.exports : Symbol(Foo, Decl(cls.js, 3, 2)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) - >Strings : Symbol(Strings, Decl(cls.js, 5, 21)) ++>exports : Symbol(Foo, Decl(cls.js, 3, 2)) >Strings : Symbol(Strings, Decl(cls.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types index 87899d1d51..2bc348dc16 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportSubAssignments.types @@ -19,17 +19,17 @@ class Foo {} module.exports = Foo; >module.exports = Foo : typeof Foo ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") +>module.exports : typeof Foo +>module : { Foo: typeof Foo; } +>exports : typeof Foo >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } ->module.exports.Strings : { a: string; b: string; } ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") ->Strings : { a: string; b: string; } +>module.exports.Strings : any +>module.exports : typeof Foo +>module : { Foo: typeof Foo; } +>exports : typeof Foo +>Strings : any >Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols index b3e741478b..015b3ca595 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols @@ -12,9 +12,9 @@ function Timer(timeout) { >timeout : Symbol(timeout, Decl(timer.js, 3, 15)) } module.exports = Timer; ->module.exports : Symbol("timer", Decl(timer.js, 0, 0)) +>module.exports : Symbol(Timer, Decl(timer.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("timer", Decl(timer.js, 0, 0)) +>exports : Symbol(Timer, Decl(timer.js, 0, 0)) >Timer : Symbol(Timer, Decl(timer.js, 0, 0)) === hook.js === @@ -32,9 +32,9 @@ function Hook(handle) { >handle : Symbol(handle, Decl(hook.js, 6, 14)) } module.exports = Hook; ->module.exports : Symbol("hook", Decl(hook.js, 0, 0)) +>module.exports : Symbol(Hook, Decl(hook.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("hook", Decl(hook.js, 0, 0)) +>exports : Symbol(Hook, Decl(hook.js, 0, 0)) >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === @@ -103,8 +103,8 @@ Context.prototype = { } } module.exports = Context; ->module.exports : Symbol("context", Decl(context.js, 0, 0)) +>module.exports : Symbol(Context, Decl(context.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("context", Decl(context.js, 0, 0)) +>exports : Symbol(Context, Decl(context.js, 0, 0)) >Context : Symbol(Context, Decl(context.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff index c328b520d3..6090b4fc1c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.symbols.diff @@ -13,9 +13,9 @@ ->module.exports : Symbol(module.exports, Decl(timer.js, 0, 0)) ->module : Symbol(export=, Decl(timer.js, 5, 1)) ->exports : Symbol(export=, Decl(timer.js, 5, 1)) -+>module.exports : Symbol("timer", Decl(timer.js, 0, 0)) ++>module.exports : Symbol(Timer, Decl(timer.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("timer", Decl(timer.js, 0, 0)) ++>exports : Symbol(Timer, Decl(timer.js, 0, 0)) >Timer : Symbol(Timer, Decl(timer.js, 0, 0)) === hook.js === @@ -32,9 +32,9 @@ ->module.exports : Symbol(module.exports, Decl(hook.js, 0, 0)) ->module : Symbol(export=, Decl(hook.js, 8, 1)) ->exports : Symbol(export=, Decl(hook.js, 8, 1)) -+>module.exports : Symbol("hook", Decl(hook.js, 0, 0)) ++>module.exports : Symbol(Hook, Decl(hook.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("hook", Decl(hook.js, 0, 0)) ++>exports : Symbol(Hook, Decl(hook.js, 0, 0)) >Hook : Symbol(Hook, Decl(hook.js, 0, 0)) === context.js === @@ -81,8 +81,8 @@ ->module : Symbol(export=, Decl(context.js, 46, 1)) ->exports : Symbol(export=, Decl(context.js, 46, 1)) ->Context : Symbol(Context, Decl(context.js, 0, 0), Decl(context.js, 36, 1)) -+>module.exports : Symbol("context", Decl(context.js, 0, 0)) ++>module.exports : Symbol(Context, Decl(context.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("context", Decl(context.js, 0, 0)) ++>exports : Symbol(Context, Decl(context.js, 0, 0)) +>Context : Symbol(Context, Decl(context.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types index 39386d9c57..5732a3c707 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types @@ -17,9 +17,9 @@ function Timer(timeout) { } module.exports = Timer; >module.exports = Timer : (timeout: number) => void ->module.exports : typeof import("timer") ->module : { "timer": typeof import("timer"); } ->exports : typeof import("timer") +>module.exports : (timeout: number) => void +>module : { Timer: (timeout: number) => void; } +>exports : (timeout: number) => void >Timer : (timeout: number) => void === hook.js === @@ -42,9 +42,9 @@ function Hook(handle) { } module.exports = Hook; >module.exports = Hook : (handle: HookHandler) => void ->module.exports : typeof import("hook") ->module : { "hook": typeof import("hook"); } ->exports : typeof import("hook") +>module.exports : (handle: HookHandler) => void +>module : { Hook: (handle: HookHandler) => void; } +>exports : (handle: HookHandler) => void >Hook : (handle: HookHandler) => void === context.js === @@ -132,8 +132,8 @@ Context.prototype = { } module.exports = Context; >module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ->module.exports : typeof import("context") ->module : { "context": typeof import("context"); } ->exports : typeof import("context") +>module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; }; } +>exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } >Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types index cf209b5387..8946c4eb88 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses.types @@ -46,8 +46,8 @@ import {Point} from "./source"; * @param {Point} p */ export function magnitude(p) { ->magnitude : (p: any) => number ->p : any +>magnitude : (p: Point) => number +>p : Point return Math.sqrt(p.x ** 2 + p.y ** 2); >Math.sqrt(p.x ** 2 + p.y ** 2) : number @@ -57,12 +57,12 @@ export function magnitude(p) { >p.x ** 2 + p.y ** 2 : number >p.x ** 2 : number >p.x : any ->p : any +>p : Point >x : any >2 : 2 >p.y ** 2 : number >p.y : any ->p : any +>p : Point >y : any >2 : 2 } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols index ddcf600ae6..c192b9ad18 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols @@ -2,9 +2,9 @@ === source.js === module.exports = MyClass; ->module.exports : Symbol("source", Decl(source.js, 0, 0)) +>module.exports : Symbol(MyClass, Decl(source.js, 0, 25)) >module : Symbol(module.exports) ->exports : Symbol("source", Decl(source.js, 0, 0)) +>exports : Symbol(MyClass, Decl(source.js, 0, 25)) >MyClass : Symbol(MyClass, Decl(source.js, 0, 25)) function MyClass() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff index 2bc7f1bc37..649df7c51c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.symbols.diff @@ -8,9 +8,9 @@ ->module : Symbol(export=, Decl(source.js, 0, 0)) ->exports : Symbol(export=, Decl(source.js, 0, 0)) ->MyClass : Symbol(MyClass, Decl(source.js, 0, 25), Decl(source.js, 2, 21), Decl(source.js, 4, 40)) -+>module.exports : Symbol("source", Decl(source.js, 0, 0)) ++>module.exports : Symbol(MyClass, Decl(source.js, 0, 25)) +>module : Symbol(module.exports) -+>exports : Symbol("source", Decl(source.js, 0, 0)) ++>exports : Symbol(MyClass, Decl(source.js, 0, 25)) +>MyClass : Symbol(MyClass, Decl(source.js, 0, 25)) function MyClass() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types index 301c3f8b5a..63d7a95b46 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.types @@ -3,9 +3,9 @@ === source.js === module.exports = MyClass; >module.exports = MyClass : { (): void; staticMethod: () => void; staticProperty: number; } ->module.exports : typeof import("source") ->module : { "source": typeof import("source"); } ->exports : typeof import("source") +>module.exports : { (): void; staticMethod: () => void; staticProperty: number; } +>module : { MyClass: { (): void; staticMethod: () => void; staticProperty: number; }; } +>exports : { (): void; staticMethod: () => void; staticProperty: number; } >MyClass : { (): void; staticMethod: () => void; staticProperty: number; } function MyClass() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols index eb6f942821..5d9024d83e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols @@ -17,8 +17,8 @@ foo.default = foo; >foo : Symbol(foo, Decl(index.js, 0, 0)) module.exports = foo; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(foo, Decl(index.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(foo, Decl(index.js, 0, 0)) >foo : Symbol(foo, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff index 6de015ffad..1447d1d8b4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.symbols.diff @@ -32,8 +32,8 @@ ->module : Symbol(export=, Decl(index.js, 3, 18)) ->exports : Symbol(export=, Decl(index.js, 3, 18)) ->foo : Symbol(foo, Decl(index.js, 0, 0), Decl(index.js, 0, 17), Decl(index.js, 2, 14)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(foo, Decl(index.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(foo, Decl(index.js, 0, 0)) +>foo : Symbol(foo, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types index 7179860fd4..3a3a17dfee 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types @@ -20,8 +20,8 @@ foo.default = foo; module.exports = foo; >module.exports = foo : { (): void; foo: ???; default: ???; } ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : { (): void; foo: ???; default: ???; } +>module : { foo: { (): void; foo: ???; default: ???; }; } +>exports : { (): void; foo: ???; default: ???; } >foo : { (): void; foo: ???; default: ???; } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols index 8127b75c26..8368b6c6a0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols @@ -12,9 +12,9 @@ const x = {x: 12}; >x : Symbol(x, Decl(mod1.js, 6, 11)) module.exports = x; ->module.exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(x, Decl(mod1.js, 6, 5)) >module : Symbol(module.exports) ->exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(x, Decl(mod1.js, 6, 5)) >x : Symbol(x, Decl(mod1.js, 6, 5)) === index.js === @@ -24,8 +24,8 @@ const items = [{x: 12}]; >x : Symbol(x, Decl(index.js, 1, 16)) module.exports = items; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(items, Decl(index.js, 1, 5)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(items, Decl(index.js, 1, 5)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff index a3b3eb1e9e..0ece6b780b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 6, 18)) ->exports : Symbol(export=, Decl(mod1.js, 6, 18)) -+>module.exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(x, Decl(mod1.js, 6, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("folder/mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(x, Decl(mod1.js, 6, 5)) >x : Symbol(x, Decl(mod1.js, 6, 5)) === index.js === @@ -20,8 +20,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 1, 24)) ->exports : Symbol(export=, Decl(index.js, 1, 24)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(items, Decl(index.js, 1, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(items, Decl(index.js, 1, 5)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types index 4c7880d0ce..4eb595b0e1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportTypeBundled.types @@ -15,24 +15,24 @@ const x = {x: 12}; module.exports = x; >module.exports = x : { x: number; } ->module.exports : typeof import("folder/mod1") ->module : { "folder/mod1": typeof import("folder/mod1"); } ->exports : typeof import("folder/mod1") +>module.exports : { x: number; } +>module : { readonly x: { x: number; }; } +>exports : { x: number; } >x : { x: number; } === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : typeof import("folder/mod1")[] +>items : { x: number; }[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number >12 : 12 module.exports = items; ->module.exports = items : typeof import("folder/mod1")[] ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") ->items : typeof import("folder/mod1")[] +>module.exports = items : { x: number; }[] +>module.exports : { x: number; }[] +>module : { readonly items: { x: number; }[]; } +>exports : { x: number; }[] +>items : { x: number; }[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols index de87894e97..b174264e65 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols @@ -7,9 +7,9 @@ const j = require("./obj.json"); >"./obj.json" : Symbol("obj", Decl(obj.json, 0, 0)) module.exports = j; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(export=, Decl(obj.json, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(export=, Decl(obj.json, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === obj.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff index be3d0def3d..bad8351c2f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 32)) ->exports : Symbol(export=, Decl(index.js, 0, 32)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(export=, Decl(obj.json, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(export=, Decl(obj.json, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === obj.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types index bca04a5e03..ce3292755b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson.types @@ -9,9 +9,9 @@ const j = require("./obj.json"); module.exports = j; >module.exports = j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +>module : { export=: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } +>exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } >j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } === obj.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols index 9124253fcc..023ee18f3d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols @@ -7,9 +7,9 @@ const j = require("./package.json"); >"./package.json" : Symbol("package", Decl(package.json, 0, 0)) module.exports = j; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(export=, Decl(package.json, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(export=, Decl(package.json, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === package.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff index 27c11ca079..cc31c515e9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 36)) ->exports : Symbol(export=, Decl(index.js, 0, 36)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(export=, Decl(package.json, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(export=, Decl(package.json, 0, 0)) >j : Symbol(j, Decl(index.js, 0, 5)) === package.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types index fae1fe9e11..0feebff08b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsPackageJson.types @@ -9,9 +9,9 @@ const j = require("./package.json"); module.exports = j; >module.exports = j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } +>module : { export=: { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; }; } +>exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } >j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } === package.json === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt index d0b6bfe341..eb9ed27e87 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt @@ -1,7 +1,8 @@ +base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. file.js(1,15): error TS1340: Module './base' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./base')'? -==== base.js (0 errors) ==== +==== base.js (1 errors) ==== class Base { constructor() {} } @@ -13,6 +14,8 @@ file.js(1,15): error TS1340: Module './base' does not refer to a type, but is us BaseFactory.Base = Base; module.exports = BaseFactory; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== file.js (1 errors) ==== /** @typedef {import('./base')} BaseFactory */ diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols index cd036a44e1..61b3252118 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols @@ -22,9 +22,9 @@ BaseFactory.Base = Base; >Base : Symbol(Base, Decl(base.js, 0, 0)) module.exports = BaseFactory; ->module.exports : Symbol("base", Decl(base.js, 0, 0)) +>module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) >module : Symbol(module.exports) ->exports : Symbol("base", Decl(base.js, 0, 0)) +>exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) >BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff index 98e0a27ca5..89eef0156e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.symbols.diff @@ -26,9 +26,9 @@ ->module : Symbol(export=, Decl(base.js, 8, 24)) ->exports : Symbol(export=, Decl(base.js, 8, 24)) ->BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2)) -+>module.exports : Symbol("base", Decl(base.js, 0, 0)) ++>module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("base", Decl(base.js, 0, 0)) ++>exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types index 0fc5b97bd1..9431695150 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types @@ -26,9 +26,9 @@ BaseFactory.Base = Base; module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } ->module.exports : typeof import("base") ->module : { "base": typeof import("base"); } ->exports : typeof import("base") +>module.exports : { (): Base; Base: typeof Base; } +>module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } +>exports : { (): Base; Base: typeof Base; } >BaseFactory : { (): Base; Base: typeof Base; } === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt new file mode 100644 index 0000000000..fef4bd8c6b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt @@ -0,0 +1,30 @@ +base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + + +==== base.js (1 errors) ==== + class Base { + constructor() {} + } + + const BaseFactory = () => { + return new Base(); + }; + + BaseFactory.Base = Base; + + module.exports = BaseFactory; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + +==== file.js (0 errors) ==== + /** @typedef {typeof import('./base')} BaseFactory */ + + /** + * + * @param {InstanceType} base + * @returns {InstanceType} + */ + const test = (base) => { + return base; + }; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols index 01b36f5cd6..982c22c1e1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols @@ -22,9 +22,9 @@ BaseFactory.Base = Base; >Base : Symbol(Base, Decl(base.js, 0, 0)) module.exports = BaseFactory; ->module.exports : Symbol("base", Decl(base.js, 0, 0)) +>module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) >module : Symbol(module.exports) ->exports : Symbol("base", Decl(base.js, 0, 0)) +>exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) >BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff index 1edbd55627..281186ce6c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.symbols.diff @@ -26,9 +26,9 @@ ->module : Symbol(export=, Decl(base.js, 8, 24)) ->exports : Symbol(export=, Decl(base.js, 8, 24)) ->BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2)) -+>module.exports : Symbol("base", Decl(base.js, 0, 0)) ++>module.exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("base", Decl(base.js, 0, 0)) ++>exports : Symbol(BaseFactory, Decl(base.js, 4, 5)) +>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5)) === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types index 1bcedcd4f2..dd819ce298 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types @@ -26,9 +26,9 @@ BaseFactory.Base = Base; module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } ->module.exports : typeof import("base") ->module : { "base": typeof import("base"); } ->exports : typeof import("base") +>module.exports : { (): Base; Base: typeof Base; } +>module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } +>exports : { (): Base; Base: typeof Base; } >BaseFactory : { (): Base; Base: typeof Base; } === file.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols index 0fa6b5afe1..87ad80b3c1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols @@ -5,14 +5,14 @@ class Foo {} >Foo : Symbol(Foo, Decl(cls.js, 0, 0)) module.exports = Foo; ->module.exports : Symbol("cls", Decl(cls.js, 0, 0)) +>module.exports : Symbol(Foo, Decl(cls.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("cls", Decl(cls.js, 0, 0)) +>exports : Symbol(Foo, Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 0, 0)) === usage.js === import {default as Fooa} from "./cls"; ->default : Symbol("cls", Decl(cls.js, 0, 0)) +>default : Symbol(Foo, Decl(cls.js, 0, 12)) >Fooa : Symbol(Fooa, Decl(usage.js, 0, 8)) export const x = new Fooa(); @@ -20,6 +20,6 @@ export const x = new Fooa(); >Fooa : Symbol(Fooa, Decl(usage.js, 0, 8)) export {default as Foob} from "./cls"; ->default : Symbol("cls", Decl(cls.js, 0, 0)) +>default : Symbol(Foo, Decl(cls.js, 0, 12)) >Foob : Symbol(Foob, Decl(usage.js, 4, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff index c0b96bd30a..1fdfd983b5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.symbols.diff @@ -7,15 +7,15 @@ ->module.exports : Symbol(module.exports, Decl(cls.js, 0, 0)) ->module : Symbol(export=, Decl(cls.js, 0, 12)) ->exports : Symbol(export=, Decl(cls.js, 0, 12)) -+>module.exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>module.exports : Symbol(Foo, Decl(cls.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("cls", Decl(cls.js, 0, 0)) ++>exports : Symbol(Foo, Decl(cls.js, 0, 0)) >Foo : Symbol(Foo, Decl(cls.js, 0, 0)) === usage.js === import {default as Fooa} from "./cls"; ->default : Symbol(export=, Decl(cls.js, 0, 12)) -+>default : Symbol("cls", Decl(cls.js, 0, 0)) ++>default : Symbol(Foo, Decl(cls.js, 0, 12)) >Fooa : Symbol(Fooa, Decl(usage.js, 0, 8)) export const x = new Fooa(); @@ -24,6 +24,6 @@ export {default as Foob} from "./cls"; ->default : Symbol(export=, Decl(cls.js, 0, 12)) -+>default : Symbol("cls", Decl(cls.js, 0, 0)) ++>default : Symbol(Foo, Decl(cls.js, 0, 12)) >Foob : Symbol(Foob, Decl(usage.js, 4, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types index 9c4c56d3c3..e3b5cdd547 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types @@ -6,22 +6,22 @@ class Foo {} module.exports = Foo; >module.exports = Foo : typeof Foo ->module.exports : typeof import("cls") ->module : { "cls": typeof import("cls"); } ->exports : typeof import("cls") +>module.exports : typeof Foo +>module : { Foo: typeof Foo; } +>exports : typeof Foo >Foo : typeof Foo === usage.js === import {default as Fooa} from "./cls"; ->default : typeof import("cls") ->Fooa : typeof import("cls") +>default : typeof Foo +>Fooa : typeof Foo export const x = new Fooa(); >x : Foo >new Fooa() : Foo ->Fooa : typeof import("cls") +>Fooa : typeof Foo export {default as Foob} from "./cls"; ->default : typeof import("cls") ->Foob : typeof import("cls") +>default : typeof Foo +>Foob : typeof Foo diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types index 911a448431..c11d9b3b3a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types @@ -13,10 +13,10 @@ let render = new Render(); >Render : typeof Render render.addRectangle(); ->render.addRectangle() : any ->render.addRectangle : () => any +>render.addRectangle() : Rectangle +>render.addRectangle : () => Rectangle >render : Render ->addRectangle : () => any +>addRectangle : () => Rectangle console.log("Objects", render.objects); >console.log("Objects", render.objects) : void @@ -78,7 +78,7 @@ class Render { * @returns {Rectangle} the rect */ addRectangle() { ->addRectangle : () => any +>addRectangle : () => Rectangle const obj = new Rectangle(); >obj : Rectangle diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols index 89f6665250..6a34e25da5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols @@ -20,8 +20,8 @@ const items = []; >items : Symbol(items, Decl(index.js, 1, 5)) module.exports = items; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(items, Decl(index.js, 1, 5)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(items, Decl(index.js, 1, 5)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff index 8e859f03cb..fb55ebe2f5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.symbols.diff @@ -16,8 +16,8 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 1, 17)) ->exports : Symbol(export=, Decl(index.js, 1, 17)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(items, Decl(index.js, 1, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(items, Decl(index.js, 1, 5)) >items : Symbol(items, Decl(index.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types index 7eb6f338ea..41589f0d1e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types @@ -19,8 +19,8 @@ const items = []; module.exports = items; >module.exports = items : Item[] ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : Item[] +>module : { readonly items: Item[]; } +>exports : Item[] >items : Item[] diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols index 8202049806..6f1f52ce7b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols @@ -5,9 +5,9 @@ const items = require("./some-mod")(); >items : Symbol(items, Decl(index.js, 0, 5)) module.exports = items; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(items, Decl(index.js, 0, 5)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(items, Decl(index.js, 0, 5)) >items : Symbol(items, Decl(index.js, 0, 5)) === some-mod.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff index c45be0e1bc..b446b0f974 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.symbols.diff @@ -11,9 +11,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 0, 38)) ->exports : Symbol(export=, Decl(index.js, 0, 38)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(items, Decl(index.js, 0, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(items, Decl(index.js, 0, 5)) >items : Symbol(items, Decl(index.js, 0, 5)) === some-mod.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types index ed842ce680..40ff68dc81 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types @@ -10,9 +10,9 @@ const items = require("./some-mod")(); module.exports = items; >module.exports = items : any ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : any +>module : { readonly items: any; } +>exports : any >items : any === some-mod.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols index ed89640fe2..9c06625b4c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols @@ -17,9 +17,9 @@ class Conn { } module.exports = Conn; ->module.exports : Symbol("conn", Decl(conn.js, 0, 0)) +>module.exports : Symbol(Conn, Decl(conn.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("conn", Decl(conn.js, 0, 0)) +>exports : Symbol(Conn, Decl(conn.js, 0, 0)) >Conn : Symbol(Conn, Decl(conn.js, 0, 0)) === usage.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff index 753d34e9bc..612c925f9d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.symbols.diff @@ -16,9 +16,9 @@ ->module.exports : Symbol(module.exports, Decl(conn.js, 0, 0)) ->module : Symbol(export=, Decl(conn.js, 8, 1)) ->exports : Symbol(export=, Decl(conn.js, 8, 1)) -+>module.exports : Symbol("conn", Decl(conn.js, 0, 0)) ++>module.exports : Symbol(Conn, Decl(conn.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("conn", Decl(conn.js, 0, 0)) ++>exports : Symbol(Conn, Decl(conn.js, 0, 0)) >Conn : Symbol(Conn, Decl(conn.js, 0, 0)) === usage.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types index c87313a8a3..b2cfda6619 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndImportTypes.types @@ -19,9 +19,9 @@ class Conn { module.exports = Conn; >module.exports = Conn : typeof Conn ->module.exports : typeof import("conn") ->module : { "conn": typeof import("conn"); } ->exports : typeof import("conn") +>module.exports : typeof Conn +>module : { Conn: typeof Conn; } +>exports : typeof Conn >Conn : typeof Conn === usage.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols index 091a6faea5..32610b29dd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols @@ -41,8 +41,8 @@ class LazySet { } module.exports = LazySet; ->module.exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) +>module.exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) +>exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff index 0e658cd204..1e12a162c8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.symbols.diff @@ -34,8 +34,8 @@ ->module.exports : Symbol(module.exports, Decl(LazySet.js, 0, 0)) ->module : Symbol(export=, Decl(LazySet.js, 10, 1)) ->exports : Symbol(export=, Decl(LazySet.js, 10, 1)) -+>module.exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) ++>module.exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("LazySet", Decl(LazySet.js, 0, 0)) ++>exports : Symbol(LazySet, Decl(LazySet.js, 0, 0)) >LazySet : Symbol(LazySet, Decl(LazySet.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types index 6bd6c18df9..7690579039 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefAndLatebound.types @@ -2,8 +2,8 @@ === index.js === const LazySet = require("./LazySet"); ->LazySet : typeof import("LazySet") ->require("./LazySet") : typeof import("LazySet") +>LazySet : typeof LazySet +>require("./LazySet") : typeof LazySet >require : any >"./LazySet" : "./LazySet" @@ -44,8 +44,8 @@ class LazySet { module.exports = LazySet; >module.exports = LazySet : typeof LazySet ->module.exports : typeof import("LazySet") ->module : { "LazySet": typeof import("LazySet"); } ->exports : typeof import("LazySet") +>module.exports : typeof LazySet +>module : { LazySet: typeof LazySet; } +>exports : typeof LazySet >LazySet : typeof LazySet diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index be9185a225..383deeead4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -30,9 +30,9 @@ class MainThreadTasks { } module.exports = MainThreadTasks; ->module.exports : Symbol("index", Decl(index.js, 0, 0)) +>module.exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >module : Symbol(module.exports) ->exports : Symbol("index", Decl(index.js, 0, 0)) +>exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) === module.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index 63fa5eb8cd..80cb2b4d97 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 18, 1)) ->exports : Symbol(export=, Decl(index.js, 18, 1)) -+>module.exports : Symbol("index", Decl(index.js, 0, 0)) ++>module.exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) +>module : Symbol(module.exports) -+>exports : Symbol("index", Decl(index.js, 0, 0)) ++>exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) === module.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index b9c28fe338..c26f71c094 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -32,9 +32,9 @@ class MainThreadTasks { module.exports = MainThreadTasks; >module.exports = MainThreadTasks : typeof MainThreadTasks ->module.exports : typeof import("index") ->module : { "index": typeof import("index"); } ->exports : typeof import("index") +>module.exports : typeof MainThreadTasks +>module : { MainThreadTasks: typeof MainThreadTasks; } +>exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks === module.js === diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols index 2d9cadee8c..93fb6896b8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols @@ -45,8 +45,8 @@ class Chunk { } } module.exports = Chunk; ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) >Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff index e88dd8dde8..f46c241539 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff @@ -33,8 +33,8 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 5, 1)) ->exports : Symbol(export=, Decl(mod1.js, 5, 1)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) >Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types index e3c0da626e..f2014f2aca 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types @@ -13,8 +13,8 @@ c.chunk; >chunk : any const D = require("./mod1"); ->D : typeof import("mod1") ->require("./mod1") : typeof import("mod1") +>D : typeof Chunk +>require("./mod1") : typeof Chunk >require : (name: string) => any >"./mod1" : "./mod1" @@ -55,8 +55,8 @@ class Chunk { } module.exports = Chunk; >module.exports = Chunk : typeof Chunk ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") +>module.exports : typeof Chunk +>module : { Chunk: typeof Chunk; } +>exports : typeof Chunk >Chunk : typeof Chunk diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols index e1656ebdbf..3ee8f67b2d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols @@ -42,8 +42,8 @@ class MW { } module.exports = MW; ->module.exports : Symbol("MW", Decl(MW.js, 0, 0)) +>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("MW", Decl(MW.js, 0, 0)) +>exports : Symbol(MW, Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff index e4723af57e..61a7b3444e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff @@ -33,8 +33,8 @@ ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -+>module.exports : Symbol("MW", Decl(MW.js, 0, 0)) ++>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("MW", Decl(MW.js, 0, 0)) ++>exports : Symbol(MW, Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types index 169025c5b0..f02de57cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : typeof import("MW") ->require("./MW") : typeof import("MW") +>MW : typeof MW +>require("./MW") : typeof MW >require : any >"./MW" : "./MW" @@ -22,7 +22,7 @@ module.exports = class MC { return new MW(this); >new MW(this) : MW ->MW : typeof import("MW") +>MW : typeof MW >this : this } }; @@ -50,8 +50,8 @@ class MW { module.exports = MW; >module.exports = MW : typeof MW ->module.exports : typeof import("MW") ->module : { "MW": typeof import("MW"); } ->exports : typeof import("MW") +>module.exports : typeof MW +>module : { MW: typeof MW; } +>exports : typeof MW >MW : typeof MW diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols index d6f96ad615..1c27613be4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols @@ -44,8 +44,8 @@ class MW { } module.exports = MW; ->module.exports : Symbol("MW", Decl(MW.js, 0, 0)) +>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) >module : Symbol(module.exports) ->exports : Symbol("MW", Decl(MW.js, 0, 0)) +>exports : Symbol(MW, Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff index 94c0abbee0..71368dfa96 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff @@ -26,8 +26,8 @@ ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -+>module.exports : Symbol("MW", Decl(MW.js, 0, 0)) ++>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) -+>exports : Symbol("MW", Decl(MW.js, 0, 0)) ++>exports : Symbol(MW, Decl(MW.js, 0, 0)) >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types index 936756067b..8e53ae07de 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : typeof import("MW") ->require("./MW") : typeof import("MW") +>MW : typeof MW +>require("./MW") : typeof MW >require : any >"./MW" : "./MW" @@ -25,7 +25,7 @@ module.exports = function MC() { return new MW(x); >new MW(x) : MW ->MW : typeof import("MW") +>MW : typeof MW >x : any }; @@ -53,8 +53,8 @@ class MW { module.exports = MW; >module.exports = MW : typeof MW ->module.exports : typeof import("MW") ->module : { "MW": typeof import("MW"); } ->exports : typeof import("MW") +>module.exports : typeof MW +>module : { MW: typeof MW; } +>exports : typeof MW >MW : typeof MW diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt index 5f2b7fe3f9..e5b61208a5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.errors.txt @@ -1,22 +1,16 @@ -Eloquent.js(2,1): error TS2349: This expression is not callable. - Type '{}' has no call signatures. -Eloquent.js(5,1): error TS1233: An export declaration can only be used at the top level of a namespace or module. +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) ==== // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript (function() { - ~~~~~~~~~~~~~ exports.bigOak = 1 - ~~~~~~~~~~~~~~~~~~ exports.everywhere = 2 - ~~~~~~~~~~~~~~~~~~~~~~ module.exports = exports - ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ -!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. +!!! 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. })() - ~~ -!!! error TS2349: This expression is not callable. -!!! error TS2349: Type '{}' has no call signatures. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types index 45ee509a46..9c872cbe80 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasExports.types @@ -3,9 +3,9 @@ === Eloquent.js === // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript (function() { ->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : any ->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : {} ->function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : {} +>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : void +>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : () => void +>function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : () => void exports.bigOak = 1 >exports.bigOak = 1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt index 9674549fd0..6eb423476b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.errors.txt @@ -1,13 +1,18 @@ -bug28014.js(3,1): error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. +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 (1 errors) ==== +==== bug28014.js (3 errors) ==== exports.version = 1 + ~~~~~~~ +!!! error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. function alias() { } module.exports = alias - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. -!!! related TS2728 bug28014.js:1:1: 'version' is declared here. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! 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/moduleExportAliasImported.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols index b6215493e4..7f1206e1a5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols @@ -2,17 +2,15 @@ === bug28014.js === exports.version = 1 ->exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) >exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) ->version : Symbol(version, Decl(bug28014.js, 0, 0)) function alias() { } >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) module.exports = alias ->module.exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) +>module.exports : Symbol(alias, Decl(bug28014.js, 0, 19)) >module : Symbol(module.exports) ->exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) +>exports : Symbol(alias, Decl(bug28014.js, 0, 19)) >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) === importer.js === diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff index a5707563ea..e7cff875e6 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.symbols.diff @@ -1,12 +1,13 @@ --- old.moduleExportAliasImported.symbols +++ new.moduleExportAliasImported.symbols -@@= skipped -2, +2 lines =@@ +@@= skipped -1, +1 lines =@@ + === bug28014.js === exports.version = 1 - >exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) +->exports.version : Symbol(version, Decl(bug28014.js, 0, 0)) ->exports : Symbol(version, Decl(bug28014.js, 0, 0)) +->version : Symbol(version, Decl(bug28014.js, 0, 0)) +>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) - >version : Symbol(version, Decl(bug28014.js, 0, 0)) function alias() { } >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) @@ -15,9 +16,9 @@ ->module.exports : Symbol(module.exports, Decl(bug28014.js, 0, 0)) ->module : Symbol(export=, Decl(bug28014.js, 1, 20)) ->exports : Symbol(export=, Decl(bug28014.js, 1, 20)) -+>module.exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) ++>module.exports : Symbol(alias, Decl(bug28014.js, 0, 19)) +>module : Symbol(module.exports) -+>exports : Symbol("bug28014", Decl(bug28014.js, 0, 0)) ++>exports : Symbol(alias, Decl(bug28014.js, 0, 19)) >alias : Symbol(alias, Decl(bug28014.js, 0, 19)) === importer.js === diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types index da86ed1f71..efd5fe7f64 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAliasImported.types @@ -3,9 +3,9 @@ === bug28014.js === exports.version = 1 >exports.version = 1 : 1 ->exports.version : 1 +>exports.version : any >exports : typeof import("bug28014") ->version : 1 +>version : any >1 : 1 function alias() { } @@ -13,13 +13,13 @@ function alias() { } module.exports = alias >module.exports = alias : () => void ->module.exports : typeof import("bug28014") ->module : { "bug28014": typeof import("bug28014"); } ->exports : typeof import("bug28014") +>module.exports : () => void +>module : { alias: () => void; } +>exports : () => void >alias : () => void === importer.js === import('./bug28014') ->import('./bug28014') : Promise +>import('./bug28014') : Promise<() => void> >'./bug28014' : "./bug28014" diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt index 375e48bb75..817b5b7b5b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.errors.txt @@ -1,7 +1,8 @@ -axios.js(9,1): error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. +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 (1 errors) ==== +==== axios.js (2 errors) ==== class Axios { constructor() { } @@ -11,8 +12,9 @@ axios.js(9,1): error TS2741: Property 'default' is missing in type 'Axios' but r // none of the 3 references should have a use-before-def error axios.m() module.exports = axios; - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. -!!! related TS2728 axios.js:10:1: 'default' is declared here. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! 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'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols index 170109f48c..e1144e754b 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols @@ -20,16 +20,14 @@ axios.m() >m : Symbol(m, Decl(axios.js, 2, 5)) module.exports = axios; ->module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) >module : Symbol(module.exports) ->exports : Symbol("axios", Decl(axios.js, 0, 0)) +>exports : Symbol(axios, Decl(axios.js, 5, 3)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) module.exports.default = axios; ->module.exports.default : Symbol(default, Decl(axios.js, 8, 23)) ->module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) >module : Symbol(module.exports) ->exports : Symbol("axios", Decl(axios.js, 0, 0)) ->default : Symbol(default, Decl(axios.js, 8, 23)) +>exports : Symbol(axios, Decl(axios.js, 5, 3)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff index 112e0616a0..c773d65dd9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.symbols.diff @@ -23,19 +23,19 @@ ->module.exports : Symbol(module.exports, Decl(axios.js, 0, 0)) ->module : Symbol(export=, Decl(axios.js, 7, 9)) ->exports : Symbol(export=, Decl(axios.js, 7, 9)) -+>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) ++>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) +>module : Symbol(module.exports) -+>exports : Symbol("axios", Decl(axios.js, 0, 0)) ++>exports : Symbol(axios, Decl(axios.js, 5, 3)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) module.exports.default = axios; - >module.exports.default : Symbol(default, Decl(axios.js, 8, 23)) +->module.exports.default : Symbol(default, Decl(axios.js, 8, 23)) ->module.exports : Symbol(default, Decl(axios.js, 8, 23)) ->module : Symbol(module, Decl(axios.js, 7, 9)) ->exports : Symbol(module.exports, Decl(axios.js, 0, 0)) -+>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +->default : Symbol(default, Decl(axios.js, 8, 23)) ++>module.exports : Symbol(axios, Decl(axios.js, 5, 3)) +>module : Symbol(module.exports) -+>exports : Symbol("axios", Decl(axios.js, 0, 0)) - >default : Symbol(default, Decl(axios.js, 8, 23)) ++>exports : Symbol(axios, Decl(axios.js, 5, 3)) >axios : Symbol(axios, Decl(axios.js, 5, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types index 7d272b05cd..68d421dd4e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment5.types @@ -23,17 +23,17 @@ axios.m() module.exports = axios; >module.exports = axios : Axios ->module.exports : typeof import("axios") ->module : { "axios": typeof import("axios"); } ->exports : typeof import("axios") +>module.exports : Axios +>module : { axios: Axios; } +>exports : Axios >axios : Axios module.exports.default = axios; >module.exports.default = axios : Axios ->module.exports.default : Axios ->module.exports : typeof import("axios") ->module : { "axios": typeof import("axios"); } ->exports : typeof import("axios") ->default : Axios +>module.exports.default : any +>module.exports : Axios +>module : { axios: Axios; } +>exports : Axios +>default : any >axios : Axios diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt index aa59b0e8f8..3867a2f253 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.errors.txt @@ -1,11 +1,13 @@ -axios.js(2,1): error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. +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 (1 errors) ==== +==== axios.js (2 errors) ==== var axios = {} module.exports = axios // both assignments should be ok - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. -!!! related TS2728 axios.js:3:1: 'default' is declared here. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols index eb124d3edf..49ff0d0d69 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols @@ -5,16 +5,14 @@ var axios = {} >axios : Symbol(axios, Decl(axios.js, 0, 3)) module.exports = axios // both assignments should be ok ->module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) >module : Symbol(module.exports) ->exports : Symbol("axios", Decl(axios.js, 0, 0)) +>exports : Symbol(axios, Decl(axios.js, 0, 3)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) module.exports.default = axios ->module.exports.default : Symbol(default, Decl(axios.js, 1, 22)) ->module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) >module : Symbol(module.exports) ->exports : Symbol("axios", Decl(axios.js, 0, 0)) ->default : Symbol(default, Decl(axios.js, 1, 22)) +>exports : Symbol(axios, Decl(axios.js, 0, 3)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff index 1ec15ff63c..83a0272583 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.symbols.diff @@ -7,19 +7,19 @@ ->module.exports : Symbol(module.exports, Decl(axios.js, 0, 0)) ->module : Symbol(export=, Decl(axios.js, 0, 14)) ->exports : Symbol(export=, Decl(axios.js, 0, 14)) -+>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) ++>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) +>module : Symbol(module.exports) -+>exports : Symbol("axios", Decl(axios.js, 0, 0)) ++>exports : Symbol(axios, Decl(axios.js, 0, 3)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) module.exports.default = axios - >module.exports.default : Symbol(default, Decl(axios.js, 1, 22)) +->module.exports.default : Symbol(default, Decl(axios.js, 1, 22)) ->module.exports : Symbol(default, Decl(axios.js, 1, 22)) ->module : Symbol(module, Decl(axios.js, 0, 14)) ->exports : Symbol(module.exports, Decl(axios.js, 0, 0)) -+>module.exports : Symbol("axios", Decl(axios.js, 0, 0)) +->default : Symbol(default, Decl(axios.js, 1, 22)) ++>module.exports : Symbol(axios, Decl(axios.js, 0, 3)) +>module : Symbol(module.exports) -+>exports : Symbol("axios", Decl(axios.js, 0, 0)) - >default : Symbol(default, Decl(axios.js, 1, 22)) ++>exports : Symbol(axios, Decl(axios.js, 0, 3)) >axios : Symbol(axios, Decl(axios.js, 0, 3)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types index 0234144941..722a2dd211 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportPropertyAssignmentDefault.types @@ -7,17 +7,17 @@ var axios = {} module.exports = axios // both assignments should be ok >module.exports = axios : {} ->module.exports : typeof import("axios") ->module : { "axios": typeof import("axios"); } ->exports : typeof import("axios") +>module.exports : {} +>module : { axios: {}; } +>exports : {} >axios : {} module.exports.default = axios >module.exports.default = axios : {} ->module.exports.default : {} ->module.exports : typeof import("axios") ->module : { "axios": typeof import("axios"); } ->exports : typeof import("axios") ->default : {} +>module.exports.default : any +>module.exports : {} +>module : { axios: {}; } +>exports : {} +>default : any >axios : {} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt index 55e3fe8ed7..040e68925d 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt @@ -1,36 +1,41 @@ -a.js(4,17): error TS2339: Property 'toFixed' does not exist on type '"string"'. -a.js(5,16): error TS2339: Property 'toFixed' does not exist on type '"string"'. -mod1.js(6,1): error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. +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; }'. -==== a.js (2 errors) ==== +==== a.js (1 errors) ==== /// var mod1 = require('./mod1') mod1.justExport.toFixed() mod1.bothBefore.toFixed() // error - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.bothAfter.toFixed() - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.justProperty.length + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; declare function require(name: string): any; -==== mod1.js (1 errors) ==== +==== mod1.js (4 errors) ==== /// module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. A.justExport = 4 A.bothBefore = 2 A.bothAfter = 3 module.exports = A - ~~~~~~~~~~~~~~ -!!! error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. -!!! related TS2728 mod1.js:11:1: 'justProperty' is declared here. + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. function A() { this.p = 1 } module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. module.exports.justProperty = 'string' + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols index 4d8dfaf803..b236c055da 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols @@ -15,21 +15,21 @@ mod1.justExport.toFixed() >toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error ->mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) +>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() ->mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) +>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) ->mod1.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->length : Symbol(length, Decl(lib.es5.d.ts, --, --)) === requires.d.ts === declare var module: { exports: any }; @@ -43,11 +43,11 @@ declare function require(name: string): any; === mod1.js === /// module.exports.bothBefore = 'string' ->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) A.justExport = 4 >A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) @@ -65,9 +65,9 @@ A.bothAfter = 3 >bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) module.exports = A ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) >A : Symbol(A, Decl(mod1.js, 5, 18)) function A() { @@ -76,16 +76,14 @@ function A() { this.p = 1 } module.exports.bothAfter = 'string' ->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff index ab63989b53..db17845530 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff @@ -16,28 +16,28 @@ mod1.bothBefore.toFixed() // error ->mod1.bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -+>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ++>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() ->mod1.bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -+>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) ++>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ->mod1.justProperty : Symbol(mod1.justProperty, Decl(mod1.js, 9, 35)) -+>mod1.justProperty.length : Symbol(length, Decl(lib.es5.d.ts, --, --)) -+>mod1.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->justProperty : Symbol(mod1.justProperty, Decl(mod1.js, 9, 35)) ->length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) -+>justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) -+>length : Symbol(length, Decl(lib.es5.d.ts, --, --)) === requires.d.ts === declare var module: { exports: any }; @@ -50,11 +50,11 @@ ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -+>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -+>bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) A.justExport = 4 ->A.justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) @@ -85,9 +85,9 @@ ->module : Symbol(export=, Decl(mod1.js, 4, 15)) ->exports : Symbol(export=, Decl(mod1.js, 4, 15)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) function A() { @@ -105,19 +105,19 @@ ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -+>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -+>bothAfter : Symbol(bothAfter, Decl(mod1.js, 8, 1)) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) module.exports.justProperty = 'string' - >module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) +->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) - >justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types index 75c7fc3bfc..48e342babc 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types @@ -3,8 +3,8 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : typeof import("mod1") ->require('./mod1') : typeof import("mod1") +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" @@ -12,32 +12,32 @@ mod1.justExport.toFixed() >mod1.justExport.toFixed() : string >mod1.justExport.toFixed : (fractionDigits?: number) => string >mod1.justExport : number ->mod1 : typeof import("mod1") +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >justExport : number >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error ->mod1.bothBefore.toFixed() : any ->mod1.bothBefore.toFixed : any ->mod1.bothBefore : "string" ->mod1 : typeof import("mod1") ->bothBefore : "string" ->toFixed : any +>mod1.bothBefore.toFixed() : string +>mod1.bothBefore.toFixed : (fractionDigits?: number) => string +>mod1.bothBefore : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() ->mod1.bothAfter.toFixed() : any ->mod1.bothAfter.toFixed : any ->mod1.bothAfter : "string" ->mod1 : typeof import("mod1") ->bothAfter : "string" ->toFixed : any +>mod1.bothAfter.toFixed() : string +>mod1.bothAfter.toFixed : (fractionDigits?: number) => string +>mod1.bothAfter : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>toFixed : (fractionDigits?: number) => string mod1.justProperty.length ->mod1.justProperty.length : number ->mod1.justProperty : "string" ->mod1 : typeof import("mod1") ->justProperty : "string" ->length : number +>mod1.justProperty.length : any +>mod1.justProperty : any +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>length : any === requires.d.ts === declare var module: { exports: any }; @@ -52,11 +52,11 @@ declare function require(name: string): any; /// module.exports.bothBefore = 'string' >module.exports.bothBefore = 'string' : "string" ->module.exports.bothBefore : "string" ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") ->bothBefore : "string" +>module.exports.bothBefore : number +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number >'string' : "string" A.justExport = 4 @@ -82,9 +82,9 @@ A.bothAfter = 3 module.exports = A >module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } function A() { @@ -99,19 +99,19 @@ function A() { } module.exports.bothAfter = 'string' >module.exports.bothAfter = 'string' : "string" ->module.exports.bothAfter : "string" ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") ->bothAfter : "string" +>module.exports.bothAfter : number +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number >'string' : "string" module.exports.justProperty = 'string' >module.exports.justProperty = 'string' : "string" ->module.exports.justProperty : "string" ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") ->justProperty : "string" +>module.exports.justProperty : any +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any >'string' : "string" diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt index b7506b736c..b80fa4321a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt @@ -1,3 +1,4 @@ +file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. @@ -15,11 +16,13 @@ index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECM export = a; ~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; + ~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols index 401a532e63..406c1eb55f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols @@ -14,9 +14,9 @@ const a = {}; >a : Symbol(a, Decl(file.js, 1, 5)) module.exports = a; ->module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) +>module.exports : Symbol(a, Decl(file.js, 1, 5)) >module : Symbol(module.exports) ->exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) +>exports : Symbol(a, Decl(file.js, 1, 5)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -34,8 +34,8 @@ const a = {}; >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; ->module.exports : Symbol("file", Decl(file.js, 0, 0)) +>module.exports : Symbol(a, Decl(file.js, 2, 5)) >module : Symbol(module.exports) ->exports : Symbol("file", Decl(file.js, 0, 0)) +>exports : Symbol(a, Decl(file.js, 2, 5)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff index 52ff0e8be2..17c8876eb0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(file.js, 0, 0)) ->module : Symbol(export=, Decl(file.js, 1, 13)) ->exports : Symbol(export=, Decl(file.js, 1, 13)) -+>module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) ++>module.exports : Symbol(a, Decl(file.js, 1, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) ++>exports : Symbol(a, Decl(file.js, 1, 5)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -17,8 +17,8 @@ >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; -+>module.exports : Symbol("file", Decl(file.js, 0, 0)) ++>module.exports : Symbol(a, Decl(file.js, 2, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("file", Decl(file.js, 0, 0)) ++>exports : Symbol(a, Decl(file.js, 2, 5)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types index 0842290181..a2a34b8c70 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node16).types @@ -17,9 +17,9 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : typeof import("subfolder/file") ->module : { "subfolder/file": typeof import("subfolder/file"); } ->exports : typeof import("subfolder/file") +>module.exports : {} +>module : { readonly a: {}; } +>exports : {} >a : {} === index.js === @@ -40,8 +40,8 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : typeof import("file") ->module : { "file": typeof import("file"); } ->exports : typeof import("file") +>module.exports : {} +>module : { readonly a: {}; } +>exports : {} >a : {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt index b7506b736c..b80fa4321a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt @@ -1,3 +1,4 @@ +file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. @@ -15,11 +16,13 @@ index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECM export = a; ~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; + ~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols index 401a532e63..406c1eb55f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols @@ -14,9 +14,9 @@ const a = {}; >a : Symbol(a, Decl(file.js, 1, 5)) module.exports = a; ->module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) +>module.exports : Symbol(a, Decl(file.js, 1, 5)) >module : Symbol(module.exports) ->exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) +>exports : Symbol(a, Decl(file.js, 1, 5)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -34,8 +34,8 @@ const a = {}; >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; ->module.exports : Symbol("file", Decl(file.js, 0, 0)) +>module.exports : Symbol(a, Decl(file.js, 2, 5)) >module : Symbol(module.exports) ->exports : Symbol("file", Decl(file.js, 0, 0)) +>exports : Symbol(a, Decl(file.js, 2, 5)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff index 8e46b6d1d2..25b089e7e8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(file.js, 0, 0)) ->module : Symbol(export=, Decl(file.js, 1, 13)) ->exports : Symbol(export=, Decl(file.js, 1, 13)) -+>module.exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) ++>module.exports : Symbol(a, Decl(file.js, 1, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("subfolder/file", Decl(file.js, 0, 0)) ++>exports : Symbol(a, Decl(file.js, 1, 5)) >a : Symbol(a, Decl(file.js, 1, 5)) === index.js === @@ -17,8 +17,8 @@ >a : Symbol(a, Decl(file.js, 2, 5)) module.exports = a; -+>module.exports : Symbol("file", Decl(file.js, 0, 0)) ++>module.exports : Symbol(a, Decl(file.js, 2, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("file", Decl(file.js, 0, 0)) ++>exports : Symbol(a, Decl(file.js, 2, 5)) >a : Symbol(a, Decl(file.js, 2, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types index 0842290181..a2a34b8c70 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types @@ -17,9 +17,9 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : typeof import("subfolder/file") ->module : { "subfolder/file": typeof import("subfolder/file"); } ->exports : typeof import("subfolder/file") +>module.exports : {} +>module : { readonly a: {}; } +>exports : {} >a : {} === index.js === @@ -40,8 +40,8 @@ const a = {}; module.exports = a; >module.exports = a : {} ->module.exports : typeof import("file") ->module : { "file": typeof import("file"); } ->exports : typeof import("file") +>module.exports : {} +>module : { readonly a: {}; } +>exports : {} >a : {} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types index 8423f1eb0e..f3a738cd84 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromParamTagForFunction.types @@ -35,10 +35,10 @@ const { A } = require("./a-ext"); /** @param {A} p */ function a(p) { p.x; } ->a : (p: any) => void ->p : any +>a : (p: A) => void +>p : A >p.x : any ->p : any +>p : A >x : any === b-ext.js === @@ -68,10 +68,10 @@ const { B } = require("./b-ext"); /** @param {B} p */ function b(p) { p.x; } ->b : (p: any) => void ->p : any +>b : (p: B) => void +>p : B >p.x : any ->p : any +>p : B >x : any === c-ext.js === @@ -95,10 +95,10 @@ const { C } = require("./c-ext"); /** @param {C} p */ function c(p) { p.x; } ->c : (p: any) => void ->p : any +>c : (p: C) => void +>p : C >p.x : any ->p : any +>p : C >x : any === d-ext.js === @@ -124,10 +124,10 @@ const { D } = require("./d-ext"); /** @param {D} p */ function d(p) { p.x; } ->d : (p: any) => void ->p : any +>d : (p: D) => void +>p : D >p.x : any ->p : any +>p : D >x : any === e-ext.js === diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols index b394693dae..5a1120117c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols @@ -38,9 +38,9 @@ declare var module: any; === minimatch.js === /// module.exports = minimatch ->module.exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) +>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) >module : Symbol(module.exports) ->exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) +>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) >minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) minimatch.M = M diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff index 98acdbb310..38c9315701 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff @@ -44,9 +44,9 @@ ->module : Symbol(export=, Decl(minimatch.js, 0, 0)) ->exports : Symbol(export=, Decl(minimatch.js, 0, 0)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) -+>module.exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) ++>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>module : Symbol(module.exports) -+>exports : Symbol("minimatch", Decl(minimatch.js, 0, 0)) ++>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) minimatch.M = M diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types index ef34c45637..20ccb10834 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types @@ -3,8 +3,8 @@ === use.js === /// var mini = require('./minimatch') ->mini : typeof import("minimatch") ->require('./minimatch') : typeof import("minimatch") +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >require : any >'./minimatch' : "./minimatch" @@ -12,7 +12,7 @@ mini.M.defaults() >mini.M.defaults() : any >mini.M.defaults : (def: any) => any >mini.M : { (): void; defaults: (def: any) => any; } ->mini : typeof import("minimatch") +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >M : { (): void; defaults: (def: any) => any; } >defaults : (def: any) => any @@ -20,7 +20,7 @@ var m = new mini.M() >m : any >new mini.M() : any >mini.M : { (): void; defaults: (def: any) => any; } ->mini : typeof import("minimatch") +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >M : { (): void; defaults: (def: any) => any; } m.m() @@ -32,7 +32,7 @@ m.m() mini.filter() >mini.filter() : void >mini.filter : () => void ->mini : typeof import("minimatch") +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >filter : () => void === types.d.ts === @@ -46,9 +46,9 @@ declare var module: any; /// module.exports = minimatch >module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ->module.exports : typeof import("minimatch") ->module : { "minimatch": typeof import("minimatch"); } ->exports : typeof import("minimatch") +>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } +>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } minimatch.M = M diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols index 34c0b1b75c..32a138e1d0 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols @@ -11,9 +11,9 @@ declare var module: { exports: any}; /** @typedef {{ type: "b", y: 1 }} B */ /** @typedef {A | B} Both */ module.exports = C ->module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module.exports : Symbol(C, Decl(mod1.js, 4, 18)) >module : Symbol(module.exports) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>exports : Symbol(C, Decl(mod1.js, 4, 18)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff index 2faec0e7f5..207aaa80f8 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.symbols.diff @@ -7,9 +7,9 @@ ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) ->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -+>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(C, Decl(mod1.js, 4, 18)) +>module : Symbol(module.exports) -+>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>exports : Symbol(C, Decl(mod1.js, 4, 18)) >C : Symbol(C, Decl(mod1.js, 4, 18)) function C() { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types index 94d907cbe7..83ab826c18 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule.types @@ -12,9 +12,9 @@ declare var module: { exports: any}; /** @typedef {A | B} Both */ module.exports = C >module.exports = C : () => void ->module.exports : typeof import("mod1") ->module : { "mod1": typeof import("mod1"); } ->exports : typeof import("mod1") +>module.exports : () => void +>module : { C: () => void; } +>exports : () => void >C : () => void function C() { diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt index 51e76e0712..ef2c18dda2 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -6,16 +6,13 @@ mod1.js(10,1): error TS2309: An export assignment cannot be used in a module wit 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; }'. -use.js(4,12): error TS2503: Cannot find namespace 'mod'. -==== use.js (1 errors) ==== +==== use.js (0 errors) ==== var mod = require('./mod1.js'); /** @type {import("./mod1.js").Baz} */ var b; /** @type {mod.Baz} */ - ~~~ -!!! error TS2503: Cannot find namespace 'mod'. var bb; var bbb = new mod.Baz(); diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 6e49c8f80c..6ff7139c87 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -13,7 +13,7 @@ var b; /** @type {mod.Baz} */ var bb; ->bb : Baz +>bb : number var bbb = new mod.Baz(); >bbb : Baz diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols index f99cdf7eac..903e7274bb 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols @@ -9,9 +9,9 @@ ns.Foo = class {} >ns : Symbol(ns, Decl(mod2.js, 1, 5)) module.exports = ns; ->module.exports : Symbol("mod2", Decl(mod2.js, 0, 0)) +>module.exports : Symbol(ns, Decl(mod2.js, 1, 5)) >module : Symbol(module.exports) ->exports : Symbol("mod2", Decl(mod2.js, 0, 0)) +>exports : Symbol(ns, Decl(mod2.js, 1, 5)) >ns : Symbol(ns, Decl(mod2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff index f439129a68..9f1daabc85 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.symbols.diff @@ -18,9 +18,9 @@ ->module : Symbol(export=, Decl(mod2.js, 2, 17)) ->exports : Symbol(export=, Decl(mod2.js, 2, 17)) ->ns : Symbol(ns, Decl(mod2.js, 1, 5), Decl(mod2.js, 1, 14)) -+>module.exports : Symbol("mod2", Decl(mod2.js, 0, 0)) ++>module.exports : Symbol(ns, Decl(mod2.js, 1, 5)) +>module : Symbol(module.exports) -+>exports : Symbol("mod2", Decl(mod2.js, 0, 0)) ++>exports : Symbol(ns, Decl(mod2.js, 1, 5)) +>ns : Symbol(ns, Decl(mod2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types index 375ddbcb77..2cd97df031 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule3.types @@ -15,9 +15,9 @@ ns.Foo = class {} module.exports = ns; >module.exports = ns : {} ->module.exports : typeof import("mod2") ->module : { "mod2": typeof import("mod2"); } ->exports : typeof import("mod2") +>module.exports : {} +>module : { readonly ns: {}; } +>exports : {} >ns : {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff index ed94b32906..410731570b 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.errors.txt.diff @@ -3,9 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+ExtendedClass.js(7,1): error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. -+ Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. -+ExtendedClass.js(17,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. ++ExtendedClass.js(17,5): error TS1231: An export assignment must be at the top level of a file or module declaration. +ExtendedClass.js(17,12): error TS2339: Property 'exports' does not exist on type '{}'. +ExtendedClass.js(18,19): error TS2339: Property 'exports' does not exist on type '{}'. + @@ -19,7 +17,7 @@ + } + export = BaseClass; + } -+==== ExtendedClass.js (4 errors) ==== ++==== ExtendedClass.js (3 errors) ==== + define("lib/ExtendedClass", ["deps/BaseClass"], + /** + * {typeof import("deps/BaseClass")} @@ -27,9 +25,6 @@ + * @returns + */ + (BaseClass) => { -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2345: Argument of type '{}' is not assignable to parameter of type '(...modules: unknown[]) => unknown'. -+!!! error TS2345: Type '{}' provides no match for the signature '(...modules: unknown[]): unknown'. + + const ExtendedClass = BaseClass.extends({ + f: function() { @@ -41,7 +36,7 @@ + const module = {}; + module.exports = ExtendedClass + ~~~~~~ -+!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. ++!!! error TS1231: An export assignment must be at the top level of a file or module declaration. + ~~~~~~~ +!!! error TS2339: Property 'exports' does not exist on type '{}'. + return module.exports; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff index 1dbe07fee1..df7286b7f1 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/amdLikeInputDeclarationEmit.types.diff @@ -24,7 +24,7 @@ (BaseClass) => { ->(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof import("deps/BaseClass")) => any ->BaseClass : typeof import("deps/BaseClass") -+>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : {} ++>(BaseClass) => { const ExtendedClass = BaseClass.extends({ f: function() { return "something"; } }); // Exports the module in a way tsc recognize class export const module = {}; module.exports = ExtendedClass return module.exports;} : (BaseClass: typeof BaseClass) => any +>BaseClass : typeof BaseClass const ExtendedClass = BaseClass.extends({ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff index 33c390c357..4a46c71ecb 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff @@ -6,8 +6,8 @@ const _item = require("./namespacer"); ->_item : typeof _item ->require("./namespacer") : typeof _item -+>_item : typeof import("namespacer") -+>require("./namespacer") : typeof import("namespacer") ++>_item : {} ++>require("./namespacer") : {} >require : any >"./namespacer" : "./namespacer" @@ -59,9 +59,9 @@ ->exports : typeof A ->A : typeof A +>module.exports = A : {} -+>module.exports : typeof import("namespacey") -+>module : { "namespacey": typeof import("namespacey"); } -+>exports : typeof import("namespacey") ++>module.exports : {} ++>module : { readonly A: {}; } ++>exports : {} +>A : {} === namespacer.js === @@ -105,8 +105,8 @@ ->exports : typeof B ->B : typeof B +>module.exports = B : {} -+>module.exports : typeof import("namespacer") -+>module : { "namespacer": typeof import("namespacer"); } -+>exports : typeof import("namespacer") ++>module.exports : {} ++>module : { readonly B: {}; } ++>exports : {} +>B : {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff index 1ee7714533..ecd1ddf5dc 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types.diff @@ -1,14 +1,11 @@ --- old.importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types +++ new.importHelpersCommonJSJavaScript(verbatimmodulesyntax=false).types -@@= skipped -17, +17 lines =@@ - +@@= skipped -18, +18 lines =@@ module.exports = Bar; >module.exports = Bar : typeof Bar -->module.exports : typeof Bar + >module.exports : typeof Bar ->module : { exports: typeof Bar; } -->exports : typeof Bar -+>module.exports : typeof import("/index") -+>module : { "/index": typeof import("/index"); } -+>exports : typeof import("/index") ++>module : { Bar: typeof Bar; } + >exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff index ea5139c94e..028496c8a7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types.diff @@ -1,14 +1,11 @@ --- old.importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types +++ new.importHelpersCommonJSJavaScript(verbatimmodulesyntax=true).types -@@= skipped -17, +17 lines =@@ - +@@= skipped -18, +18 lines =@@ module.exports = Bar; >module.exports = Bar : typeof Bar -->module.exports : typeof Bar + >module.exports : typeof Bar ->module : { exports: typeof Bar; } -->exports : typeof Bar -+>module.exports : typeof import("/index") -+>module : { "/index": typeof import("/index"); } -+>exports : typeof import("/index") ++>module : { Bar: typeof Bar; } + >exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff index 12b8945fb0..64af18c39c 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptCommonjsModule.types.diff @@ -1,14 +1,11 @@ --- old.javascriptCommonjsModule.types +++ new.javascriptCommonjsModule.types -@@= skipped -9, +9 lines =@@ - +@@= skipped -10, +10 lines =@@ module.exports = Bar; >module.exports = Bar : typeof Bar -->module.exports : typeof Bar + >module.exports : typeof Bar ->module : { exports: typeof Bar; } -->exports : typeof Bar -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module : { Bar: typeof Bar; } + >exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff index 2bbedd477a..d0bf7f0d06 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/javascriptImportDefaultBadExport.types.diff @@ -1,19 +1,16 @@ --- old.javascriptImportDefaultBadExport.types +++ new.javascriptImportDefaultBadExport.types -@@= skipped -6, +6 lines =@@ - +@@= skipped -7, +7 lines =@@ module.exports = alias; >module.exports = alias : {} -->module.exports : {} + >module.exports : {} ->module : { exports: {}; } -->exports : {} -+>module.exports : typeof import("/a") -+>module : { "/a": typeof import("/a"); } -+>exports : typeof import("/a") ++>module : { readonly alias: {}; } + >exports : {} >alias : {} === /b.js === import a from "./a"; ->a : any -+>a : typeof import("/a") ++>a : {} diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff index c36a59c495..2779b86f3a 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/maxNodeModuleJsDepthDefaultsToZero.types.diff @@ -46,8 +46,8 @@ + +module.exports = y; +>module.exports = y : { y: string; } -+>module.exports : typeof import("/node_modules/shortid/index") -+>module : { "/node_modules/shortid/index": typeof import("/node_modules/shortid/index"); } -+>exports : typeof import("/node_modules/shortid/index") ++>module.exports : { y: string; } ++>module : { y: { y: string; }; } ++>exports : { y: string; } +>y : { y: string; } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff index c899ec8ec6..ed70bdbb43 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.errors.txt.diff @@ -4,7 +4,7 @@ - @@= skipped --1, +1 lines =@@ +a.js(3,12): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. -+a.js(4,5): error TS1233: An export declaration can only be used at the top level of a namespace or module. ++a.js(4,5): error TS1231: An export assignment must be at the top level of a file or module declaration. + + +==== a.js (2 errors) ==== @@ -15,6 +15,6 @@ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + module.exports = fn; + ~~~~~~ -+!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. ++!!! error TS1231: An export assignment must be at the top level of a file or module declaration. + } + diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff index 8d7a73094b..0654ff4e61 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/truthinessCallExpressionCoercion4.types.diff @@ -1,31 +1,22 @@ --- old.truthinessCallExpressionCoercion4.types +++ new.truthinessCallExpressionCoercion4.types -@@= skipped -4, +4 lines =@@ - >fn : () => void - - if (typeof module === 'object' && module.exports) { -->typeof module === 'object' && module.exports : false | (() => void) -+>typeof module === 'object' && module.exports : false | (typeof import("a")) +@@= skipped -7, +7 lines =@@ + >typeof module === 'object' && module.exports : false | (() => void) >typeof module === 'object' : boolean >typeof module : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" ->module : { exports: () => void; } +>module : any >'object' : "object" -->module.exports : () => void + >module.exports : () => void ->module : { exports: () => void; } -->exports : () => void -+>module.exports : typeof import("a") -+>module : { "a": typeof import("a"); } -+>exports : typeof import("a") ++>module : { fn: () => void; } + >exports : () => void module.exports = fn; >module.exports = fn : () => void -->module.exports : () => void + >module.exports : () => void ->module : { exports: () => void; } -->exports : () => void -+>module.exports : typeof import("a") -+>module : { "a": typeof import("a"); } -+>exports : typeof import("a") ++>module : { fn: () => void; } + >exports : () => void >fn : () => void } - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff index ca88235c5e..c3a4614698 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/binderUninitializedModuleExportsAssignment.types.diff @@ -1,14 +1,11 @@ --- old.binderUninitializedModuleExportsAssignment.types +++ new.binderUninitializedModuleExportsAssignment.types -@@= skipped -10, +10 lines =@@ - +@@= skipped -11, +11 lines =@@ module.exports = loop2; >module.exports = loop2 : any -->module.exports : any + >module.exports : any ->module : { exports: any; } -->exports : any -+>module.exports : typeof import("loop") -+>module : { "loop": typeof import("loop"); } -+>exports : typeof import("loop") ++>module : { loop2: any; } + >exports : any >loop2 : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff index 22dc9b535a..00ec21d7b4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+use.js(1,30): error TS2694: Namespace '"mod1"' has no exported member 'Con'. ++use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'. + + +==== mod1.js (0 errors) ==== @@ -19,7 +19,7 @@ +==== use.js (1 errors) ==== + /** @param {import('./mod1').Con} k */ + ~~~ -+!!! error TS2694: Namespace '"mod1"' has no exported member 'Con'. ++!!! error TS2694: Namespace 'C' has no exported member 'Con'. + function f(k) { + if (1 === 2 - 1) { + // I guess basic math works! diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff index 78033159b8..49bec7cbe0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/callbackCrossModule.types.diff @@ -10,9 +10,9 @@ ->exports : typeof C ->C : typeof C +>module.exports = C : () => void -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") ++>module.exports : () => void ++>module : { C: () => void; } ++>exports : () => void +>C : () => void function C() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff index c5626d8267..037be55ee5 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff @@ -5,7 +5,7 @@ import Person = require("./mod1"); ->Person : typeof Person -+>Person : typeof import("mod1") ++>Person : (name: string) => void const m1 = new Person("Name") ->m1 : Person @@ -13,7 +13,7 @@ ->Person : typeof Person +>m1 : any +>new Person("Name") : any -+>Person : typeof import("mod1") ++>Person : (name: string) => void >"Name" : "Name" m1.thing; @@ -252,8 +252,8 @@ ->exports : typeof Person ->Person : typeof Person +>module.exports = Person : (name: string) => void -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") ++>module.exports : (name: string) => void ++>module : { Person: (name: string) => void; } ++>exports : (name: string) => void +>Person : (name: string) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff index 09a4de67cb..57a2edd65c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff @@ -8,19 +8,19 @@ +index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. +index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. +index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. -+validate.ts(3,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. -+validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. -+validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. -+validate.ts(6,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. -+validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. -+validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. -+validate.ts(10,3): error TS2339: Property 'name' does not exist on type 'typeof import("index")'. -+validate.ts(11,3): error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. -+validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. -+validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. -+validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. -+validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. -+validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. ++validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. ++validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ++validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. ++validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. ++validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. ++validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. ++validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. ++validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. -==== validate.ts (4 errors) ==== @@ -29,50 +29,50 @@ import x = require("./"); x.name; + ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'name' does not exist on type '{}'. x.middleInit; + ~~~~~~~~~~ -+!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'middleInit' does not exist on type '{}'. x.lastName; + ~~~~~~~~ -+!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.zip; + ~~~ -+!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'zip' does not exist on type '{}'. x.houseNumber; + ~~~~~~~~~~~ -+!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr; + ~~~~~~ -+!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.name = "Another"; + ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'name' does not exist on type '{}'. x.zip = 98123; + ~~~ -+!!! error TS2339: Property 'zip' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'zip' does not exist on type '{}'. x.zipStr = "OK"; + ~~~~~~ -+!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.lastName = "should fail"; ~~~~~~~~ -!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. -+!!! error TS2339: Property 'lastName' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.houseNumber = 12; // should also fail ~~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. -+!!! error TS2339: Property 'houseNumber' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr = 12; // should fail - ~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~~ -+!!! error TS2339: Property 'zipStr' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.middleInit = "R"; // should also fail ~~~~~~~~~~ -!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. -+!!! error TS2339: Property 'middleInit' does not exist on type 'typeof import("index")'. ++!!! error TS2339: Property 'middleInit' does not exist on type '{}'. -==== index.js (0 errors) ==== +==== index.js (3 errors) ==== diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff index 2dc25ce197..536c926ed7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff @@ -5,14 +5,14 @@ // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); ->x : typeof x -+>x : typeof import("index") ++>x : {} x.name; ->x.name : string ->x : typeof x ->name : string +>x.name : any -+>x : typeof import("index") ++>x : {} +>name : any x.middleInit; @@ -20,7 +20,7 @@ ->x : typeof x ->middleInit : string +>x.middleInit : any -+>x : typeof import("index") ++>x : {} +>middleInit : any x.lastName; @@ -28,7 +28,7 @@ ->x : typeof x ->lastName : string +>x.lastName : any -+>x : typeof import("index") ++>x : {} +>lastName : any x.zip; @@ -36,7 +36,7 @@ ->x : typeof x ->zip : number +>x.zip : any -+>x : typeof import("index") ++>x : {} +>zip : any x.houseNumber; @@ -44,7 +44,7 @@ ->x : typeof x ->houseNumber : number +>x.houseNumber : any -+>x : typeof import("index") ++>x : {} +>houseNumber : any x.zipStr; @@ -52,7 +52,7 @@ ->x : typeof x ->zipStr : string +>x.zipStr : any -+>x : typeof import("index") ++>x : {} +>zipStr : any x.name = "Another"; @@ -61,7 +61,7 @@ ->x : typeof x ->name : string +>x.name : any -+>x : typeof import("index") ++>x : {} +>name : any >"Another" : "Another" @@ -71,7 +71,7 @@ ->x : typeof x ->zip : number +>x.zip : any -+>x : typeof import("index") ++>x : {} +>zip : any >98123 : 98123 @@ -81,7 +81,7 @@ ->x : typeof x ->zipStr : string +>x.zipStr : any -+>x : typeof import("index") ++>x : {} +>zipStr : any >"OK" : "OK" @@ -89,7 +89,7 @@ >x.lastName = "should fail" : "should fail" >x.lastName : any ->x : typeof x -+>x : typeof import("index") ++>x : {} >lastName : any >"should fail" : "should fail" @@ -97,7 +97,7 @@ >x.houseNumber = 12 : 12 >x.houseNumber : any ->x : typeof x -+>x : typeof import("index") ++>x : {} >houseNumber : any >12 : 12 @@ -107,7 +107,7 @@ ->x : typeof x ->zipStr : string +>x.zipStr : any -+>x : typeof import("index") ++>x : {} +>zipStr : any >12 : 12 @@ -115,7 +115,7 @@ >x.middleInit = "R" : "R" >x.middleInit : any ->x : typeof x -+>x : typeof import("index") ++>x : {} >middleInit : any >"R" : "R" @@ -302,8 +302,8 @@ ->exports : typeof x ->x : typeof x +>module.exports = x : {} -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module.exports : {} ++>module : { readonly x: {}; } ++>exports : {} +>x : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff index cda92b2776..87bcea7dd6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportClassTypeReference.types.diff @@ -1,22 +1,15 @@ --- old.commonJSImportClassTypeReference.types +++ new.commonJSImportClassTypeReference.types -@@= skipped -8, +8 lines =@@ - - /** @param {K} k */ - function f(k) { -->f : (k: K) => void -->k : K -+>f : (k: any) => void -+>k : any +@@= skipped -12, +12 lines =@@ + >k : K k.values() ->k.values() : K ->k.values : () => K -->k : K -->values : () => K +>k.values() : any +>k.values : any -+>k : any + >k : K +->values : () => K +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff index 98fc873ed2..1708ced17a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportExportedClassExpression.types.diff @@ -1,22 +1,15 @@ --- old.commonJSImportExportedClassExpression.types +++ new.commonJSImportExportedClassExpression.types -@@= skipped -8, +8 lines =@@ - - /** @param {K} k */ - function f(k) { -->f : (k: K) => void -->k : K -+>f : (k: any) => void -+>k : any +@@= skipped -12, +12 lines =@@ + >k : K k.values() ->k.values() : void ->k.values : () => void -->k : K -->values : () => void +>k.values() : any +>k.values : any -+>k : any + >k : K +->values : () => void +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff index d65801bf37..85e59ebc64 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSImportNestedClassTypeReference.types.diff @@ -9,22 +9,16 @@ >require("./mod1") : typeof import("mod1") >require : any >"./mod1" : "./mod1" - - /** @param {K} k */ - function f(k) { -->f : (k: K) => void -->k : K -+>f : (k: any) => void -+>k : any +@@= skipped -11, +11 lines =@@ + >k : K k.values() ->k.values() : K ->k.values : () => K -->k : K -->values : () => K +>k.values() : any +>k.values : any -+>k : any + >k : K +->values : () => K +>values : any } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff index 5815f96d85..70e1af57c6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/constructorFunctions2.types.diff @@ -6,8 +6,8 @@ const A = require("./other"); ->A : typeof A ->require("./other") : typeof A -+>A : typeof import("other") -+>require("./other") : typeof import("other") ++>A : () => void ++>require("./other") : () => void >require : (id: string) => any >"./other" : "./other" @@ -20,7 +20,7 @@ +>a : any +>new A().id : any +>new A() : any -+>A : typeof import("other") ++>A : () => void +>id : any const B = function() { this.id = 1; } @@ -95,8 +95,8 @@ ->exports : typeof A ->A : typeof A +>module.exports = A : () => void -+>module.exports : typeof import("other") -+>module : { "other": typeof import("other"); } -+>exports : typeof import("other") ++>module.exports : () => void ++>module : { A: () => void; } ++>exports : () => void +>A : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff index 0fa0617ad8..005b72b658 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/enumTagImported.types.diff @@ -20,7 +20,7 @@ /** @type {TestEnum} */ const tist = TestEnum.ADD ->tist : string -+>tist : any ++>tist : TestEnum >TestEnum.ADD : string >TestEnum : { ADD: string; REMOVE: string; } >ADD : string diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff index 4553b54340..d2908b162b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportNamespace_js.errors.txt.diff @@ -1,24 +1,18 @@ --- old.exportNamespace_js.errors.txt +++ new.exportNamespace_js.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -b.js(1,1): error TS8006: 'export type' declarations can only be used in TypeScript files. --c.js(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. -- -- --==== a.js (0 errors) ==== -- export class A {} -- + c.js(2,1): error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. + + + ==== a.js (0 errors) ==== + export class A {} + -==== b.js (1 errors) ==== -- export type * from './a'; ++==== b.js (0 errors) ==== + export type * from './a'; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8006: 'export type' declarations can only be used in TypeScript files. -- --==== c.js (1 errors) ==== -- import { A } from './b'; -- A; -- ~ --!!! error TS1362: 'A' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 b.js:1:1: 'A' was exported here. -- -@@= skipped --1, +1 lines =@@ -+ + + ==== c.js (1 errors) ==== + import { A } from './b'; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff index 70b52732ef..b829425316 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/exportedEnumTypeAndValue.types.diff @@ -14,7 +14,7 @@ /** @type {MyEnum} */ const v = MyEnum.b; ->v : number -+>v : any ++>v : MyEnum >MyEnum.b : number >MyEnum : { a: number; b: number; } >b : number diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff index 9bc6a7864c..5c4fda6af4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importAliasModuleExports.types.diff @@ -1,21 +1,18 @@ --- old.importAliasModuleExports.types +++ new.importAliasModuleExports.types -@@= skipped -9, +9 lines =@@ - } +@@= skipped -10, +10 lines =@@ module.exports = Alias; >module.exports = Alias : typeof Alias -->module.exports : typeof Alias + >module.exports : typeof Alias ->module : { exports: typeof Alias; } -->exports : typeof Alias -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") ++>module : { Alias: typeof Alias; } + >exports : typeof Alias >Alias : typeof Alias === main.js === import A from './mod1' ->A : typeof A -+>A : typeof import("mod1") ++>A : typeof Alias A.prototype.foo = 0 >A.prototype.foo = 0 : 0 @@ -24,7 +21,7 @@ ->A : typeof A ->prototype : A +>A.prototype : Alias -+>A : typeof import("mod1") ++>A : typeof Alias +>prototype : Alias >foo : any >0 : 0 @@ -36,7 +33,7 @@ ->A : typeof A ->prototype : A +>A.prototype : Alias -+>A : typeof import("mod1") ++>A : typeof Alias +>prototype : Alias >func : any >function() { this._func = 0; } : () => void @@ -57,19 +54,19 @@ ->A : typeof A ->prototype : A +>A.prototype : Alias -+>A : typeof import("mod1") ++>A : typeof Alias +>prototype : Alias >"def" : "def" >{ value: 0 } : { value: number; } >value : number -@@= skipped -47, +47 lines =@@ +@@= skipped -46, +46 lines =@@ new A().bar >new A().bar : () => number ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof import("mod1") ++>A : typeof Alias >bar : () => number new A().foo @@ -77,7 +74,7 @@ ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof import("mod1") ++>A : typeof Alias >foo : any new A().func() @@ -86,7 +83,7 @@ ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof import("mod1") ++>A : typeof Alias >func : any new A().def @@ -94,6 +91,6 @@ ->new A() : A ->A : typeof A +>new A() : Alias -+>A : typeof import("mod1") ++>A : typeof Alias >def : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff index fb5e6001f8..436bf89b0c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.errors.txt.diff @@ -3,10 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+cls.js(7,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. ++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 (1 errors) ==== ++==== cls.js (2 errors) ==== + const Bar = require("./bar"); + const Strings = { + a: "A", @@ -14,10 +15,11 @@ + }; + class Foo extends Bar {} + module.exports = Foo; -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. -+!!! related TS2728 cls.js:8:1: 'Strings' is declared here. ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! 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'. +==== bar.js (0 errors) ==== + class Bar {} + module.exports = Bar; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff index 84459584da..f746697ab2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff @@ -1,49 +1,34 @@ --- old.jsDeclarationsClassExtendsVisibility.types +++ new.jsDeclarationsClassExtendsVisibility.types -@@= skipped -1, +1 lines =@@ - - === cls.js === - const Bar = require("./bar"); -->Bar : typeof Bar -->require("./bar") : typeof Bar -+>Bar : typeof import("bar") -+>require("./bar") : typeof import("bar") - >require : any - >"./bar" : "./bar" - -@@= skipped -24, +24 lines =@@ - +@@= skipped -26, +26 lines =@@ module.exports = Foo; >module.exports = Foo : typeof Foo -->module.exports : typeof Foo + >module.exports : typeof Foo ->module : { exports: typeof Foo; } -->exports : typeof Foo -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") ++>module : { Foo: typeof Foo; } + >exports : typeof Foo >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } - >module.exports.Strings : { a: string; b: string; } -->module.exports : typeof Foo +->module.exports.Strings : { a: string; b: string; } ++>module.exports.Strings : any + >module.exports : typeof Foo ->module : { exports: typeof Foo; } -->exports : typeof Foo -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") - >Strings : { a: string; b: string; } ++>module : { Foo: typeof Foo; } + >exports : typeof Foo ++>Strings : any >Strings : { a: string; b: string; } +->Strings : { a: string; b: string; } + === bar.js === + class Bar {} @@= skipped -20, +20 lines =@@ - module.exports = Bar; >module.exports = Bar : typeof Bar -->module.exports : typeof Bar + >module.exports : typeof Bar ->module : { exports: typeof Bar; } -->exports : typeof Bar -+>module.exports : typeof import("bar") -+>module : { "bar": typeof import("bar"); } -+>exports : typeof import("bar") ++>module : { Bar: typeof Bar; } + >exports : typeof Bar >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff index eb9599af8f..9f95f0d97c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.errors.txt.diff @@ -4,10 +4,11 @@ - @@= skipped --1, +1 lines =@@ +source.js(9,9): error TS2339: Property 'statische' does not exist on type 'typeof Handler'. -+source.js(15,1): error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. ++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 (3 errors) ==== + class Handler { + static get OPTIONS() { + return 1; @@ -25,10 +26,11 @@ + } + + module.exports = Handler; -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'Strings' is missing in type 'typeof Handler' but required in type 'typeof import("source")'. -+!!! related TS2728 source.js:16:1: 'Strings' is declared here. ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! 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'. + + /** + * @typedef {Object} HandlerOptions diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff index fbe113ce26..36ebdcaf64 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassStatic.types.diff @@ -12,27 +12,26 @@ >function() { } : () => void const Strings = { -@@= skipped -20, +20 lines =@@ - +@@= skipped -21, +21 lines =@@ module.exports = Handler; >module.exports = Handler : typeof Handler -->module.exports : typeof Handler + >module.exports : typeof Handler ->module : { exports: typeof Handler; } -->exports : typeof Handler -+>module.exports : typeof import("source") -+>module : { "source": typeof import("source"); } -+>exports : typeof import("source") ++>module : { Handler: typeof Handler; } + >exports : typeof Handler >Handler : typeof Handler module.exports.Strings = Strings >module.exports.Strings = Strings : { a: string; b: string; } - >module.exports.Strings : { a: string; b: string; } -->module.exports : typeof Handler +->module.exports.Strings : { a: string; b: string; } ++>module.exports.Strings : any + >module.exports : typeof Handler ->module : { exports: typeof Handler; } -->exports : typeof Handler -+>module.exports : typeof import("source") -+>module : { "source": typeof import("source"); } -+>exports : typeof import("source") - >Strings : { a: string; b: string; } ++>module : { Handler: typeof Handler; } + >exports : typeof Handler ++>Strings : any >Strings : { a: string; b: string; } +->Strings : { a: string; b: string; } + /** + * @typedef {Object} HandlerOptions diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff index 164288147d..3831550e5e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff @@ -1,15 +1,12 @@ --- old.jsDeclarationsExportAssignedVisibility.types +++ new.jsDeclarationsExportAssignedVisibility.types -@@= skipped -22, +22 lines =@@ - +@@= skipped -23, +23 lines =@@ module.exports = Container; >module.exports = Container : typeof Container -->module.exports : typeof Container + >module.exports : typeof Container ->module : { exports: typeof Container; } -->exports : typeof Container -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module : { Container: typeof Container; } + >exports : typeof Container >Container : typeof Container === obj.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff index 195444d3b5..b930780c3b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportForms.types.diff @@ -70,9 +70,9 @@ ->exports : typeof ns ->ns : typeof ns +>module.exports = ns : typeof import("cls") -+>module.exports : typeof import("cjs2") -+>module : { "cjs2": typeof import("cjs2"); } -+>exports : typeof import("cjs2") ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") +>ns : typeof import("cls") === cjs3.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff index 4497e8d133..6f997b9cdc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportFormsErr.types.diff @@ -23,9 +23,9 @@ ->exports : any ->ns : typeof ns +>module.exports = ns : typeof import("cls") -+>module.exports : typeof import("bin") -+>module : { "bin": typeof import("bin"); } -+>exports : typeof import("bin") ++>module.exports : typeof import("cls") ++>module : { "cls": typeof import("cls"); } ++>exports : typeof import("cls") +>ns : typeof import("cls") === globalNs.js === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff index c85f2fda80..4f0c0ca156 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.errors.txt.diff @@ -3,17 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+cls.js(6,1): error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. ++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 (1 errors) ==== ++==== cls.js (2 errors) ==== + const Strings = { + a: "A", + b: "B" + }; + class Foo {} + module.exports = Foo; -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'Strings' is missing in type 'typeof Foo' but required in type 'typeof import("cls")'. -+!!! related TS2728 cls.js:7:1: 'Strings' is declared here. ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! 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/jsDeclarationsExportSubAssignments.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff index 8f82395b6e..1289987dca 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportSubAssignments.types.diff @@ -1,26 +1,23 @@ --- old.jsDeclarationsExportSubAssignments.types +++ new.jsDeclarationsExportSubAssignments.types -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ module.exports = Foo; >module.exports = Foo : typeof Foo -->module.exports : typeof Foo + >module.exports : typeof Foo ->module : { exports: typeof Foo; } -->exports : typeof Foo -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") ++>module : { Foo: typeof Foo; } + >exports : typeof Foo >Foo : typeof Foo module.exports.Strings = Strings; >module.exports.Strings = Strings : { a: string; b: string; } - >module.exports.Strings : { a: string; b: string; } -->module.exports : typeof Foo +->module.exports.Strings : { a: string; b: string; } ++>module.exports.Strings : any + >module.exports : typeof Foo ->module : { exports: typeof Foo; } -->exports : typeof Foo -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") - >Strings : { a: string; b: string; } ++>module : { Foo: typeof Foo; } + >exports : typeof Foo ++>Strings : any >Strings : { a: string; b: string; } +->Strings : { a: string; b: string; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff index 4936aa1be8..6a9ada9701 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.types.diff @@ -23,9 +23,9 @@ ->exports : typeof Timer ->Timer : typeof Timer +>module.exports = Timer : (timeout: number) => void -+>module.exports : typeof import("timer") -+>module : { "timer": typeof import("timer"); } -+>exports : typeof import("timer") ++>module.exports : (timeout: number) => void ++>module : { Timer: (timeout: number) => void; } ++>exports : (timeout: number) => void +>Timer : (timeout: number) => void === hook.js === @@ -53,9 +53,9 @@ ->exports : typeof Hook ->Hook : typeof Hook +>module.exports = Hook : (handle: HookHandler) => void -+>module.exports : typeof import("hook") -+>module : { "hook": typeof import("hook"); } -+>exports : typeof import("hook") ++>module.exports : (handle: HookHandler) => void ++>module : { Hook: (handle: HookHandler) => void; } ++>exports : (handle: HookHandler) => void +>Hook : (handle: HookHandler) => void === context.js === @@ -137,8 +137,8 @@ ->exports : { (input: Input): Context; new (input: Input): Context; prototype: { construct(input: Input, handle?: HookHandler | undefined): State; }; } ->Context : typeof Context +>module.exports = Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } -+>module.exports : typeof import("context") -+>module : { "context": typeof import("context"); } -+>exports : typeof import("context") ++>module.exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } ++>module : { Context: { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; }; } ++>exports : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } +>Context : { (input: Input): any; prototype: { construct: (input: Input, handle?: HookHandler) => State; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff index bdb550f93f..a0d16ed5f0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionLikeClasses.types.diff @@ -50,32 +50,21 @@ /** * @param {Point} p - */ - export function magnitude(p) { -->magnitude : (p: Point) => number -->p : Point -+>magnitude : (p: any) => number -+>p : any - - return Math.sqrt(p.x ** 2 + p.y ** 2); - >Math.sqrt(p.x ** 2 + p.y ** 2) : number @@= skipped -42, +42 lines =@@ >sqrt : (x: number) => number >p.x ** 2 + p.y ** 2 : number >p.x ** 2 : number ->p.x : number -->p : Point -->x : number +>p.x : any -+>p : any + >p : Point +->x : number +>x : any >2 : 2 >p.y ** 2 : number ->p.y : number -->p : Point -->y : number +>p.y : any -+>p : any + >p : Point +->y : number +>y : any >2 : 2 } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff index 1db41d3143..da667dfdb2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionPrototypeStatic.types.diff @@ -10,9 +10,9 @@ ->exports : typeof MyClass ->MyClass : typeof MyClass +>module.exports = MyClass : { (): void; staticMethod: () => void; staticProperty: number; } -+>module.exports : typeof import("source") -+>module : { "source": typeof import("source"); } -+>exports : typeof import("source") ++>module.exports : { (): void; staticMethod: () => void; staticProperty: number; } ++>module : { MyClass: { (): void; staticMethod: () => void; staticProperty: number; }; } ++>exports : { (): void; staticMethod: () => void; staticProperty: number; } +>MyClass : { (): void; staticMethod: () => void; staticProperty: number; } function MyClass() {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff index bc92d8edca..4e77a5275a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.types.diff @@ -38,8 +38,8 @@ ->exports : typeof foo ->foo : typeof foo +>module.exports = foo : { (): void; foo: ???; default: ???; } -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module.exports : { (): void; foo: ???; default: ???; } ++>module : { foo: { (): void; foo: ???; default: ???; }; } ++>exports : { (): void; foo: ???; default: ???; } +>foo : { (): void; foo: ???; default: ???; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff index 381a0f86f3..66da7cbb1d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportTypeBundled.types.diff @@ -9,23 +9,21 @@ >{x: 12} : { x: number; } >x : number >12 : 12 - +@@= skipped -8, +8 lines =@@ module.exports = x; >module.exports = x : { x: number; } -->module.exports : { x: number; } + >module.exports : { x: number; } ->module : { exports: { x: number; }; } -->exports : { x: number; } ++>module : { readonly x: { x: number; }; } + >exports : { x: number; } ->x : Item -+>module.exports : typeof import("folder/mod1") -+>module : { "folder/mod1": typeof import("folder/mod1"); } -+>exports : typeof import("folder/mod1") +>x : { x: number; } === index.js === /** @type {(typeof import("./folder/mod1"))[]} */ const items = [{x: 12}]; ->items : import("folder/mod1").Item[] -+>items : typeof import("folder/mod1")[] ++>items : { x: number; }[] >[{x: 12}] : { x: number; }[] >{x: 12} : { x: number; } >x : number @@ -37,9 +35,9 @@ ->module : { exports: import("folder/mod1").Item[]; } ->exports : import("folder/mod1").Item[] ->items : import("folder/mod1").Item[] -+>module.exports = items : typeof import("folder/mod1")[] -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") -+>items : typeof import("folder/mod1")[] ++>module.exports = items : { x: number; }[] ++>module.exports : { x: number; }[] ++>module : { readonly items: { x: number; }[]; } ++>exports : { x: number; }[] ++>items : { x: number; }[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff index 6700f08bbd..f58fad341b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsJson.types.diff @@ -1,15 +1,11 @@ --- old.jsDeclarationsJson.types +++ new.jsDeclarationsJson.types -@@= skipped -8, +8 lines =@@ - +@@= skipped -9, +9 lines =@@ module.exports = j; >module.exports = j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } -->module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } + >module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module : { exports: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } -->exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module : { export=: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } + >exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } >j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } - === obj.json === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff index 8ced3907de..716a901433 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsPackageJson.types.diff @@ -1,15 +1,11 @@ --- old.jsDeclarationsPackageJson.types +++ new.jsDeclarationsPackageJson.types -@@= skipped -8, +8 lines =@@ - +@@= skipped -9, +9 lines =@@ module.exports = j; >module.exports = j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } -->module.exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } + >module.exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } ->module : { exports: { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; }; } -->exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module : { export=: { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; }; } + >exports : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } >j : { name: string; version: string; description: string; main: string; bin: { cli: string; }; engines: { node: string; }; scripts: { scriptname: string; }; devDependencies: { "@ns/dep": string; }; dependencies: { dep: string; }; repository: string; keywords: string[]; author: string; license: string; homepage: string; config: { o: string[]; }; } - === package.json === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff index 337e1446a2..0e89ce5575 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.errors.txt.diff @@ -3,10 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ ++base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +file.js(1,15): error TS1340: Module './base' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./base')'? + + -+==== base.js (0 errors) ==== ++==== base.js (1 errors) ==== + class Base { + constructor() {} + } @@ -18,6 +19,8 @@ + BaseFactory.Base = Base; + + module.exports = BaseFactory; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + +==== file.js (1 errors) ==== + /** @typedef {import('./base')} BaseFactory */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff index d826883a61..74ace1313c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.types.diff @@ -1,19 +1,15 @@ --- old.jsDeclarationsParameterTagReusesInputNodeInEmit1.types +++ new.jsDeclarationsParameterTagReusesInputNodeInEmit1.types -@@= skipped -25, +25 lines =@@ - +@@= skipped -26, +26 lines =@@ module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } -->module.exports : { (): Base; Base: typeof Base; } + >module.exports : { (): Base; Base: typeof Base; } ->module : { exports: { (): Base; Base: typeof Base; }; } -->exports : { (): Base; Base: typeof Base; } -+>module.exports : typeof import("base") -+>module : { "base": typeof import("base"); } -+>exports : typeof import("base") ++>module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } + >exports : { (): Base; Base: typeof Base; } >BaseFactory : { (): Base; Base: typeof Base; } - === file.js === -@@= skipped -22, +22 lines =@@ +@@= skipped -21, +21 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff new file mode 100644 index 0000000000..6c777dd16e --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt.diff @@ -0,0 +1,35 @@ +--- old.jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt ++++ new.jsDeclarationsParameterTagReusesInputNodeInEmit2.errors.txt +@@= skipped -0, +-1 lines =@@ +- +@@= skipped --1, +1 lines =@@ ++base.js(11,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ++ ++ ++==== base.js (1 errors) ==== ++ class Base { ++ constructor() {} ++ } ++ ++ const BaseFactory = () => { ++ return new Base(); ++ }; ++ ++ BaseFactory.Base = Base; ++ ++ module.exports = BaseFactory; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ++ ++==== file.js (0 errors) ==== ++ /** @typedef {typeof import('./base')} BaseFactory */ ++ ++ /** ++ * ++ * @param {InstanceType} base ++ * @returns {InstanceType} ++ */ ++ const test = (base) => { ++ return base; ++ }; ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff index a5fb9ebdb5..4404d4fa58 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.types.diff @@ -1,19 +1,15 @@ --- old.jsDeclarationsParameterTagReusesInputNodeInEmit2.types +++ new.jsDeclarationsParameterTagReusesInputNodeInEmit2.types -@@= skipped -25, +25 lines =@@ - +@@= skipped -26, +26 lines =@@ module.exports = BaseFactory; >module.exports = BaseFactory : { (): Base; Base: typeof Base; } -->module.exports : { (): Base; Base: typeof Base; } + >module.exports : { (): Base; Base: typeof Base; } ->module : { exports: { (): Base; Base: typeof Base; }; } -->exports : { (): Base; Base: typeof Base; } -+>module.exports : typeof import("base") -+>module : { "base": typeof import("base"); } -+>exports : typeof import("base") ++>module : { readonly BaseFactory: { (): Base; Base: typeof Base; }; } + >exports : { (): Base; Base: typeof Base; } >BaseFactory : { (): Base; Base: typeof Base; } - === file.js === -@@= skipped -14, +14 lines =@@ +@@= skipped -13, +13 lines =@@ * @returns {InstanceType} */ const test = (base) => { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff index e99bf4ee2d..9a2661c062 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportAliasesEsModuleInterop.types.diff @@ -1,23 +1,20 @@ --- old.jsDeclarationsReexportAliasesEsModuleInterop.types +++ new.jsDeclarationsReexportAliasesEsModuleInterop.types -@@= skipped -5, +5 lines =@@ - +@@= skipped -6, +6 lines =@@ module.exports = Foo; >module.exports = Foo : typeof Foo -->module.exports : typeof Foo + >module.exports : typeof Foo ->module : { exports: typeof Foo; } -->exports : typeof Foo -+>module.exports : typeof import("cls") -+>module : { "cls": typeof import("cls"); } -+>exports : typeof import("cls") ++>module : { Foo: typeof Foo; } + >exports : typeof Foo >Foo : typeof Foo === usage.js === import {default as Fooa} from "./cls"; ->default : typeof Fooa ->Fooa : typeof Fooa -+>default : typeof import("cls") -+>Fooa : typeof import("cls") ++>default : typeof Foo ++>Fooa : typeof Foo export const x = new Fooa(); ->x : Fooa @@ -25,11 +22,11 @@ ->Fooa : typeof Fooa +>x : Foo +>new Fooa() : Foo -+>Fooa : typeof import("cls") ++>Fooa : typeof Foo export {default as Foob} from "./cls"; ->default : typeof Fooa ->Foob : typeof Fooa -+>default : typeof import("cls") -+>Foob : typeof import("cls") ++>default : typeof Foo ++>Foob : typeof Foo diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff index c2ae83db00..58686a8ded 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff @@ -15,11 +15,11 @@ render.addRectangle(); ->render.addRectangle() : import("rectangle").Rectangle ->render.addRectangle : () => import("rectangle").Rectangle -+>render.addRectangle() : any -+>render.addRectangle : () => any ++>render.addRectangle() : Rectangle ++>render.addRectangle : () => Rectangle >render : Render ->addRectangle : () => import("rectangle").Rectangle -+>addRectangle : () => any ++>addRectangle : () => Rectangle console.log("Objects", render.objects); >console.log("Objects", render.objects) : void @@ -70,16 +70,7 @@ >[] : undefined[] } /** -@@= skipped -11, +11 lines =@@ - * @returns {Rectangle} the rect - */ - addRectangle() { -->addRectangle : () => Rectangle -+>addRectangle : () => any - - const obj = new Rectangle(); - >obj : Rectangle -@@= skipped -8, +8 lines =@@ +@@= skipped -19, +19 lines =@@ >Rectangle : typeof Rectangle this.objects.push(obj); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff index 535344ed3b..33db5def84 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration.types.diff @@ -1,14 +1,11 @@ --- old.jsDeclarationsTypeReassignmentFromDeclaration.types +++ new.jsDeclarationsTypeReassignmentFromDeclaration.types -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ module.exports = items; >module.exports = items : Item[] -->module.exports : Item[] + >module.exports : Item[] ->module : { exports: Item[]; } -->exports : Item[] -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module : { readonly items: Item[]; } + >exports : Item[] >items : Item[] diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff index 45f9a66f89..96e75d15e0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypeReassignmentFromDeclaration2.types.diff @@ -20,9 +20,9 @@ ->exports : Item[] ->items : Item[] +>module.exports = items : any -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module.exports : any ++>module : { readonly items: any; } ++>exports : any +>items : any === some-mod.d.ts === diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff index c8a9665c91..486a0fd3c3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndImportTypes.types.diff @@ -1,19 +1,15 @@ --- old.jsDeclarationsTypedefAndImportTypes.types +++ new.jsDeclarationsTypedefAndImportTypes.types -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ module.exports = Conn; >module.exports = Conn : typeof Conn -->module.exports : typeof Conn + >module.exports : typeof Conn ->module : { exports: typeof Conn; } -->exports : typeof Conn -+>module.exports : typeof import("conn") -+>module : { "conn": typeof import("conn"); } -+>exports : typeof import("conn") ++>module : { Conn: typeof Conn; } + >exports : typeof Conn >Conn : typeof Conn - === usage.js === -@@= skipped -17, +17 lines =@@ +@@= skipped -16, +16 lines =@@ * @param {Conn} c */ constructor(c) { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff index fad1efb89a..d966bec7bd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefAndLatebound.types.diff @@ -1,17 +1,6 @@ --- old.jsDeclarationsTypedefAndLatebound.types +++ new.jsDeclarationsTypedefAndLatebound.types -@@= skipped -1, +1 lines =@@ - - === index.js === - const LazySet = require("./LazySet"); -->LazySet : typeof LazySet -->require("./LazySet") : typeof LazySet -+>LazySet : typeof import("LazySet") -+>require("./LazySet") : typeof import("LazySet") - >require : any - >"./LazySet" : "./LazySet" - -@@= skipped -31, +31 lines =@@ +@@= skipped -32, +32 lines =@@ */ addAll(iterable) {} >addAll : (iterable: LazySet) => void @@ -20,15 +9,12 @@ [Symbol.iterator]() {} >[Symbol.iterator] : () => void -@@= skipped -11, +11 lines =@@ - +@@= skipped -12, +12 lines =@@ module.exports = LazySet; >module.exports = LazySet : typeof LazySet -->module.exports : typeof LazySet + >module.exports : typeof LazySet ->module : { exports: typeof LazySet; } -->exports : typeof LazySet -+>module.exports : typeof import("LazySet") -+>module : { "LazySet": typeof import("LazySet"); } -+>exports : typeof import("LazySet") ++>module : { LazySet: typeof LazySet; } + >exports : typeof LazySet >LazySet : typeof LazySet diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index e52de4e3ee..ac237ffaed 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -24,15 +24,12 @@ module.exports = MainThreadTasks; >module.exports = MainThreadTasks : typeof MainThreadTasks -->module.exports : typeof MainThreadTasks + >module.exports : typeof MainThreadTasks ->module : { exports: typeof MainThreadTasks; } -->exports : typeof MainThreadTasks -+>module.exports : typeof import("index") -+>module : { "index": typeof import("index"); } -+>exports : typeof import("index") ++>module : { MainThreadTasks: typeof MainThreadTasks; } + >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks - === module.js === @@= skipped -25, +25 lines =@@ * @type {{[P in TaskGroupIds]: {id: P, label: string}}} */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff index 49ec350cc9..e8fd4b4a33 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff @@ -18,8 +18,8 @@ const D = require("./mod1"); ->D : typeof D ->require("./mod1") : typeof D -+>D : typeof import("mod1") -+>require("./mod1") : typeof import("mod1") ++>D : typeof Chunk ++>require("./mod1") : typeof Chunk >require : (name: string) => any >"./mod1" : "./mod1" @@ -38,15 +38,12 @@ === types.d.ts === declare function require(name: string): any; -@@= skipped -50, +50 lines =@@ - } +@@= skipped -51, +51 lines =@@ module.exports = Chunk; >module.exports = Chunk : typeof Chunk -->module.exports : typeof Chunk + >module.exports : typeof Chunk ->module : { exports: typeof Chunk; } -->exports : typeof Chunk -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") ++>module : { Chunk: typeof Chunk; } + >exports : typeof Chunk >Chunk : typeof Chunk diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff index 9ec9ff7521..63eba2591e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff @@ -1,16 +1,6 @@ --- old.jsdocTypeReferenceToImportOfClassExpression.types +++ new.jsdocTypeReferenceToImportOfClassExpression.types -@@= skipped -1, +1 lines =@@ - - === MC.js === - const MW = require("./MW"); -->MW : typeof MW -->require("./MW") : typeof MW -+>MW : typeof import("MW") -+>require("./MW") : typeof import("MW") - >require : any - >"./MW" : "./MW" - +@@= skipped -9, +9 lines =@@ /** @typedef {number} Cictema */ module.exports = class MC { @@ -29,15 +19,7 @@ watch() { >watch : () => MW - - return new MW(this); - >new MW(this) : MW -->MW : typeof MW -+>MW : typeof import("MW") - >this : this - } - }; -@@= skipped -35, +35 lines =@@ +@@= skipped -27, +27 lines =@@ * @param {MC} compiler the compiler */ constructor(compiler) { @@ -57,11 +39,9 @@ module.exports = MW; >module.exports = MW : typeof MW -->module.exports : typeof MW + >module.exports : typeof MW ->module : { exports: typeof MW; } -->exports : typeof MW -+>module.exports : typeof import("MW") -+>module : { "MW": typeof import("MW"); } -+>exports : typeof import("MW") ++>module : { MW: typeof MW; } + >exports : typeof MW >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff index 1c05597744..94dd3dc913 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff @@ -1,17 +1,6 @@ --- old.jsdocTypeReferenceToImportOfFunctionExpression.types +++ new.jsdocTypeReferenceToImportOfFunctionExpression.types -@@= skipped -1, +1 lines =@@ - - === MC.js === - const MW = require("./MW"); -->MW : typeof MW -->require("./MW") : typeof MW -+>MW : typeof import("MW") -+>require("./MW") : typeof import("MW") - >require : any - >"./MW" : "./MW" - -@@= skipped -9, +9 lines =@@ +@@= skipped -10, +10 lines =@@ /** @class */ module.exports = function MC() { @@ -30,16 +19,7 @@ /** @type {any} */ var x = {} -@@= skipped -14, +14 lines =@@ - - return new MW(x); - >new MW(x) : MW -->MW : typeof MW -+>MW : typeof import("MW") - >x : any - - }; -@@= skipped -15, +15 lines =@@ +@@= skipped -29, +29 lines =@@ * @param {MC} compiler the compiler */ constructor(compiler) { @@ -59,11 +39,9 @@ module.exports = MW; >module.exports = MW : typeof MW -->module.exports : typeof MW + >module.exports : typeof MW ->module : { exports: typeof MW; } -->exports : typeof MW -+>module.exports : typeof import("MW") -+>module : { "MW": typeof import("MW"); } -+>exports : typeof import("MW") ++>module : { MW: typeof MW; } + >exports : typeof MW >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff index 7d38f2bbca..ae5c12ff25 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.errors.txt.diff @@ -3,25 +3,19 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+Eloquent.js(2,1): error TS2349: This expression is not callable. -+ Type '{}' has no call signatures. -+Eloquent.js(5,1): error TS1233: An export declaration can only be used at the top level of a namespace or module. ++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) ==== + // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript + (function() { -+ ~~~~~~~~~~~~~ + exports.bigOak = 1 -+ ~~~~~~~~~~~~~~~~~~ + exports.everywhere = 2 -+ ~~~~~~~~~~~~~~~~~~~~~~ + module.exports = exports -+ ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~ -+!!! error TS1233: An export declaration can only be used at the top level of a namespace or module. ++!!! 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. + })() -+ ~~ -+!!! error TS2349: This expression is not callable. -+!!! error TS2349: Type '{}' has no call signatures. + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff index c956394d25..c4a00470eb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasExports.types.diff @@ -1,19 +1,6 @@ --- old.moduleExportAliasExports.types +++ new.moduleExportAliasExports.types -@@= skipped -2, +2 lines =@@ - === Eloquent.js === - // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript - (function() { -->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : void -->(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : () => void -->function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : () => void -+>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports})() : any -+>(function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports}) : {} -+>function() {exports.bigOak = 1exports.everywhere = 2module.exports = exports} : {} - - exports.bigOak = 1 - >exports.bigOak = 1 : 1 -@@= skipped -21, +21 lines =@@ +@@= skipped -23, +23 lines =@@ module.exports = exports >module.exports = exports : typeof import("Eloquent") >module.exports : typeof import("Eloquent") diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff index 2e9c60442b..a70a1cd90d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.errors.txt.diff @@ -3,16 +3,21 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+bug28014.js(3,1): error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. ++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 (1 errors) ==== ++==== bug28014.js (3 errors) ==== + exports.version = 1 ++ ~~~~~~~ ++!!! error TS2339: Property 'version' does not exist on type 'typeof import("bug28014")'. + function alias() { } + module.exports = alias -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'version' is missing in type '() => void' but required in type 'typeof import("bug28014")'. -+!!! related TS2728 bug28014.js:1:1: 'version' is declared here. ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! 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/moduleExportAliasImported.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff index cf14e58294..296dd3626d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAliasImported.types.diff @@ -1,12 +1,15 @@ --- old.moduleExportAliasImported.types +++ new.moduleExportAliasImported.types -@@= skipped -3, +3 lines =@@ +@@= skipped -2, +2 lines =@@ + === bug28014.js === exports.version = 1 >exports.version = 1 : 1 - >exports.version : 1 +->exports.version : 1 ->exports : typeof alias +->version : 1 ++>exports.version : any +>exports : typeof import("bug28014") - >version : 1 ++>version : any >1 : 1 function alias() { } @@ -20,14 +23,14 @@ ->exports : typeof alias ->alias : typeof alias +>module.exports = alias : () => void -+>module.exports : typeof import("bug28014") -+>module : { "bug28014": typeof import("bug28014"); } -+>exports : typeof import("bug28014") ++>module.exports : () => void ++>module : { alias: () => void; } ++>exports : () => void +>alias : () => void === importer.js === import('./bug28014') ->import('./bug28014') : Promise<{ (): void; version: 1; }> -+>import('./bug28014') : Promise ++>import('./bug28014') : Promise<() => void> >'./bug28014' : "./bug28014" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff index 014c649410..6df2407fde 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.errors.txt.diff @@ -3,10 +3,11 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+axios.js(9,1): error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. ++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 (1 errors) ==== ++==== axios.js (2 errors) ==== + class Axios { + constructor() { + } @@ -16,8 +17,9 @@ + // none of the 3 references should have a use-before-def error + axios.m() + module.exports = axios; -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'default' is missing in type 'Axios' but required in type 'typeof import("axios")'. -+!!! related TS2728 axios.js:10:1: 'default' is declared here. ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! 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/moduleExportAssignment5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff index 6ac69a12b3..d01eaabcb1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment5.types.diff @@ -9,20 +9,22 @@ ->module : { exports: { m(): void; default: Axios; }; } ->exports : { m(): void; default: Axios; } +>module.exports = axios : Axios -+>module.exports : typeof import("axios") -+>module : { "axios": typeof import("axios"); } -+>exports : typeof import("axios") ++>module.exports : Axios ++>module : { axios: Axios; } ++>exports : Axios >axios : Axios module.exports.default = axios; >module.exports.default = axios : Axios - >module.exports.default : Axios +->module.exports.default : Axios ->module.exports : { m(): void; default: Axios; } ->module : { exports: { m(): void; default: Axios; }; } ->exports : { m(): void; default: Axios; } -+>module.exports : typeof import("axios") -+>module : { "axios": typeof import("axios"); } -+>exports : typeof import("axios") - >default : Axios +->default : Axios ++>module.exports.default : any ++>module.exports : Axios ++>module : { axios: Axios; } ++>exports : Axios ++>default : any >axios : Axios diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff index 355666c74f..7792808c23 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.errors.txt.diff @@ -3,14 +3,16 @@ @@= skipped -0, +-1 lines =@@ - @@= skipped --1, +1 lines =@@ -+axios.js(2,1): error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. ++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 (1 errors) ==== ++==== axios.js (2 errors) ==== + var axios = {} + module.exports = axios // both assignments should be ok -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'default' is missing in type '{}' but required in type 'typeof import("axios")'. -+!!! related TS2728 axios.js:3:1: 'default' is declared here. ++ ~~~~~~~~~~~~~~~~~~~~~~ ++!!! 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/moduleExportPropertyAssignmentDefault.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff index cb698e7d60..d9bbf26cbb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportPropertyAssignmentDefault.types.diff @@ -15,9 +15,9 @@ ->exports : typeof axios ->axios : typeof axios +>module.exports = axios : {} -+>module.exports : typeof import("axios") -+>module : { "axios": typeof import("axios"); } -+>exports : typeof import("axios") ++>module.exports : {} ++>module : { axios: {}; } ++>exports : {} +>axios : {} module.exports.default = axios @@ -29,10 +29,10 @@ ->default : typeof axios ->axios : typeof axios +>module.exports.default = axios : {} -+>module.exports.default : {} -+>module.exports : typeof import("axios") -+>module : { "axios": typeof import("axios"); } -+>exports : typeof import("axios") -+>default : {} ++>module.exports.default : any ++>module.exports : {} ++>module : { axios: {}; } ++>exports : {} ++>default : any +>axios : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff index 0b6b7554f5..45be2a7d6b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff @@ -9,35 +9,38 @@ -mod1.js(4,1): error TS2323: Cannot redeclare exported variable 'bothBefore'. -mod1.js(5,1): error TS2323: Cannot redeclare exported variable 'bothAfter'. -mod1.js(10,1): error TS2323: Cannot redeclare exported variable 'bothAfter'. -+a.js(4,17): error TS2339: Property 'toFixed' does not exist on type '"string"'. -+a.js(5,16): error TS2339: Property 'toFixed' does not exist on type '"string"'. -+mod1.js(6,1): error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. ++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; }'. - ==== a.js (2 errors) ==== -@@= skipped -13, +8 lines =@@ +-==== a.js (2 errors) ==== ++==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') mod1.justExport.toFixed() mod1.bothBefore.toFixed() // error - ~~~~~~~ +- ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -+!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.bothAfter.toFixed() - ~~~~~~~ +- ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -+!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. mod1.justProperty.length ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ==== requires.d.ts (0 errors) ==== declare var module: { exports: any }; - declare function require(name: string): any; --==== mod1.js (4 errors) ==== -+==== mod1.js (1 errors) ==== +@@= skipped -28, +21 lines =@@ /// module.exports.bothBefore = 'string' -- ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothBefore'. ++!!! error TS2322: Type 'string' is not assignable to type 'number'. A.justExport = 4 A.bothBefore = 2 - ~~~~~~~~~~~~ @@ -46,14 +49,16 @@ - ~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. module.exports = A -+ ~~~~~~~~~~~~~~ -+!!! error TS2741: Property 'justProperty' is missing in type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }' but required in type 'typeof import("mod1")'. -+!!! related TS2728 mod1.js:11:1: 'justProperty' is declared here. ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. function A() { this.p = 1 } module.exports.bothAfter = 'string' -- ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. ++!!! error TS2322: Type 'string' is not assignable to type 'number'. module.exports.justProperty = 'string' ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff index 5fc12d4da7..23d0e8f7a9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff @@ -6,8 +6,8 @@ var mod1 = require('./mod1') ->mod1 : typeof mod1 ->require('./mod1') : typeof mod1 -+>mod1 : typeof import("mod1") -+>require('./mod1') : typeof import("mod1") ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" @@ -16,40 +16,52 @@ >mod1.justExport.toFixed : (fractionDigits?: number) => string >mod1.justExport : number ->mod1 : typeof mod1 -+>mod1 : typeof import("mod1") ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >justExport : number >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error - >mod1.bothBefore.toFixed() : any - >mod1.bothBefore.toFixed : any +->mod1.bothBefore.toFixed() : any +->mod1.bothBefore.toFixed : any ->mod1.bothBefore : number | "string" ->mod1 : typeof mod1 ->bothBefore : number | "string" -+>mod1.bothBefore : "string" -+>mod1 : typeof import("mod1") -+>bothBefore : "string" - >toFixed : any +->toFixed : any ++>mod1.bothBefore.toFixed() : string ++>mod1.bothBefore.toFixed : (fractionDigits?: number) => string ++>mod1.bothBefore : number ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number ++>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() - >mod1.bothAfter.toFixed() : any - >mod1.bothAfter.toFixed : any +->mod1.bothAfter.toFixed() : any +->mod1.bothAfter.toFixed : any ->mod1.bothAfter : number | "string" ->mod1 : typeof mod1 ->bothAfter : number | "string" -+>mod1.bothAfter : "string" -+>mod1 : typeof import("mod1") -+>bothAfter : "string" - >toFixed : any +->toFixed : any ++>mod1.bothAfter.toFixed() : string ++>mod1.bothAfter.toFixed : (fractionDigits?: number) => string ++>mod1.bothAfter : number ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number ++>toFixed : (fractionDigits?: number) => string mod1.justProperty.length - >mod1.justProperty.length : number - >mod1.justProperty : "string" +->mod1.justProperty.length : number +->mod1.justProperty : "string" ->mod1 : typeof mod1 -+>mod1 : typeof import("mod1") - >justProperty : "string" - >length : number +->justProperty : "string" +->length : number ++>mod1.justProperty.length : any ++>mod1.justProperty : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>justProperty : any ++>length : any + === requires.d.ts === + declare var module: { exports: any }; @@= skipped -40, +40 lines =@@ /// module.exports.bothBefore = 'string' @@ -59,11 +71,11 @@ ->module : { exports: typeof A; } ->exports : typeof A ->bothBefore : number | "string" -+>module.exports.bothBefore : "string" -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") -+>bothBefore : "string" ++>module.exports.bothBefore : number ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number >'string' : "string" A.justExport = 4 @@ -101,9 +113,9 @@ ->exports : typeof A ->A : typeof A +>module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } function A() { @@ -125,22 +137,24 @@ ->module : { exports: typeof A; } ->exports : typeof A ->bothAfter : number | "string" -+>module.exports.bothAfter : "string" -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") -+>bothAfter : "string" ++>module.exports.bothAfter : number ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number >'string' : "string" module.exports.justProperty = 'string' >module.exports.justProperty = 'string' : "string" - >module.exports.justProperty : "string" +->module.exports.justProperty : "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") - >justProperty : "string" +->justProperty : "string" ++>module.exports.justProperty : any ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>justProperty : any >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff index b5770b0e92..2dac119c36 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).errors.txt.diff @@ -2,6 +2,7 @@ +++ new.nodeModulesAllowJsExportAssignment(module=node16).errors.txt @@= skipped -0, +0 lines =@@ -file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. @@ -27,14 +28,15 @@ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ~~~~~~~~~~~ -!!! error TS8003: 'export =' can only be used in TypeScript files. --==== file.js (1 errors) ==== -+==== file.js (0 errors) ==== + ==== file.js (1 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff index 44f7ca9d8e..e2f961ea64 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node16).types.diff @@ -1,19 +1,15 @@ --- old.nodeModulesAllowJsExportAssignment(module=node16).types +++ new.nodeModulesAllowJsExportAssignment(module=node16).types -@@= skipped -16, +16 lines =@@ - +@@= skipped -17, +17 lines =@@ module.exports = a; >module.exports = a : {} -->module.exports : {} + >module.exports : {} ->module : { exports: {}; } -->exports : {} -+>module.exports : typeof import("subfolder/file") -+>module : { "subfolder/file": typeof import("subfolder/file"); } -+>exports : typeof import("subfolder/file") ++>module : { readonly a: {}; } + >exports : {} >a : {} - === index.js === -@@= skipped -22, +22 lines =@@ +@@= skipped -21, +21 lines =@@ >{} : {} module.exports = a; @@ -22,8 +18,8 @@ ->module : any ->exports : any +>module.exports = a : {} -+>module.exports : typeof import("file") -+>module : { "file": typeof import("file"); } -+>exports : typeof import("file") ++>module.exports : {} ++>module : { readonly a: {}; } ++>exports : {} >a : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff index 93db0ab644..a3ea3773fb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt.diff @@ -2,6 +2,7 @@ +++ new.nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. @@ -27,14 +28,15 @@ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ~~~~~~~~~~~ -!!! error TS8003: 'export =' can only be used in TypeScript files. --==== file.js (1 errors) ==== -+==== file.js (0 errors) ==== + ==== file.js (1 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff index 488e7dab60..542c8c9c7b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=nodenext).types.diff @@ -1,19 +1,15 @@ --- old.nodeModulesAllowJsExportAssignment(module=nodenext).types +++ new.nodeModulesAllowJsExportAssignment(module=nodenext).types -@@= skipped -16, +16 lines =@@ - +@@= skipped -17, +17 lines =@@ module.exports = a; >module.exports = a : {} -->module.exports : {} + >module.exports : {} ->module : { exports: {}; } -->exports : {} -+>module.exports : typeof import("subfolder/file") -+>module : { "subfolder/file": typeof import("subfolder/file"); } -+>exports : typeof import("subfolder/file") ++>module : { readonly a: {}; } + >exports : {} >a : {} - === index.js === -@@= skipped -22, +22 lines =@@ +@@= skipped -21, +21 lines =@@ >{} : {} module.exports = a; @@ -22,8 +18,8 @@ ->module : any ->exports : any +>module.exports = a : {} -+>module.exports : typeof import("file") -+>module : { "file": typeof import("file"); } -+>exports : typeof import("file") ++>module.exports : {} ++>module : { readonly a: {}; } ++>exports : {} >a : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff index bce6d38de8..73a750af67 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromParamTagForFunction.types.diff @@ -31,35 +31,26 @@ >require("./a-ext") : typeof import("a-ext") >require : (id: string) => any >"./a-ext" : "./a-ext" - - /** @param {A} p */ +@@= skipped -9, +9 lines =@@ function a(p) { p.x; } -->a : (p: A) => void -->p : A + >a : (p: A) => void + >p : A ->p.x : number -->p : A -->x : number -+>a : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : A +->x : number +>x : any === b-ext.js === exports.B = class { -@@= skipped -40, +40 lines =@@ - - /** @param {B} p */ +@@= skipped -33, +33 lines =@@ function b(p) { p.x; } -->b : (p: B) => void -->p : B + >b : (p: B) => void + >p : B ->p.x : number -->p : B -->x : number -+>b : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : B +->x : number +>x : any === c-ext.js === @@ -83,18 +74,14 @@ >require("./c-ext") : typeof import("c-ext") >require : (id: string) => any >"./c-ext" : "./c-ext" - - /** @param {C} p */ +@@= skipped -27, +27 lines =@@ function c(p) { p.x; } -->c : (p: C) => void -->p : C + >c : (p: C) => void + >p : C ->p.x : number -->p : C -->x : number -+>c : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : C +->x : number +>x : any === d-ext.js === @@ -112,7 +99,7 @@ >x : any >1 : 1 -@@= skipped -49, +49 lines =@@ +@@= skipped -20, +20 lines =@@ === d.js === const { D } = require("./d-ext"); @@ -121,23 +108,19 @@ >require("./d-ext") : typeof import("d-ext") >require : (id: string) => any >"./d-ext" : "./d-ext" - - /** @param {D} p */ +@@= skipped -9, +9 lines =@@ function d(p) { p.x; } -->d : (p: D) => void -->p : D + >d : (p: D) => void + >p : D ->p.x : number -->p : D -->x : number -+>d : (p: any) => void -+>p : any +>p.x : any -+>p : any + >p : D +->x : number +>x : any === e-ext.js === export class E { -@@= skipped -38, +38 lines =@@ +@@= skipped -29, +29 lines =@@ function e(p) { p.x; } >e : (p: E) => void >p : E diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff index e049d82c35..07106b9f41 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff @@ -6,8 +6,8 @@ var mini = require('./minimatch') ->mini : typeof mini ->require('./minimatch') : typeof mini -+>mini : typeof import("minimatch") -+>require('./minimatch') : typeof import("minimatch") ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >require : any >'./minimatch' : "./minimatch" @@ -18,7 +18,7 @@ ->mini : typeof mini ->M : typeof M +>mini.M : { (): void; defaults: (def: any) => any; } -+>mini : typeof import("minimatch") ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } >defaults : (def: any) => any @@ -31,7 +31,7 @@ +>m : any +>new mini.M() : any +>mini.M : { (): void; defaults: (def: any) => any; } -+>mini : typeof import("minimatch") ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } m.m() @@ -48,7 +48,7 @@ >mini.filter() : void >mini.filter : () => void ->mini : typeof mini -+>mini : typeof import("minimatch") ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >filter : () => void === types.d.ts === @@ -62,9 +62,9 @@ ->exports : typeof minimatch ->minimatch : typeof minimatch +>module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } -+>module.exports : typeof import("minimatch") -+>module : { "minimatch": typeof import("minimatch"); } -+>exports : typeof import("minimatch") ++>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } ++>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } minimatch.M = M diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff index 3a087b89d8..30f0ff3b5f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule.types.diff @@ -10,9 +10,9 @@ ->exports : typeof C ->C : typeof C +>module.exports = C : () => void -+>module.exports : typeof import("mod1") -+>module : { "mod1": typeof import("mod1"); } -+>exports : typeof import("mod1") ++>module.exports : () => void ++>module : { C: () => void; } ++>exports : () => void +>C : () => void function C() { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index 6694396202..abe8829172 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -11,17 +11,10 @@ +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; }'. -+use.js(4,12): error TS2503: Cannot find namespace 'mod'. --==== use.js (0 errors) ==== -+==== use.js (1 errors) ==== - var mod = require('./mod1.js'); - /** @type {import("./mod1.js").Baz} */ - var b; - /** @type {mod.Baz} */ -+ ~~~ -+!!! error TS2503: Cannot find namespace 'mod'. + ==== use.js (0 errors) ==== +@@= skipped -11, +15 lines =@@ var bb; var bbb = new mod.Baz(); @@ -30,7 +23,7 @@ // error /** @typedef {number} Foo */ -@@= skipped -23, +30 lines =@@ +@@= skipped -12, +12 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index 6044b381cd..c6acb76186 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -11,14 +11,7 @@ >require : any >'./mod1.js' : "./mod1.js" -@@= skipped -11, +11 lines =@@ - - /** @type {mod.Baz} */ - var bb; -->bb : number -+>bb : Baz - - var bbb = new mod.Baz(); +@@= skipped -17, +17 lines =@@ >bbb : Baz >new mod.Baz() : Baz >mod.Baz : typeof Baz @@ -27,7 +20,7 @@ >Baz : typeof Baz === mod1.js === -@@= skipped -19, +19 lines =@@ +@@= skipped -13, +13 lines =@@ /** @typedef {number} Bar */ exports.Bar = class { } >exports.Bar = class { } : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff index beaba830fd..968f4002a1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule3.types.diff @@ -25,9 +25,9 @@ ->exports : typeof ns ->ns : typeof ns +>module.exports = ns : {} -+>module.exports : typeof import("mod2") -+>module : { "mod2": typeof import("mod2"); } -+>exports : typeof import("mod2") ++>module.exports : {} ++>module : { readonly ns: {}; } ++>exports : {} +>ns : {}