diff --git a/internal/checker/checker.go b/internal/checker/checker.go index cdbff642a0..f4a503d226 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -528,6 +528,7 @@ type Program interface { FileExists(fileName string) bool GetSourceFile(fileName string) *ast.SourceFile GetEmitModuleFormatOfFile(sourceFile ast.HasFileName) core.ModuleKind + GetEmitSyntaxForUsageLocation(sourceFile ast.HasFileName, usageLocation *ast.StringLiteralLike) core.ResolutionMode GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ModuleKind GetResolvedModule(currentSourceFile ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule GetResolvedModules() map[tspath.Path]module.ModeAwareCache[*module.ResolvedModule] @@ -5016,7 +5017,10 @@ func (c *Checker) checkImportDeclaration(node *ast.Node) { } } } - if c.isOnlyImportableAsDefault(moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node) { + if !importClause.IsTypeOnly() && + core.ModuleKindNode18 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && + c.isOnlyImportableAsDefault(moduleSpecifier, resolvedModule) && + !hasTypeJsonImportAttribute(node) { c.error(moduleSpecifier, diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, c.moduleKind.String()) } } else if c.compilerOptions.NoUncheckedSideEffectImports.IsTrue() && importClause == nil { @@ -5113,29 +5117,32 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { if isTypeOnly && override != core.ResolutionModeNone { return // Other grammar checks do not apply to type-only imports with resolution mode assertions } - var mode core.ResolutionMode - if c.moduleKind == core.ModuleKindNodeNext { - if moduleSpecifier := getModuleSpecifierFromNode(declaration); moduleSpecifier != nil { - mode = c.getEmitSyntaxForModuleSpecifierExpression(moduleSpecifier) + + if !c.moduleKind.SupportsImportAttributes() { + if isImportAttributes { + c.grammarErrorOnNode(node, diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve) + } else { + c.grammarErrorOnNode(node, diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve) } + return } - if mode != core.ModuleKindESNext && c.moduleKind != core.ModuleKindESNext && c.moduleKind != core.ModuleKindPreserve { - var message *diagnostics.Message - switch { - case isImportAttributes: - if c.moduleKind == core.ModuleKindNodeNext { - message = diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls + + if c.moduleKind == core.ModuleKindNodeNext && !isImportAttributes { + c.grammarErrorOnNode(node, diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) + return + } + + if moduleSpecifier := getModuleSpecifierFromNode(declaration); moduleSpecifier != nil { + if c.getEmitSyntaxForModuleSpecifierExpression(moduleSpecifier) == core.ModuleKindCommonJS { + if isImportAttributes { + c.grammarErrorOnNode(node, diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls) } else { - message = diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve + c.grammarErrorOnNode(node, diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls) } - case c.moduleKind == core.ModuleKindNodeNext: - message = diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls - default: - message = diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve + return } - c.grammarErrorOnNode(node, message) - return } + if isTypeOnly { c.grammarErrorOnNode(node, core.IfElse(isImportAttributes, diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports, @@ -10210,7 +10217,7 @@ func (c *Checker) checkNewTargetMetaProperty(node *ast.Node) *Type { } func (c *Checker) checkImportMetaProperty(node *ast.Node) *Type { - if c.moduleKind == core.ModuleKindNode16 || c.moduleKind == core.ModuleKindNodeNext { + if core.ModuleKindNode16 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext { sourceFileMetaData := c.program.GetSourceFileMetaData(ast.GetSourceFileOfNode(node).Path()) if sourceFileMetaData == nil || sourceFileMetaData.ImpliedNodeFormat != core.ModuleKindESNext { c.error(node, diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output) @@ -14092,10 +14099,9 @@ func (c *Checker) canHaveSyntheticDefault(file *ast.Node, moduleSymbol *ast.Symb } func (c *Checker) getEmitSyntaxForModuleSpecifierExpression(usage *ast.Node) core.ResolutionMode { - // !!! - // if isStringLiteralLike(usage) { - // return host.getEmitSyntaxForUsageLocation(ast.GetSourceFileOfNode(usage), usage) - // } + if ast.IsStringLiteralLike(usage) { + return c.program.GetEmitSyntaxForUsageLocation(ast.GetSourceFileOfNode(usage), usage) + } return core.ModuleKindNone } @@ -14446,7 +14452,7 @@ func (c *Checker) resolveExternalModule(location *ast.Node, moduleReference stri if resolvedModule.IsExternalLibraryImport && !(tspath.ExtensionIsTs(resolvedModule.Extension) || resolvedModule.Extension == tspath.ExtensionJson) { c.errorOnImplicitAnyModule(false /*isError*/, errorNode, mode, resolvedModule, moduleReference) } - if c.moduleResolutionKind == core.ModuleResolutionKindNode16 || c.moduleResolutionKind == core.ModuleResolutionKindNodeNext { + if c.moduleKind == core.ModuleKindNode16 || c.moduleKind == core.ModuleKindNode18 { isSyncImport := c.program.GetDefaultResolutionModeForFile(importingSourceFile) == core.ModuleKindCommonJS && ast.FindAncestor(location, ast.IsImportCall) == nil || ast.FindAncestor(location, ast.IsImportEqualsDeclaration) != nil overrideHost := ast.FindAncestor(location, ast.IsResolutionModeOverrideHost) diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index c723edc3fc..30d24f06f7 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1211,7 +1211,7 @@ func (c *Checker) checkGrammarForInOrForOfStatement(forInOrOfStatement *ast.ForI c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.X_for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module)) } switch c.moduleKind { - case core.ModuleKindNode16, core.ModuleKindNodeNext: + case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) if sourceFileMetaData != nil && sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)) @@ -1724,6 +1724,7 @@ func (c *Checker) checkGrammarAwaitOrAwaitUsing(node *ast.Node) bool { } switch c.moduleKind { case core.ModuleKindNode16, + core.ModuleKindNode18, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) if sourceFileMetaData != nil && sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index d8f868a86f..53d6a35fa8 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -512,17 +512,12 @@ func importSyntaxAffectsModuleResolution(options *core.CompilerOptions) bool { } func getEmitSyntaxForUsageLocationWorker(fileName string, meta *ast.SourceFileMetaData, usage *ast.Node, options *core.CompilerOptions) core.ResolutionMode { - if options == nil { - // This should always be provided, but we try to fail somewhat - // gracefully to allow projects like ts-node time to update. - return core.ResolutionModeNone - } - if ast.IsRequireCall(usage.Parent) || ast.IsExternalModuleReference(usage.Parent) && ast.IsImportEqualsDeclaration(usage.Parent.Parent) { return core.ModuleKindCommonJS } + fileEmitMode := ast.GetEmitModuleFormatOfFileWorker(fileName, options, meta) if ast.IsImportCall(ast.WalkUpParenthesizedExpressions(usage.Parent)) { - if ast.ShouldTransformImportCall(fileName, options, ast.GetImpliedNodeFormatForEmitWorker(fileName, options, meta)) { + if ast.ShouldTransformImportCall(fileName, options, fileEmitMode) { return core.ModuleKindCommonJS } else { return core.ModuleKindESNext @@ -535,7 +530,6 @@ func getEmitSyntaxForUsageLocationWorker(fileName string, meta *ast.SourceFileMe // file, until/unless declaration emit can indicate a true ESM import. On the // other hand, writing CJS syntax in a definitely-ESM file is fine, since declaration // emit preserves the CJS syntax. - fileEmitMode := ast.GetEmitModuleFormatOfFileWorker(fileName, options, meta) if fileEmitMode == core.ModuleKindCommonJS { return core.ModuleKindCommonJS } else { diff --git a/internal/compiler/program.go b/internal/compiler/program.go index eef24c592b..3f9c008075 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -689,6 +689,10 @@ func (p *Program) GetEmitModuleFormatOfFile(sourceFile ast.HasFileName) core.Mod return ast.GetEmitModuleFormatOfFileWorker(sourceFile.FileName(), p.Options(), p.GetSourceFileMetaData(sourceFile.Path())) } +func (p *Program) GetEmitSyntaxForUsageLocation(sourceFile ast.HasFileName, location *ast.StringLiteralLike) core.ResolutionMode { + return getEmitSyntaxForUsageLocationWorker(sourceFile.FileName(), p.sourceFileMetaDatas[sourceFile.Path()], location, p.Options()) +} + func (p *Program) GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ResolutionMode { return ast.GetImpliedNodeFormatForEmitWorker(sourceFile.FileName(), p.Options(), p.GetSourceFileMetaData(sourceFile.Path())) } diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index efdd33719b..46d14393f9 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -149,7 +149,7 @@ func (options *CompilerOptions) GetEmitScriptTarget() ScriptTarget { return options.Target } switch options.GetEmitModuleKind() { - case ModuleKindNode16: + case ModuleKindNode16, ModuleKindNode18: return ScriptTargetES2022 case ModuleKindNodeNext: return ScriptTargetESNext @@ -173,7 +173,7 @@ func (options *CompilerOptions) GetModuleResolutionKind() ModuleResolutionKind { return options.ModuleResolution } switch options.GetEmitModuleKind() { - case ModuleKindNode16: + case ModuleKindNode16, ModuleKindNode18: return ModuleResolutionKindNode16 case ModuleKindNodeNext: return ModuleResolutionKindNodeNext @@ -357,6 +357,12 @@ func (moduleKind ModuleKind) IsNonNodeESM() bool { return moduleKind >= ModuleKindES2015 && moduleKind <= ModuleKindESNext } +func (moduleKind ModuleKind) SupportsImportAttributes() bool { + return ModuleKindNode18 <= moduleKind && moduleKind <= ModuleKindNodeNext || + moduleKind == ModuleKindPreserve || + moduleKind == ModuleKindESNext +} + type ResolutionMode = ModuleKind // ModuleKindNone | ModuleKindCommonJS | ModuleKindESNext const ( diff --git a/internal/transformers/importelision_test.go b/internal/transformers/importelision_test.go index eaf9f82751..63b12b8c89 100644 --- a/internal/transformers/importelision_test.go +++ b/internal/transformers/importelision_test.go @@ -25,6 +25,11 @@ type fakeProgram struct { getSourceFile func(FileName string) *ast.SourceFile } +// GetEmitSyntaxForUsageLocation implements checker.Program. +func (p *fakeProgram) GetEmitSyntaxForUsageLocation(sourceFile ast.HasFileName, usageLocation *ast.StringLiteralLike) core.ResolutionMode { + panic("unimplemented") +} + // CommonSourceDirectory implements checker.Program. func (p *fakeProgram) CommonSourceDirectory() string { panic("unimplemented") diff --git a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js index 4c852b2a78..d2952e4681 100644 --- a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js +++ b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js @@ -61,4 +61,10 @@ export default _default; declare const _default: string; export default _default; //// [index.d.ts] -export declare const mod: typeof import("./case0.js") | typeof import("./case1.js") | typeof import("./caseFallback.js"); +export declare const mod: { + default: typeof import("./case0.js"); +} | { + default: typeof import("./case1.js"); +} | { + default: typeof import("./caseFallback.js"); +}; diff --git a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js.diff b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js.diff index 9dd3a09ae1..d71e81a02e 100644 --- a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js.diff +++ b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.js.diff @@ -16,11 +16,4 @@ +declare const _default: string; export default _default; //// [index.d.ts] --export declare const mod: { -- default: typeof import("./case0.js"); --} | { -- default: typeof import("./case1.js"); --} | { -- default: typeof import("./caseFallback.js"); --}; -+export declare const mod: typeof import("./case0.js") | typeof import("./case1.js") | typeof import("./caseFallback.js"); \ No newline at end of file + export declare const mod: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types index 5b602ff759..65472a1185 100644 --- a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types +++ b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types @@ -14,11 +14,11 @@ export default 'fallback'; === /index.ts === export const mod = await (async () => { ->mod : typeof import("./case0.js") | typeof import("./case1.js") | typeof import("./caseFallback.js") ->await (async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : typeof import("./case0.js") | typeof import("./case1.js") | typeof import("./caseFallback.js") ->(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : Promise ->(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }}) : () => Promise ->async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }} : () => Promise +>mod : { default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); } +>await (async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : { default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); } +>(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : Promise<{ default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); }> +>(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }}) : () => Promise<{ default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); }> +>async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }} : () => Promise<{ default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); }> const x: number = 0; >x : number @@ -31,22 +31,22 @@ export const mod = await (async () => { >0 : 0 return await import("./case0.js"); ->await import("./case0.js") : typeof import("./case0.js") ->import("./case0.js") : Promise +>await import("./case0.js") : { default: typeof import("./case0.js"); } +>import("./case0.js") : Promise<{ default: typeof import("./case0.js"); }> >"./case0.js" : "./case0.js" case 1: >1 : 1 return await import("./case1.js"); ->await import("./case1.js") : typeof import("./case1.js") ->import("./case1.js") : Promise +>await import("./case1.js") : { default: typeof import("./case1.js"); } +>import("./case1.js") : Promise<{ default: typeof import("./case1.js"); }> >"./case1.js" : "./case1.js" default: return await import("./caseFallback.js"); ->await import("./caseFallback.js") : typeof import("./caseFallback.js") ->import("./caseFallback.js") : Promise +>await import("./caseFallback.js") : { default: typeof import("./caseFallback.js"); } +>import("./caseFallback.js") : Promise<{ default: typeof import("./caseFallback.js"); }> >"./caseFallback.js" : "./caseFallback.js" } })(); diff --git a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types.diff b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types.diff index 430789c0ec..71dcd79762 100644 --- a/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types.diff +++ b/testdata/baselines/reference/submodule/compiler/dynamicImportsDeclaration.types.diff @@ -9,11 +9,11 @@ ->(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : Promise<{ default: typeof import("/case0"); } | { default: typeof import("/case1"); } | { default: typeof import("/caseFallback"); }> ->(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }}) : () => Promise<{ default: typeof import("/case0"); } | { default: typeof import("/case1"); } | { default: typeof import("/caseFallback"); }> ->async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }} : () => Promise<{ default: typeof import("/case0"); } | { default: typeof import("/case1"); } | { default: typeof import("/caseFallback"); }> -+>mod : typeof import("./case0.js") | typeof import("./case1.js") | typeof import("./caseFallback.js") -+>await (async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : typeof import("./case0.js") | typeof import("./case1.js") | typeof import("./caseFallback.js") -+>(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : Promise -+>(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }}) : () => Promise -+>async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }} : () => Promise ++>mod : { default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); } ++>await (async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : { default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); } ++>(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }})() : Promise<{ default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); }> ++>(async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }}) : () => Promise<{ default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); }> ++>async () => { const x: number = 0; switch (x) { case 0: return await import("./case0.js"); case 1: return await import("./case1.js"); default: return await import("./caseFallback.js"); }} : () => Promise<{ default: typeof import("./case0.js"); } | { default: typeof import("./case1.js"); } | { default: typeof import("./caseFallback.js"); }> const x: number = 0; >x : number @@ -23,8 +23,8 @@ return await import("./case0.js"); ->await import("./case0.js") : { default: typeof import("/case0"); } ->import("./case0.js") : Promise<{ default: typeof import("/case0"); }> -+>await import("./case0.js") : typeof import("./case0.js") -+>import("./case0.js") : Promise ++>await import("./case0.js") : { default: typeof import("./case0.js"); } ++>import("./case0.js") : Promise<{ default: typeof import("./case0.js"); }> >"./case0.js" : "./case0.js" case 1: @@ -33,16 +33,16 @@ return await import("./case1.js"); ->await import("./case1.js") : { default: typeof import("/case1"); } ->import("./case1.js") : Promise<{ default: typeof import("/case1"); }> -+>await import("./case1.js") : typeof import("./case1.js") -+>import("./case1.js") : Promise ++>await import("./case1.js") : { default: typeof import("./case1.js"); } ++>import("./case1.js") : Promise<{ default: typeof import("./case1.js"); }> >"./case1.js" : "./case1.js" default: return await import("./caseFallback.js"); ->await import("./caseFallback.js") : { default: typeof import("/caseFallback"); } ->import("./caseFallback.js") : Promise<{ default: typeof import("/caseFallback"); }> -+>await import("./caseFallback.js") : typeof import("./caseFallback.js") -+>import("./caseFallback.js") : Promise ++>await import("./caseFallback.js") : { default: typeof import("./caseFallback.js"); } ++>import("./caseFallback.js") : Promise<{ default: typeof import("./caseFallback.js"); }> >"./caseFallback.js" : "./caseFallback.js" } })(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt b/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt index b6240849cb..dc0da475b3 100644 --- a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt @@ -1,3 +1,4 @@ +main.mts(1,8): error TS1192: Module '"other"' has no default export. other.d.mts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. @@ -7,6 +8,8 @@ other.d.mts(2,1): error TS1203: Export assignment cannot be used when targeting ~~~~~~~~~~~~~~~~~ !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -==== main.mts (0 errors) ==== +==== main.mts (1 errors) ==== import example from "./other.mjs"; + ~~~~~~~ +!!! error TS1192: Module '"other"' has no default export. example(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt.diff deleted file mode 100644 index 5bbf1e4e9f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.esmModeDeclarationFileWithExportAssignment.errors.txt -+++ new.esmModeDeclarationFileWithExportAssignment.errors.txt -@@= skipped -0, +0 lines =@@ --main.mts(1,8): error TS1192: Module '"other"' has no default export. - other.d.mts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - - -@@= skipped -7, +6 lines =@@ - ~~~~~~~~~~~~~~~~~ - !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - --==== main.mts (1 errors) ==== -+==== main.mts (0 errors) ==== - import example from "./other.mjs"; -- ~~~~~~~ --!!! error TS1192: Module '"other"' has no default export. - example(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types b/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types index 25b8cc8c23..9bc57326b7 100644 --- a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types +++ b/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types @@ -9,9 +9,9 @@ export = example; === main.mts === import example from "./other.mjs"; ->example : () => 5 +>example : any example(); ->example() : 5 ->example : () => 5 +>example() : any +>example : any diff --git a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types.diff b/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types.diff deleted file mode 100644 index 4445600b63..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esmModeDeclarationFileWithExportAssignment.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.esmModeDeclarationFileWithExportAssignment.types -+++ new.esmModeDeclarationFileWithExportAssignment.types -@@= skipped -8, +8 lines =@@ - - === main.mts === - import example from "./other.mjs"; -->example : any -+>example : () => 5 - - example(); -->example() : any -->example : any -+>example() : 5 -+>example : () => 5 diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).errors.txt b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).errors.txt new file mode 100644 index 0000000000..1c86c3703f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).errors.txt @@ -0,0 +1,23 @@ +/index.ts(1,8): error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. +/index.ts(7,8): error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. + + +==== /node_modules/mdast-util-to-string/package.json (0 errors) ==== + { "type": "module" } + +==== /node_modules/mdast-util-to-string/index.d.ts (0 errors) ==== + export function toString(): string; + +==== /index.ts (2 errors) ==== + import mdast, { toString } from 'mdast-util-to-string'; + ~~~~~ +!!! error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. + mdast; + mdast.toString(); + + const mdast2 = await import('mdast-util-to-string'); + mdast2.toString(); + mdast2.default; + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).errors.txt.diff deleted file mode 100644 index f4798a2a79..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.esmNoSynthesizedDefault(module=esnext).errors.txt -+++ new.esmNoSynthesizedDefault(module=esnext).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(1,8): error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. --/index.ts(7,8): error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. -- -- --==== /node_modules/mdast-util-to-string/package.json (0 errors) ==== -- { "type": "module" } -- --==== /node_modules/mdast-util-to-string/index.d.ts (0 errors) ==== -- export function toString(): string; -- --==== /index.ts (2 errors) ==== -- import mdast, { toString } from 'mdast-util-to-string'; -- ~~~~~ --!!! error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. -- mdast; -- mdast.toString(); -- -- const mdast2 = await import('mdast-util-to-string'); -- mdast2.toString(); -- mdast2.default; -- ~~~~~~~ --!!! error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols index 7a96977509..240b767551 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols @@ -13,9 +13,7 @@ mdast; >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) mdast.toString(); ->mdast.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) ->toString : Symbol(toString, Decl(index.d.ts, 0, 0)) const mdast2 = await import('mdast-util-to-string'); >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) @@ -26,7 +24,5 @@ mdast2.toString(); >toString : Symbol(toString, Decl(index.d.ts, 0, 0)) mdast2.default; ->mdast2.default : Symbol(default) >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) ->default : Symbol(default) diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols.diff b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols.diff index 7829c1cd88..478c6e5db9 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).symbols.diff @@ -1,23 +1,10 @@ --- old.esmNoSynthesizedDefault(module=esnext).symbols +++ new.esmNoSynthesizedDefault(module=esnext).symbols -@@= skipped -12, +12 lines =@@ - >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) - - mdast.toString(); -+>mdast.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) - >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) -+>toString : Symbol(toString, Decl(index.d.ts, 0, 0)) +@@= skipped -16, +16 lines =@@ const mdast2 = await import('mdast-util-to-string'); >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) ->'mdast-util-to-string' : Symbol("/node_modules/mdast-util-to-string/index", Decl(index.d.ts, 0, 0)) mdast2.toString(); - >mdast2.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) -@@= skipped -12, +13 lines =@@ - >toString : Symbol(toString, Decl(index.d.ts, 0, 0)) - - mdast2.default; -+>mdast2.default : Symbol(default) - >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) -+>default : Symbol(default) + >mdast2.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types index 4641b4346d..c25d7ac873 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types @@ -6,32 +6,32 @@ export function toString(): string; === /index.ts === import mdast, { toString } from 'mdast-util-to-string'; ->mdast : typeof mdast +>mdast : any >toString : () => string mdast; ->mdast : typeof mdast +>mdast : any mdast.toString(); ->mdast.toString() : string ->mdast.toString : () => string ->mdast : typeof mdast ->toString : () => string +>mdast.toString() : any +>mdast.toString : any +>mdast : any +>toString : any const mdast2 = await import('mdast-util-to-string'); ->mdast2 : { toString(): string; default: typeof mdast; } ->await import('mdast-util-to-string') : { toString(): string; default: typeof mdast; } ->import('mdast-util-to-string') : Promise<{ toString(): string; default: typeof mdast; }> +>mdast2 : typeof import("mdast-util-to-string") +>await import('mdast-util-to-string') : typeof import("mdast-util-to-string") +>import('mdast-util-to-string') : Promise >'mdast-util-to-string' : "mdast-util-to-string" mdast2.toString(); >mdast2.toString() : string >mdast2.toString : () => string ->mdast2 : { toString(): string; default: typeof mdast; } +>mdast2 : typeof import("mdast-util-to-string") >toString : () => string mdast2.default; ->mdast2.default : typeof mdast ->mdast2 : { toString(): string; default: typeof mdast; } ->default : typeof mdast +>mdast2.default : any +>mdast2 : typeof import("mdast-util-to-string") +>default : any diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types.diff b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types.diff index 473ed0f39a..e89280d0fc 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=esnext).types.diff @@ -1,47 +1,26 @@ --- old.esmNoSynthesizedDefault(module=esnext).types +++ new.esmNoSynthesizedDefault(module=esnext).types -@@= skipped -5, +5 lines =@@ - - === /index.ts === - import mdast, { toString } from 'mdast-util-to-string'; -->mdast : any -+>mdast : typeof mdast - >toString : () => string - - mdast; -->mdast : any -+>mdast : typeof mdast - - mdast.toString(); -->mdast.toString() : any -->mdast.toString : any -->mdast : any -->toString : any -+>mdast.toString() : string -+>mdast.toString : () => string -+>mdast : typeof mdast -+>toString : () => string +@@= skipped -18, +18 lines =@@ + >toString : any const mdast2 = await import('mdast-util-to-string'); ->mdast2 : typeof import("/node_modules/mdast-util-to-string/index") ->await import('mdast-util-to-string') : typeof import("/node_modules/mdast-util-to-string/index") ->import('mdast-util-to-string') : Promise -+>mdast2 : { toString(): string; default: typeof mdast; } -+>await import('mdast-util-to-string') : { toString(): string; default: typeof mdast; } -+>import('mdast-util-to-string') : Promise<{ toString(): string; default: typeof mdast; }> ++>mdast2 : typeof import("mdast-util-to-string") ++>await import('mdast-util-to-string') : typeof import("mdast-util-to-string") ++>import('mdast-util-to-string') : Promise >'mdast-util-to-string' : "mdast-util-to-string" mdast2.toString(); >mdast2.toString() : string >mdast2.toString : () => string ->mdast2 : typeof import("/node_modules/mdast-util-to-string/index") -+>mdast2 : { toString(): string; default: typeof mdast; } ++>mdast2 : typeof import("mdast-util-to-string") >toString : () => string mdast2.default; -->mdast2.default : any + >mdast2.default : any ->mdast2 : typeof import("/node_modules/mdast-util-to-string/index") -->default : any -+>mdast2.default : typeof mdast -+>mdast2 : { toString(): string; default: typeof mdast; } -+>default : typeof mdast ++>mdast2 : typeof import("mdast-util-to-string") + >default : any diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).errors.txt b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).errors.txt new file mode 100644 index 0000000000..1c86c3703f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).errors.txt @@ -0,0 +1,23 @@ +/index.ts(1,8): error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. +/index.ts(7,8): error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. + + +==== /node_modules/mdast-util-to-string/package.json (0 errors) ==== + { "type": "module" } + +==== /node_modules/mdast-util-to-string/index.d.ts (0 errors) ==== + export function toString(): string; + +==== /index.ts (2 errors) ==== + import mdast, { toString } from 'mdast-util-to-string'; + ~~~~~ +!!! error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. + mdast; + mdast.toString(); + + const mdast2 = await import('mdast-util-to-string'); + mdast2.toString(); + mdast2.default; + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).errors.txt.diff deleted file mode 100644 index 1650740cde..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.esmNoSynthesizedDefault(module=preserve).errors.txt -+++ new.esmNoSynthesizedDefault(module=preserve).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(1,8): error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. --/index.ts(7,8): error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. -- -- --==== /node_modules/mdast-util-to-string/package.json (0 errors) ==== -- { "type": "module" } -- --==== /node_modules/mdast-util-to-string/index.d.ts (0 errors) ==== -- export function toString(): string; -- --==== /index.ts (2 errors) ==== -- import mdast, { toString } from 'mdast-util-to-string'; -- ~~~~~ --!!! error TS1192: Module '"/node_modules/mdast-util-to-string/index"' has no default export. -- mdast; -- mdast.toString(); -- -- const mdast2 = await import('mdast-util-to-string'); -- mdast2.toString(); -- mdast2.default; -- ~~~~~~~ --!!! error TS2339: Property 'default' does not exist on type 'typeof import("/node_modules/mdast-util-to-string/index")'. -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols index 7a96977509..240b767551 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols @@ -13,9 +13,7 @@ mdast; >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) mdast.toString(); ->mdast.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) ->toString : Symbol(toString, Decl(index.d.ts, 0, 0)) const mdast2 = await import('mdast-util-to-string'); >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) @@ -26,7 +24,5 @@ mdast2.toString(); >toString : Symbol(toString, Decl(index.d.ts, 0, 0)) mdast2.default; ->mdast2.default : Symbol(default) >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) ->default : Symbol(default) diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols.diff b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols.diff index 4d322aba4f..09ce34668c 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).symbols.diff @@ -1,23 +1,10 @@ --- old.esmNoSynthesizedDefault(module=preserve).symbols +++ new.esmNoSynthesizedDefault(module=preserve).symbols -@@= skipped -12, +12 lines =@@ - >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) - - mdast.toString(); -+>mdast.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) - >mdast : Symbol(mdast, Decl(index.ts, 0, 6)) -+>toString : Symbol(toString, Decl(index.d.ts, 0, 0)) +@@= skipped -16, +16 lines =@@ const mdast2 = await import('mdast-util-to-string'); >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) ->'mdast-util-to-string' : Symbol("/node_modules/mdast-util-to-string/index", Decl(index.d.ts, 0, 0)) mdast2.toString(); - >mdast2.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) -@@= skipped -12, +13 lines =@@ - >toString : Symbol(toString, Decl(index.d.ts, 0, 0)) - - mdast2.default; -+>mdast2.default : Symbol(default) - >mdast2 : Symbol(mdast2, Decl(index.ts, 4, 5)) -+>default : Symbol(default) + >mdast2.toString : Symbol(toString, Decl(index.d.ts, 0, 0)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types index 4641b4346d..c25d7ac873 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types @@ -6,32 +6,32 @@ export function toString(): string; === /index.ts === import mdast, { toString } from 'mdast-util-to-string'; ->mdast : typeof mdast +>mdast : any >toString : () => string mdast; ->mdast : typeof mdast +>mdast : any mdast.toString(); ->mdast.toString() : string ->mdast.toString : () => string ->mdast : typeof mdast ->toString : () => string +>mdast.toString() : any +>mdast.toString : any +>mdast : any +>toString : any const mdast2 = await import('mdast-util-to-string'); ->mdast2 : { toString(): string; default: typeof mdast; } ->await import('mdast-util-to-string') : { toString(): string; default: typeof mdast; } ->import('mdast-util-to-string') : Promise<{ toString(): string; default: typeof mdast; }> +>mdast2 : typeof import("mdast-util-to-string") +>await import('mdast-util-to-string') : typeof import("mdast-util-to-string") +>import('mdast-util-to-string') : Promise >'mdast-util-to-string' : "mdast-util-to-string" mdast2.toString(); >mdast2.toString() : string >mdast2.toString : () => string ->mdast2 : { toString(): string; default: typeof mdast; } +>mdast2 : typeof import("mdast-util-to-string") >toString : () => string mdast2.default; ->mdast2.default : typeof mdast ->mdast2 : { toString(): string; default: typeof mdast; } ->default : typeof mdast +>mdast2.default : any +>mdast2 : typeof import("mdast-util-to-string") +>default : any diff --git a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types.diff b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types.diff index 12d5dcc3ea..6e8c2b6421 100644 --- a/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types.diff +++ b/testdata/baselines/reference/submodule/compiler/esmNoSynthesizedDefault(module=preserve).types.diff @@ -1,47 +1,26 @@ --- old.esmNoSynthesizedDefault(module=preserve).types +++ new.esmNoSynthesizedDefault(module=preserve).types -@@= skipped -5, +5 lines =@@ - - === /index.ts === - import mdast, { toString } from 'mdast-util-to-string'; -->mdast : any -+>mdast : typeof mdast - >toString : () => string - - mdast; -->mdast : any -+>mdast : typeof mdast - - mdast.toString(); -->mdast.toString() : any -->mdast.toString : any -->mdast : any -->toString : any -+>mdast.toString() : string -+>mdast.toString : () => string -+>mdast : typeof mdast -+>toString : () => string +@@= skipped -18, +18 lines =@@ + >toString : any const mdast2 = await import('mdast-util-to-string'); ->mdast2 : typeof import("/node_modules/mdast-util-to-string/index") ->await import('mdast-util-to-string') : typeof import("/node_modules/mdast-util-to-string/index") ->import('mdast-util-to-string') : Promise -+>mdast2 : { toString(): string; default: typeof mdast; } -+>await import('mdast-util-to-string') : { toString(): string; default: typeof mdast; } -+>import('mdast-util-to-string') : Promise<{ toString(): string; default: typeof mdast; }> ++>mdast2 : typeof import("mdast-util-to-string") ++>await import('mdast-util-to-string') : typeof import("mdast-util-to-string") ++>import('mdast-util-to-string') : Promise >'mdast-util-to-string' : "mdast-util-to-string" mdast2.toString(); >mdast2.toString() : string >mdast2.toString : () => string ->mdast2 : typeof import("/node_modules/mdast-util-to-string/index") -+>mdast2 : { toString(): string; default: typeof mdast; } ++>mdast2 : typeof import("mdast-util-to-string") >toString : () => string mdast2.default; -->mdast2.default : any + >mdast2.default : any ->mdast2 : typeof import("/node_modules/mdast-util-to-string/index") -->default : any -+>mdast2.default : typeof mdast -+>mdast2 : { toString(): string; default: typeof mdast; } -+>default : typeof mdast ++>mdast2 : typeof import("mdast-util-to-string") + >default : any diff --git a/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt b/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt index 62893eb4df..a6d09b01e8 100644 --- a/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt @@ -1,26 +1,26 @@ mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. -mod.mts(1,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +mod.mts(1,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(1,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(3,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +mod.mts(3,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(3,52): error TS2837: Import assertion values must be string literal expressions. mod.mts(5,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'RegExp' is not assignable to type 'string'. -mod.mts(5,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +mod.mts(5,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(5,52): error TS2837: Import assertion values must be string literal expressions. mod.mts(7,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'string[]' is not assignable to type 'string'. -mod.mts(7,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +mod.mts(7,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(7,52): error TS2837: Import assertion values must be string literal expressions. mod.mts(9,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type '{ a: number; }' is not assignable to type 'string'. -mod.mts(9,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +mod.mts(9,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(9,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(11,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +mod.mts(11,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(11,66): error TS2837: Import assertion values must be string literal expressions. @@ -31,13 +31,13 @@ mod.mts(11,66): error TS2837: Import assertion values must be string literal exp !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. ~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing2 from "./mod.mjs" assert {field: `a`}; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~ !!! error TS2837: Import assertion values must be string literal expressions. @@ -47,7 +47,7 @@ mod.mts(11,66): error TS2837: Import assertion values must be string literal exp !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~ !!! error TS2837: Import assertion values must be string literal expressions. @@ -57,7 +57,7 @@ mod.mts(11,66): error TS2837: Import assertion values must be string literal exp !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'string[]' is not assignable to type 'string'. ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. @@ -67,12 +67,12 @@ mod.mts(11,66): error TS2837: Import assertion values must be string literal exp !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt.diff index 2ae051071a..2538df3751 100644 --- a/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/importAssertionNonstring.errors.txt.diff @@ -5,33 +5,31 @@ mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. -+mod.mts(1,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++mod.mts(1,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(1,52): error TS2837: Import assertion values must be string literal expressions. --mod.mts(3,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+mod.mts(3,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + mod.mts(3,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(3,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(5,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(5,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'RegExp' is not assignable to type 'string'. -+mod.mts(5,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++mod.mts(5,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(5,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(7,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(7,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'string[]' is not assignable to type 'string'. -+mod.mts(7,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++mod.mts(7,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(7,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(9,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(9,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type '{ a: number; }' is not assignable to type 'string'. -+mod.mts(9,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++mod.mts(9,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(9,52): error TS2837: Import assertion values must be string literal expressions. --mod.mts(11,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+mod.mts(11,37): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + mod.mts(11,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(11,66): error TS2837: Import assertion values must be string literal expressions. - +@@= skipped -25, +25 lines =@@ ==== mod.mts (16 errors) ==== import * as thing1 from "./mod.mjs" assert {field: 0}; @@ -42,15 +40,14 @@ !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing2 from "./mod.mjs" assert {field: `a`}; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~ !!! error TS2837: Import assertion values must be string literal expressions. @@ -62,7 +59,7 @@ !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~ !!! error TS2837: Import assertion values must be string literal expressions. @@ -74,7 +71,7 @@ !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'string[]' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. @@ -86,14 +83,13 @@ !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. + ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt index d040bc7cd3..2fd1d68ba8 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt @@ -1,9 +1,15 @@ -b.mts(23,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(24,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(25,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(26,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(27,14): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => void'. +b.mts(15,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(16,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(17,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(18,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(19,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(20,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. ==== mod.cts (0 errors) ==== @@ -25,28 +31,34 @@ b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => voi // should all fail a(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. b(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. c(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. d(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. self.default(); + ~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. self.def(); + ~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. // should all work a.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. b.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. c.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. d.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. self.default.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.def.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. \ No newline at end of file + self.def.default(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt.diff deleted file mode 100644 index 46b24c0d97..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).errors.txt.diff +++ /dev/null @@ -1,71 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node16).errors.txt -+++ new.moduleNodeDefaultImports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ --b.mts(15,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(16,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(17,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(18,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(19,6): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(20,6): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. -+b.mts(23,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(24,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(25,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(26,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(27,14): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => void'. - - - ==== mod.cts (0 errors) ==== -@@= skipped -30, +24 lines =@@ - - // should all fail - a(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - b(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - c(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - d(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - self.default(); -- ~~~~~~~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - self.def(); -- ~~~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - - // should all work - a.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - b.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - c.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - d.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.default.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.def.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols index b5c58e6cf1..a780c883cb 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols @@ -12,12 +12,12 @@ import a from "./mod.cjs"; >a : Symbol(a, Decl(b.mts, 0, 6)) import { default as b } from "./mod.cjs"; ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >b : Symbol(b, Decl(b.mts, 1, 8)) import c, { default as d } from "./mod.cjs"; >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >d : Symbol(d, Decl(b.mts, 2, 11)) import * as self from "./b.mjs"; @@ -27,7 +27,7 @@ export { default } from "./mod.cjs"; >default : Symbol(default, Decl(b.mts, 4, 8)) export { default as def } from "./mod.cjs"; ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >def : Symbol(def, Decl(b.mts, 5, 8)) a === b; @@ -81,24 +81,36 @@ self.def(); // should all work a.default(); +>a.default : Symbol(fun, Decl(mod.cts, 0, 29)) >a : Symbol(a, Decl(b.mts, 0, 6)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) b.default(); +>b.default : Symbol(fun, Decl(mod.cts, 0, 29)) >b : Symbol(b, Decl(b.mts, 1, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) c.default(); +>c.default : Symbol(fun, Decl(mod.cts, 0, 29)) >c : Symbol(c, Decl(b.mts, 2, 6)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) d.default(); +>d.default : Symbol(fun, Decl(mod.cts, 0, 29)) >d : Symbol(d, Decl(b.mts, 2, 11)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.default.default(); +>self.default.default : Symbol(fun, Decl(mod.cts, 0, 29)) >self.default : Symbol(default, Decl(b.mts, 4, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) >default : Symbol(default, Decl(b.mts, 4, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.def.default(); +>self.def.default : Symbol(fun, Decl(mod.cts, 0, 29)) >self.def : Symbol(def, Decl(b.mts, 5, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) >def : Symbol(def, Decl(b.mts, 5, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols.diff index 0c5c0f6b4e..7d08907a66 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).symbols.diff @@ -5,13 +5,13 @@ import { default as b } from "./mod.cjs"; ->default : Symbol(a, Decl(mod.cts, 0, 0)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) >b : Symbol(b, Decl(b.mts, 1, 8)) import c, { default as d } from "./mod.cjs"; >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(a, Decl(mod.cts, 0, 0)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) >d : Symbol(d, Decl(b.mts, 2, 11)) import * as self from "./b.mjs"; @@ -24,7 +24,7 @@ export { default as def } from "./mod.cjs"; ->default : Symbol(a, Decl(mod.cts, 0, 0)) ->def : Symbol(self.def, Decl(b.mts, 5, 8)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) +>def : Symbol(def, Decl(b.mts, 5, 8)) a === b; @@ -75,38 +75,50 @@ // should all work a.default(); ->a.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>a.default : Symbol(fun, Decl(mod.cts, 0, 29)) >a : Symbol(a, Decl(b.mts, 0, 6)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) b.default(); ->b.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>b.default : Symbol(fun, Decl(mod.cts, 0, 29)) >b : Symbol(b, Decl(b.mts, 1, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) c.default(); ->c.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>c.default : Symbol(fun, Decl(mod.cts, 0, 29)) >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) d.default(); ->d.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>d.default : Symbol(fun, Decl(mod.cts, 0, 29)) >d : Symbol(d, Decl(b.mts, 2, 11)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.default.default(); ->self.default.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ->self.default : Symbol(self.default, Decl(b.mts, 4, 8)) ++>self.default.default : Symbol(fun, Decl(mod.cts, 0, 29)) +>self.default : Symbol(default, Decl(b.mts, 4, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) ->default : Symbol(self.default, Decl(b.mts, 4, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>default : Symbol(default, Decl(b.mts, 4, 8)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.def.default(); ->self.def.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ->self.def : Symbol(self.def, Decl(b.mts, 5, 8)) ++>self.def.default : Symbol(fun, Decl(mod.cts, 0, 29)) +>self.def : Symbol(def, Decl(b.mts, 5, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) ->def : Symbol(self.def, Decl(b.mts, 5, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>def : Symbol(def, Decl(b.mts, 5, 8)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types index 14e752cd25..931ad6da2e 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types @@ -9,125 +9,125 @@ export default fun; === b.mts === import a from "./mod.cjs"; ->a : () => void +>a : typeof a import { default as b } from "./mod.cjs"; ->default : () => void ->b : () => void +>default : typeof a +>b : typeof a import c, { default as d } from "./mod.cjs"; ->c : () => void ->default : () => void ->d : () => void +>c : typeof a +>default : typeof a +>d : typeof a import * as self from "./b.mjs"; >self : typeof self export { default } from "./mod.cjs"; ->default : () => void +>default : typeof a export { default as def } from "./mod.cjs"; ->default : () => void ->def : () => void +>default : typeof a +>def : typeof a a === b; >a === b : boolean ->a : () => void ->b : () => void +>a : typeof a +>b : typeof a b === c; >b === c : boolean ->b : () => void ->c : () => void +>b : typeof a +>c : typeof a c === d; >c === d : boolean ->c : () => void ->d : () => void +>c : typeof a +>d : typeof a d === self.default; >d === self.default : boolean ->d : () => void ->self.default : () => void +>d : typeof a +>self.default : typeof a >self : typeof self ->default : () => void +>default : typeof a self.default === self.def; >self.default === self.def : boolean ->self.default : () => void +>self.default : typeof a >self : typeof self ->default : () => void ->self.def : () => void +>default : typeof a +>self.def : typeof a >self : typeof self ->def : () => void +>def : typeof a // should all fail a(); ->a() : void ->a : () => void +>a() : any +>a : typeof a b(); ->b() : void ->b : () => void +>b() : any +>b : typeof a c(); ->c() : void ->c : () => void +>c() : any +>c : typeof a d(); ->d() : void ->d : () => void +>d() : any +>d : typeof a self.default(); ->self.default() : void ->self.default : () => void +>self.default() : any +>self.default : typeof a >self : typeof self ->default : () => void +>default : typeof a self.def(); ->self.def() : void ->self.def : () => void +>self.def() : any +>self.def : typeof a >self : typeof self ->def : () => void +>def : typeof a // should all work a.default(); ->a.default() : any ->a.default : any ->a : () => void ->default : any +>a.default() : void +>a.default : () => void +>a : typeof a +>default : () => void b.default(); ->b.default() : any ->b.default : any ->b : () => void ->default : any +>b.default() : void +>b.default : () => void +>b : typeof a +>default : () => void c.default(); ->c.default() : any ->c.default : any ->c : () => void ->default : any +>c.default() : void +>c.default : () => void +>c : typeof a +>default : () => void d.default(); ->d.default() : any ->d.default : any ->d : () => void ->default : any +>d.default() : void +>d.default : () => void +>d : typeof a +>default : () => void self.default.default(); ->self.default.default() : any ->self.default.default : any ->self.default : () => void +>self.default.default() : void +>self.default.default : () => void +>self.default : typeof a >self : typeof self +>default : typeof a >default : () => void ->default : any self.def.default(); ->self.def.default() : any ->self.def.default : any ->self.def : () => void +>self.def.default() : void +>self.def.default : () => void +>self.def : typeof a >self : typeof self ->def : () => void ->default : any +>def : typeof a +>default : () => void diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types.diff deleted file mode 100644 index cc4c6b4de9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node16).types.diff +++ /dev/null @@ -1,190 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node16).types -+++ new.moduleNodeDefaultImports(module=node16).types -@@= skipped -8, +8 lines =@@ - - === b.mts === - import a from "./mod.cjs"; -->a : typeof a -+>a : () => void - - import { default as b } from "./mod.cjs"; -->default : typeof a -->b : typeof a -+>default : () => void -+>b : () => void - - import c, { default as d } from "./mod.cjs"; -->c : typeof a -->default : typeof a -->d : typeof a -+>c : () => void -+>default : () => void -+>d : () => void - - import * as self from "./b.mjs"; - >self : typeof self - - export { default } from "./mod.cjs"; -->default : typeof a -+>default : () => void - - export { default as def } from "./mod.cjs"; -->default : typeof a -->def : typeof a -+>default : () => void -+>def : () => void - - a === b; - >a === b : boolean -->a : typeof a -->b : typeof a -+>a : () => void -+>b : () => void - - b === c; - >b === c : boolean -->b : typeof a -->c : typeof a -+>b : () => void -+>c : () => void - - c === d; - >c === d : boolean -->c : typeof a -->d : typeof a -+>c : () => void -+>d : () => void - - d === self.default; - >d === self.default : boolean -->d : typeof a -->self.default : typeof a -+>d : () => void -+>self.default : () => void - >self : typeof self -->default : typeof a -+>default : () => void - - self.default === self.def; - >self.default === self.def : boolean -->self.default : typeof a -->self : typeof self -->default : typeof a -->self.def : typeof a -->self : typeof self -->def : typeof a -+>self.default : () => void -+>self : typeof self -+>default : () => void -+>self.def : () => void -+>self : typeof self -+>def : () => void - - // should all fail - a(); -->a() : any -->a : typeof a -+>a() : void -+>a : () => void - - b(); -->b() : any -->b : typeof a -+>b() : void -+>b : () => void - - c(); -->c() : any -->c : typeof a -+>c() : void -+>c : () => void - - d(); -->d() : any -->d : typeof a -+>d() : void -+>d : () => void - - self.default(); -->self.default() : any -->self.default : typeof a -+>self.default() : void -+>self.default : () => void - >self : typeof self -->default : typeof a -+>default : () => void - - self.def(); -->self.def() : any -->self.def : typeof a -+>self.def() : void -+>self.def : () => void - >self : typeof self -->def : typeof a -+>def : () => void - - // should all work - a.default(); -->a.default() : void -->a.default : () => void -->a : typeof a -->default : () => void -+>a.default() : any -+>a.default : any -+>a : () => void -+>default : any - - b.default(); -->b.default() : void -->b.default : () => void -->b : typeof a -->default : () => void -+>b.default() : any -+>b.default : any -+>b : () => void -+>default : any - - c.default(); -->c.default() : void -->c.default : () => void -->c : typeof a -->default : () => void -+>c.default() : any -+>c.default : any -+>c : () => void -+>default : any - - d.default(); -->d.default() : void -->d.default : () => void -->d : typeof a -->default : () => void -+>d.default() : any -+>d.default : any -+>d : () => void -+>default : any - - self.default.default(); -->self.default.default() : void -->self.default.default : () => void -->self.default : typeof a -+>self.default.default() : any -+>self.default.default : any -+>self.default : () => void - >self : typeof self -->default : typeof a - >default : () => void -+>default : any - - self.def.default(); -->self.def.default() : void -->self.def.default : () => void -->self.def : typeof a -+>self.def.default() : any -+>self.def.default : any -+>self.def : () => void - >self : typeof self -->def : typeof a -->default : () => void -+>def : () => void -+>default : any diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt index d040bc7cd3..2fd1d68ba8 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt @@ -1,9 +1,15 @@ -b.mts(23,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(24,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(25,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(26,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(27,14): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => void'. +b.mts(15,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(16,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(17,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(18,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(19,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(20,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. ==== mod.cts (0 errors) ==== @@ -25,28 +31,34 @@ b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => voi // should all fail a(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. b(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. c(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. d(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. self.default(); + ~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. self.def(); + ~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. // should all work a.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. b.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. c.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. d.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. self.default.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.def.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. \ No newline at end of file + self.def.default(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt.diff deleted file mode 100644 index 8e041c2df4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).errors.txt.diff +++ /dev/null @@ -1,71 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node18).errors.txt -+++ new.moduleNodeDefaultImports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --b.mts(15,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(16,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(17,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(18,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(19,6): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(20,6): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. -+b.mts(23,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(24,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(25,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(26,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(27,14): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => void'. - - - ==== mod.cts (0 errors) ==== -@@= skipped -30, +24 lines =@@ - - // should all fail - a(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - b(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - c(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - d(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - self.default(); -- ~~~~~~~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - self.def(); -- ~~~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - - // should all work - a.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - b.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - c.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - d.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.default.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.def.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols index b5c58e6cf1..a780c883cb 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols @@ -12,12 +12,12 @@ import a from "./mod.cjs"; >a : Symbol(a, Decl(b.mts, 0, 6)) import { default as b } from "./mod.cjs"; ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >b : Symbol(b, Decl(b.mts, 1, 8)) import c, { default as d } from "./mod.cjs"; >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >d : Symbol(d, Decl(b.mts, 2, 11)) import * as self from "./b.mjs"; @@ -27,7 +27,7 @@ export { default } from "./mod.cjs"; >default : Symbol(default, Decl(b.mts, 4, 8)) export { default as def } from "./mod.cjs"; ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >def : Symbol(def, Decl(b.mts, 5, 8)) a === b; @@ -81,24 +81,36 @@ self.def(); // should all work a.default(); +>a.default : Symbol(fun, Decl(mod.cts, 0, 29)) >a : Symbol(a, Decl(b.mts, 0, 6)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) b.default(); +>b.default : Symbol(fun, Decl(mod.cts, 0, 29)) >b : Symbol(b, Decl(b.mts, 1, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) c.default(); +>c.default : Symbol(fun, Decl(mod.cts, 0, 29)) >c : Symbol(c, Decl(b.mts, 2, 6)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) d.default(); +>d.default : Symbol(fun, Decl(mod.cts, 0, 29)) >d : Symbol(d, Decl(b.mts, 2, 11)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.default.default(); +>self.default.default : Symbol(fun, Decl(mod.cts, 0, 29)) >self.default : Symbol(default, Decl(b.mts, 4, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) >default : Symbol(default, Decl(b.mts, 4, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.def.default(); +>self.def.default : Symbol(fun, Decl(mod.cts, 0, 29)) >self.def : Symbol(def, Decl(b.mts, 5, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) >def : Symbol(def, Decl(b.mts, 5, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols.diff index 9c1a7603ff..8f0350bd6a 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).symbols.diff @@ -5,13 +5,13 @@ import { default as b } from "./mod.cjs"; ->default : Symbol(a, Decl(mod.cts, 0, 0)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) >b : Symbol(b, Decl(b.mts, 1, 8)) import c, { default as d } from "./mod.cjs"; >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(a, Decl(mod.cts, 0, 0)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) >d : Symbol(d, Decl(b.mts, 2, 11)) import * as self from "./b.mjs"; @@ -24,7 +24,7 @@ export { default as def } from "./mod.cjs"; ->default : Symbol(a, Decl(mod.cts, 0, 0)) ->def : Symbol(self.def, Decl(b.mts, 5, 8)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) +>def : Symbol(def, Decl(b.mts, 5, 8)) a === b; @@ -75,38 +75,50 @@ // should all work a.default(); ->a.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>a.default : Symbol(fun, Decl(mod.cts, 0, 29)) >a : Symbol(a, Decl(b.mts, 0, 6)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) b.default(); ->b.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>b.default : Symbol(fun, Decl(mod.cts, 0, 29)) >b : Symbol(b, Decl(b.mts, 1, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) c.default(); ->c.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>c.default : Symbol(fun, Decl(mod.cts, 0, 29)) >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) d.default(); ->d.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>d.default : Symbol(fun, Decl(mod.cts, 0, 29)) >d : Symbol(d, Decl(b.mts, 2, 11)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.default.default(); ->self.default.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ->self.default : Symbol(self.default, Decl(b.mts, 4, 8)) ++>self.default.default : Symbol(fun, Decl(mod.cts, 0, 29)) +>self.default : Symbol(default, Decl(b.mts, 4, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) ->default : Symbol(self.default, Decl(b.mts, 4, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>default : Symbol(default, Decl(b.mts, 4, 8)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.def.default(); ->self.def.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ->self.def : Symbol(self.def, Decl(b.mts, 5, 8)) ++>self.def.default : Symbol(fun, Decl(mod.cts, 0, 29)) +>self.def : Symbol(def, Decl(b.mts, 5, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) ->def : Symbol(self.def, Decl(b.mts, 5, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>def : Symbol(def, Decl(b.mts, 5, 8)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types index 14e752cd25..931ad6da2e 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types @@ -9,125 +9,125 @@ export default fun; === b.mts === import a from "./mod.cjs"; ->a : () => void +>a : typeof a import { default as b } from "./mod.cjs"; ->default : () => void ->b : () => void +>default : typeof a +>b : typeof a import c, { default as d } from "./mod.cjs"; ->c : () => void ->default : () => void ->d : () => void +>c : typeof a +>default : typeof a +>d : typeof a import * as self from "./b.mjs"; >self : typeof self export { default } from "./mod.cjs"; ->default : () => void +>default : typeof a export { default as def } from "./mod.cjs"; ->default : () => void ->def : () => void +>default : typeof a +>def : typeof a a === b; >a === b : boolean ->a : () => void ->b : () => void +>a : typeof a +>b : typeof a b === c; >b === c : boolean ->b : () => void ->c : () => void +>b : typeof a +>c : typeof a c === d; >c === d : boolean ->c : () => void ->d : () => void +>c : typeof a +>d : typeof a d === self.default; >d === self.default : boolean ->d : () => void ->self.default : () => void +>d : typeof a +>self.default : typeof a >self : typeof self ->default : () => void +>default : typeof a self.default === self.def; >self.default === self.def : boolean ->self.default : () => void +>self.default : typeof a >self : typeof self ->default : () => void ->self.def : () => void +>default : typeof a +>self.def : typeof a >self : typeof self ->def : () => void +>def : typeof a // should all fail a(); ->a() : void ->a : () => void +>a() : any +>a : typeof a b(); ->b() : void ->b : () => void +>b() : any +>b : typeof a c(); ->c() : void ->c : () => void +>c() : any +>c : typeof a d(); ->d() : void ->d : () => void +>d() : any +>d : typeof a self.default(); ->self.default() : void ->self.default : () => void +>self.default() : any +>self.default : typeof a >self : typeof self ->default : () => void +>default : typeof a self.def(); ->self.def() : void ->self.def : () => void +>self.def() : any +>self.def : typeof a >self : typeof self ->def : () => void +>def : typeof a // should all work a.default(); ->a.default() : any ->a.default : any ->a : () => void ->default : any +>a.default() : void +>a.default : () => void +>a : typeof a +>default : () => void b.default(); ->b.default() : any ->b.default : any ->b : () => void ->default : any +>b.default() : void +>b.default : () => void +>b : typeof a +>default : () => void c.default(); ->c.default() : any ->c.default : any ->c : () => void ->default : any +>c.default() : void +>c.default : () => void +>c : typeof a +>default : () => void d.default(); ->d.default() : any ->d.default : any ->d : () => void ->default : any +>d.default() : void +>d.default : () => void +>d : typeof a +>default : () => void self.default.default(); ->self.default.default() : any ->self.default.default : any ->self.default : () => void +>self.default.default() : void +>self.default.default : () => void +>self.default : typeof a >self : typeof self +>default : typeof a >default : () => void ->default : any self.def.default(); ->self.def.default() : any ->self.def.default : any ->self.def : () => void +>self.def.default() : void +>self.def.default : () => void +>self.def : typeof a >self : typeof self ->def : () => void ->default : any +>def : typeof a +>default : () => void diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types.diff deleted file mode 100644 index 5aec136f3a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node18).types.diff +++ /dev/null @@ -1,190 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node18).types -+++ new.moduleNodeDefaultImports(module=node18).types -@@= skipped -8, +8 lines =@@ - - === b.mts === - import a from "./mod.cjs"; -->a : typeof a -+>a : () => void - - import { default as b } from "./mod.cjs"; -->default : typeof a -->b : typeof a -+>default : () => void -+>b : () => void - - import c, { default as d } from "./mod.cjs"; -->c : typeof a -->default : typeof a -->d : typeof a -+>c : () => void -+>default : () => void -+>d : () => void - - import * as self from "./b.mjs"; - >self : typeof self - - export { default } from "./mod.cjs"; -->default : typeof a -+>default : () => void - - export { default as def } from "./mod.cjs"; -->default : typeof a -->def : typeof a -+>default : () => void -+>def : () => void - - a === b; - >a === b : boolean -->a : typeof a -->b : typeof a -+>a : () => void -+>b : () => void - - b === c; - >b === c : boolean -->b : typeof a -->c : typeof a -+>b : () => void -+>c : () => void - - c === d; - >c === d : boolean -->c : typeof a -->d : typeof a -+>c : () => void -+>d : () => void - - d === self.default; - >d === self.default : boolean -->d : typeof a -->self.default : typeof a -+>d : () => void -+>self.default : () => void - >self : typeof self -->default : typeof a -+>default : () => void - - self.default === self.def; - >self.default === self.def : boolean -->self.default : typeof a -->self : typeof self -->default : typeof a -->self.def : typeof a -->self : typeof self -->def : typeof a -+>self.default : () => void -+>self : typeof self -+>default : () => void -+>self.def : () => void -+>self : typeof self -+>def : () => void - - // should all fail - a(); -->a() : any -->a : typeof a -+>a() : void -+>a : () => void - - b(); -->b() : any -->b : typeof a -+>b() : void -+>b : () => void - - c(); -->c() : any -->c : typeof a -+>c() : void -+>c : () => void - - d(); -->d() : any -->d : typeof a -+>d() : void -+>d : () => void - - self.default(); -->self.default() : any -->self.default : typeof a -+>self.default() : void -+>self.default : () => void - >self : typeof self -->default : typeof a -+>default : () => void - - self.def(); -->self.def() : any -->self.def : typeof a -+>self.def() : void -+>self.def : () => void - >self : typeof self -->def : typeof a -+>def : () => void - - // should all work - a.default(); -->a.default() : void -->a.default : () => void -->a : typeof a -->default : () => void -+>a.default() : any -+>a.default : any -+>a : () => void -+>default : any - - b.default(); -->b.default() : void -->b.default : () => void -->b : typeof a -->default : () => void -+>b.default() : any -+>b.default : any -+>b : () => void -+>default : any - - c.default(); -->c.default() : void -->c.default : () => void -->c : typeof a -->default : () => void -+>c.default() : any -+>c.default : any -+>c : () => void -+>default : any - - d.default(); -->d.default() : void -->d.default : () => void -->d : typeof a -->default : () => void -+>d.default() : any -+>d.default : any -+>d : () => void -+>default : any - - self.default.default(); -->self.default.default() : void -->self.default.default : () => void -->self.default : typeof a -+>self.default.default() : any -+>self.default.default : any -+>self.default : () => void - >self : typeof self -->default : typeof a - >default : () => void -+>default : any - - self.def.default(); -->self.def.default() : void -->self.def.default : () => void -->self.def : typeof a -+>self.def.default() : any -+>self.def.default : any -+>self.def : () => void - >self : typeof self -->def : typeof a -->default : () => void -+>def : () => void -+>default : any diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt index d040bc7cd3..2fd1d68ba8 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt @@ -1,9 +1,15 @@ -b.mts(23,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(24,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(25,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(26,3): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(27,14): error TS2339: Property 'default' does not exist on type '() => void'. -b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => void'. +b.mts(15,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(16,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(17,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(18,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(19,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(20,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. ==== mod.cts (0 errors) ==== @@ -25,28 +31,34 @@ b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => voi // should all fail a(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. b(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. c(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. d(); + ~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. self.default(); + ~~~~~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. self.def(); + ~~~ +!!! error TS2349: This expression is not callable. +!!! error TS2349: Type 'typeof import("mod")' has no call signatures. // should all work a.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. b.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. c.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. d.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. self.default.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.def.default(); - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. \ No newline at end of file + self.def.default(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt.diff deleted file mode 100644 index 324e01d92a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,71 +0,0 @@ ---- old.moduleNodeDefaultImports(module=nodenext).errors.txt -+++ new.moduleNodeDefaultImports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --b.mts(15,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(16,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(17,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(18,1): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(19,6): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. --b.mts(20,6): error TS2349: This expression is not callable. -- Type 'typeof import("mod")' has no call signatures. -+b.mts(23,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(24,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(25,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(26,3): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(27,14): error TS2339: Property 'default' does not exist on type '() => void'. -+b.mts(28,10): error TS2339: Property 'default' does not exist on type '() => void'. - - - ==== mod.cts (0 errors) ==== -@@= skipped -30, +24 lines =@@ - - // should all fail - a(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - b(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - c(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - d(); -- ~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - self.default(); -- ~~~~~~~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - self.def(); -- ~~~ --!!! error TS2349: This expression is not callable. --!!! error TS2349: Type 'typeof import("mod")' has no call signatures. - - // should all work - a.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - b.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - c.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - d.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.default.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. - self.def.default(); -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols index b5c58e6cf1..a780c883cb 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols @@ -12,12 +12,12 @@ import a from "./mod.cjs"; >a : Symbol(a, Decl(b.mts, 0, 6)) import { default as b } from "./mod.cjs"; ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >b : Symbol(b, Decl(b.mts, 1, 8)) import c, { default as d } from "./mod.cjs"; >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >d : Symbol(d, Decl(b.mts, 2, 11)) import * as self from "./b.mjs"; @@ -27,7 +27,7 @@ export { default } from "./mod.cjs"; >default : Symbol(default, Decl(b.mts, 4, 8)) export { default as def } from "./mod.cjs"; ->default : Symbol(fun, Decl(mod.cts, 0, 29)) +>default : Symbol("mod", Decl(mod.cts, 0, 0)) >def : Symbol(def, Decl(b.mts, 5, 8)) a === b; @@ -81,24 +81,36 @@ self.def(); // should all work a.default(); +>a.default : Symbol(fun, Decl(mod.cts, 0, 29)) >a : Symbol(a, Decl(b.mts, 0, 6)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) b.default(); +>b.default : Symbol(fun, Decl(mod.cts, 0, 29)) >b : Symbol(b, Decl(b.mts, 1, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) c.default(); +>c.default : Symbol(fun, Decl(mod.cts, 0, 29)) >c : Symbol(c, Decl(b.mts, 2, 6)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) d.default(); +>d.default : Symbol(fun, Decl(mod.cts, 0, 29)) >d : Symbol(d, Decl(b.mts, 2, 11)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.default.default(); +>self.default.default : Symbol(fun, Decl(mod.cts, 0, 29)) >self.default : Symbol(default, Decl(b.mts, 4, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) >default : Symbol(default, Decl(b.mts, 4, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.def.default(); +>self.def.default : Symbol(fun, Decl(mod.cts, 0, 29)) >self.def : Symbol(def, Decl(b.mts, 5, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) >def : Symbol(def, Decl(b.mts, 5, 8)) +>default : Symbol(fun, Decl(mod.cts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols.diff index 82d7272f94..b90058fec6 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).symbols.diff @@ -5,13 +5,13 @@ import { default as b } from "./mod.cjs"; ->default : Symbol(a, Decl(mod.cts, 0, 0)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) >b : Symbol(b, Decl(b.mts, 1, 8)) import c, { default as d } from "./mod.cjs"; >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(a, Decl(mod.cts, 0, 0)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) >d : Symbol(d, Decl(b.mts, 2, 11)) import * as self from "./b.mjs"; @@ -24,7 +24,7 @@ export { default as def } from "./mod.cjs"; ->default : Symbol(a, Decl(mod.cts, 0, 0)) ->def : Symbol(self.def, Decl(b.mts, 5, 8)) -+>default : Symbol(fun, Decl(mod.cts, 0, 29)) ++>default : Symbol("mod", Decl(mod.cts, 0, 0)) +>def : Symbol(def, Decl(b.mts, 5, 8)) a === b; @@ -75,38 +75,50 @@ // should all work a.default(); ->a.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>a.default : Symbol(fun, Decl(mod.cts, 0, 29)) >a : Symbol(a, Decl(b.mts, 0, 6)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) b.default(); ->b.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>b.default : Symbol(fun, Decl(mod.cts, 0, 29)) >b : Symbol(b, Decl(b.mts, 1, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) c.default(); ->c.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>c.default : Symbol(fun, Decl(mod.cts, 0, 29)) >c : Symbol(c, Decl(b.mts, 2, 6)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) d.default(); ->d.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>d.default : Symbol(fun, Decl(mod.cts, 0, 29)) >d : Symbol(d, Decl(b.mts, 2, 11)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.default.default(); ->self.default.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ->self.default : Symbol(self.default, Decl(b.mts, 4, 8)) ++>self.default.default : Symbol(fun, Decl(mod.cts, 0, 29)) +>self.default : Symbol(default, Decl(b.mts, 4, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) ->default : Symbol(self.default, Decl(b.mts, 4, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>default : Symbol(default, Decl(b.mts, 4, 8)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) self.def.default(); ->self.def.default : Symbol(a.default, Decl(mod.cts, 0, 29)) ->self.def : Symbol(self.def, Decl(b.mts, 5, 8)) ++>self.def.default : Symbol(fun, Decl(mod.cts, 0, 29)) +>self.def : Symbol(def, Decl(b.mts, 5, 8)) >self : Symbol(self, Decl(b.mts, 3, 6)) ->def : Symbol(self.def, Decl(b.mts, 5, 8)) ->default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>def : Symbol(def, Decl(b.mts, 5, 8)) ++>default : Symbol(fun, Decl(mod.cts, 0, 29)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types index 14e752cd25..931ad6da2e 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types @@ -9,125 +9,125 @@ export default fun; === b.mts === import a from "./mod.cjs"; ->a : () => void +>a : typeof a import { default as b } from "./mod.cjs"; ->default : () => void ->b : () => void +>default : typeof a +>b : typeof a import c, { default as d } from "./mod.cjs"; ->c : () => void ->default : () => void ->d : () => void +>c : typeof a +>default : typeof a +>d : typeof a import * as self from "./b.mjs"; >self : typeof self export { default } from "./mod.cjs"; ->default : () => void +>default : typeof a export { default as def } from "./mod.cjs"; ->default : () => void ->def : () => void +>default : typeof a +>def : typeof a a === b; >a === b : boolean ->a : () => void ->b : () => void +>a : typeof a +>b : typeof a b === c; >b === c : boolean ->b : () => void ->c : () => void +>b : typeof a +>c : typeof a c === d; >c === d : boolean ->c : () => void ->d : () => void +>c : typeof a +>d : typeof a d === self.default; >d === self.default : boolean ->d : () => void ->self.default : () => void +>d : typeof a +>self.default : typeof a >self : typeof self ->default : () => void +>default : typeof a self.default === self.def; >self.default === self.def : boolean ->self.default : () => void +>self.default : typeof a >self : typeof self ->default : () => void ->self.def : () => void +>default : typeof a +>self.def : typeof a >self : typeof self ->def : () => void +>def : typeof a // should all fail a(); ->a() : void ->a : () => void +>a() : any +>a : typeof a b(); ->b() : void ->b : () => void +>b() : any +>b : typeof a c(); ->c() : void ->c : () => void +>c() : any +>c : typeof a d(); ->d() : void ->d : () => void +>d() : any +>d : typeof a self.default(); ->self.default() : void ->self.default : () => void +>self.default() : any +>self.default : typeof a >self : typeof self ->default : () => void +>default : typeof a self.def(); ->self.def() : void ->self.def : () => void +>self.def() : any +>self.def : typeof a >self : typeof self ->def : () => void +>def : typeof a // should all work a.default(); ->a.default() : any ->a.default : any ->a : () => void ->default : any +>a.default() : void +>a.default : () => void +>a : typeof a +>default : () => void b.default(); ->b.default() : any ->b.default : any ->b : () => void ->default : any +>b.default() : void +>b.default : () => void +>b : typeof a +>default : () => void c.default(); ->c.default() : any ->c.default : any ->c : () => void ->default : any +>c.default() : void +>c.default : () => void +>c : typeof a +>default : () => void d.default(); ->d.default() : any ->d.default : any ->d : () => void ->default : any +>d.default() : void +>d.default : () => void +>d : typeof a +>default : () => void self.default.default(); ->self.default.default() : any ->self.default.default : any ->self.default : () => void +>self.default.default() : void +>self.default.default : () => void +>self.default : typeof a >self : typeof self +>default : typeof a >default : () => void ->default : any self.def.default(); ->self.def.default() : any ->self.def.default : any ->self.def : () => void +>self.def.default() : void +>self.def.default : () => void +>self.def : typeof a >self : typeof self ->def : () => void ->default : any +>def : typeof a +>default : () => void diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types.diff deleted file mode 100644 index 4e4e3e892e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=nodenext).types.diff +++ /dev/null @@ -1,190 +0,0 @@ ---- old.moduleNodeDefaultImports(module=nodenext).types -+++ new.moduleNodeDefaultImports(module=nodenext).types -@@= skipped -8, +8 lines =@@ - - === b.mts === - import a from "./mod.cjs"; -->a : typeof a -+>a : () => void - - import { default as b } from "./mod.cjs"; -->default : typeof a -->b : typeof a -+>default : () => void -+>b : () => void - - import c, { default as d } from "./mod.cjs"; -->c : typeof a -->default : typeof a -->d : typeof a -+>c : () => void -+>default : () => void -+>d : () => void - - import * as self from "./b.mjs"; - >self : typeof self - - export { default } from "./mod.cjs"; -->default : typeof a -+>default : () => void - - export { default as def } from "./mod.cjs"; -->default : typeof a -->def : typeof a -+>default : () => void -+>def : () => void - - a === b; - >a === b : boolean -->a : typeof a -->b : typeof a -+>a : () => void -+>b : () => void - - b === c; - >b === c : boolean -->b : typeof a -->c : typeof a -+>b : () => void -+>c : () => void - - c === d; - >c === d : boolean -->c : typeof a -->d : typeof a -+>c : () => void -+>d : () => void - - d === self.default; - >d === self.default : boolean -->d : typeof a -->self.default : typeof a -+>d : () => void -+>self.default : () => void - >self : typeof self -->default : typeof a -+>default : () => void - - self.default === self.def; - >self.default === self.def : boolean -->self.default : typeof a -->self : typeof self -->default : typeof a -->self.def : typeof a -->self : typeof self -->def : typeof a -+>self.default : () => void -+>self : typeof self -+>default : () => void -+>self.def : () => void -+>self : typeof self -+>def : () => void - - // should all fail - a(); -->a() : any -->a : typeof a -+>a() : void -+>a : () => void - - b(); -->b() : any -->b : typeof a -+>b() : void -+>b : () => void - - c(); -->c() : any -->c : typeof a -+>c() : void -+>c : () => void - - d(); -->d() : any -->d : typeof a -+>d() : void -+>d : () => void - - self.default(); -->self.default() : any -->self.default : typeof a -+>self.default() : void -+>self.default : () => void - >self : typeof self -->default : typeof a -+>default : () => void - - self.def(); -->self.def() : any -->self.def : typeof a -+>self.def() : void -+>self.def : () => void - >self : typeof self -->def : typeof a -+>def : () => void - - // should all work - a.default(); -->a.default() : void -->a.default : () => void -->a : typeof a -->default : () => void -+>a.default() : any -+>a.default : any -+>a : () => void -+>default : any - - b.default(); -->b.default() : void -->b.default : () => void -->b : typeof a -->default : () => void -+>b.default() : any -+>b.default : any -+>b : () => void -+>default : any - - c.default(); -->c.default() : void -->c.default : () => void -->c : typeof a -->default : () => void -+>c.default() : any -+>c.default : any -+>c : () => void -+>default : any - - d.default(); -->d.default() : void -->d.default : () => void -->d : typeof a -->default : () => void -+>d.default() : any -+>d.default : any -+>d : () => void -+>default : any - - self.default.default(); -->self.default.default() : void -->self.default.default : () => void -->self.default : typeof a -+>self.default.default() : any -+>self.default.default : any -+>self.default : () => void - >self : typeof self -->default : typeof a - >default : () => void -+>default : any - - self.def.default(); -->self.def.default() : void -->self.def.default : () => void -->self.def : typeof a -+>self.def.default() : any -+>self.def.default : any -+>self.def : () => void - >self : typeof self -->def : typeof a -->default : () => void -+>def : () => void -+>default : any diff --git a/testdata/baselines/reference/submodule/compiler/modulePreserve4.errors.txt b/testdata/baselines/reference/submodule/compiler/modulePreserve4.errors.txt index 7e621b8a24..96b7800c1f 100644 --- a/testdata/baselines/reference/submodule/compiler/modulePreserve4.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/modulePreserve4.errors.txt @@ -1,9 +1,11 @@ /f.cts(1,1): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. /main1.ts(3,12): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /main1.ts(19,4): error TS2339: Property 'default' does not exist on type '() => void'. +/main1.ts(23,8): error TS1192: Module '"/e"' has no default export. /main1.ts(30,4): error TS2339: Property 'default' does not exist on type '0'. /main2.mts(4,4): error TS2339: Property 'default' does not exist on type 'typeof import("/a")'. /main2.mts(5,12): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +/main2.mts(14,8): error TS1192: Module '"/e"' has no default export. /main3.cjs(1,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. /main3.cjs(1,13): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. /main3.cjs(5,8): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. @@ -41,7 +43,7 @@ ==== /g.js (0 errors) ==== exports.default = 0; -==== /main1.ts (3 errors) ==== +==== /main1.ts (4 errors) ==== import { x, y } from "./a"; // No y import a1 = require("./a"); // { x: 0 } const a2 = require("./a"); // Error in TS @@ -69,6 +71,8 @@ d3.default(); import e1 from "./e.mjs"; // 0 + ~~ +!!! error TS1192: Module '"/e"' has no default export. import e2 = require("./e.mjs"); // 0 import f1 from "./f.cjs"; // 0 import f2 = require("./f.cjs"); // { default: 0 } @@ -81,7 +85,7 @@ import g2 = require("./g"); // { default: 0 } g2.default; -==== /main2.mts (2 errors) ==== +==== /main2.mts (3 errors) ==== import { x, y } from "./a"; // No y import a1 = require("./a"); // { x: 0 } a1.x; @@ -100,6 +104,8 @@ import d1 from "./d"; // [Function: default] import d2 = require("./d"); // [Function: default] import e1 from "./e.mjs"; // 0 + ~~ +!!! error TS1192: Module '"/e"' has no default export. import e2 = require("./e.mjs"); // 0 import f1 from "./f.cjs"; // 0 import f2 = require("./f.cjs"); // { default: 0 } diff --git a/testdata/baselines/reference/submodule/compiler/modulePreserve4.types b/testdata/baselines/reference/submodule/compiler/modulePreserve4.types index 8add60c00a..555c4cf851 100644 --- a/testdata/baselines/reference/submodule/compiler/modulePreserve4.types +++ b/testdata/baselines/reference/submodule/compiler/modulePreserve4.types @@ -135,7 +135,7 @@ d3.default(); >default : () => void import e1 from "./e.mjs"; // 0 ->e1 : 0 +>e1 : any import e2 = require("./e.mjs"); // 0 >e2 : 0 @@ -212,7 +212,7 @@ import d2 = require("./d"); // [Function: default] >d2 : () => void import e1 from "./e.mjs"; // 0 ->e1 : 0 +>e1 : any import e2 = require("./e.mjs"); // 0 >e2 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt index b388e239a9..923dd9d79c 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt @@ -1,13 +1,10 @@ -src/foo.mts(1,8): error TS1192: Module '"src/a"' has no default export. src/foo.mts(6,4): error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. ==== src/a.cts (0 errors) ==== export const a: number = 1; -==== src/foo.mts (2 errors) ==== +==== src/foo.mts (1 errors) ==== import d, {a} from './a.cjs'; - ~ -!!! error TS1192: Module '"src/a"' has no default export. import * as ns from './a.cjs'; export {d, a, ns}; diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff index 1b161c0638..b8d91ba15c 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff @@ -2,16 +2,13 @@ +++ new.nodeNextCjsNamespaceImportDefault1.errors.txt @@= skipped -0, +0 lines =@@ - -+src/foo.mts(1,8): error TS1192: Module '"src/a"' has no default export. +src/foo.mts(6,4): error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. + + +==== src/a.cts (0 errors) ==== + export const a: number = 1; -+==== src/foo.mts (2 errors) ==== ++==== src/foo.mts (1 errors) ==== + import d, {a} from './a.cjs'; -+ ~ -+!!! error TS1192: Module '"src/a"' has no default export. + import * as ns from './a.cjs'; + export {d, a, ns}; + diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols index 67940b7df7..ce6486e985 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols @@ -18,7 +18,9 @@ export {d, a, ns}; >ns : Symbol(ns, Decl(foo.mts, 2, 13)) d.a; +>d.a : Symbol(a, Decl(a.cts, 0, 12)) >d : Symbol(d, Decl(foo.mts, 0, 6)) +>a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; >ns : Symbol(ns, Decl(foo.mts, 1, 6)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff index 6269343ed2..5624fa9aee 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff @@ -5,8 +5,10 @@ d.a; ->d.a : Symbol(d.a, Decl(a.cts, 0, 12)) ++>d.a : Symbol(a, Decl(a.cts, 0, 12)) >d : Symbol(d, Decl(foo.mts, 0, 6)) ->a : Symbol(d.a, Decl(a.cts, 0, 12)) ++>a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; ->ns.default.a : Symbol(d.a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types index e05f741e8d..187bdd6ce3 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types @@ -7,26 +7,26 @@ export const a: number = 1; === src/foo.mts === import d, {a} from './a.cjs'; ->d : any +>d : typeof d >a : number import * as ns from './a.cjs'; ->ns : typeof ns +>ns : typeof d export {d, a, ns}; ->d : any +>d : typeof d >a : number ->ns : typeof ns +>ns : typeof d d.a; ->d.a : any ->d : any ->a : any +>d.a : number +>d : typeof d +>a : number ns.default.a; >ns.default.a : any >ns.default : any ->ns : typeof ns +>ns : typeof d >default : any >a : any diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff index cd6ef0e85f..0de716579a 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff @@ -1,37 +1,31 @@ --- old.nodeNextCjsNamespaceImportDefault1.types +++ new.nodeNextCjsNamespaceImportDefault1.types -@@= skipped -6, +6 lines =@@ - - === src/foo.mts === - import d, {a} from './a.cjs'; -->d : typeof d -+>d : any +@@= skipped -10, +10 lines =@@ >a : number import * as ns from './a.cjs'; - >ns : typeof ns +->ns : typeof ns ++>ns : typeof d export {d, a, ns}; -->d : typeof d -+>d : any + >d : typeof d >a : number - >ns : typeof ns +->ns : typeof ns ++>ns : typeof d d.a; -->d.a : number -->d : typeof d -->a : number -+>d.a : any -+>d : any -+>a : any + >d.a : number +@@= skipped -13, +13 lines =@@ + >a : number ns.default.a; ->ns.default.a : number ->ns.default : typeof d -+>ns.default.a : any -+>ns.default : any - >ns : typeof ns +->ns : typeof ns ->default : typeof d ->a : number ++>ns.default.a : any ++>ns.default : any ++>ns : typeof d +>default : any +>a : any diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt index 43f262d9fd..dbb54d4c12 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt @@ -1,18 +1,15 @@ -src/foo.mts(5,3): error TS2339: Property 'a' does not exist on type '"string"'. src/foo.mts(6,12): error TS2339: Property 'a' does not exist on type '"string"'. ==== src/a.cts (0 errors) ==== export const a: number = 1; export default 'string'; -==== src/foo.mts (2 errors) ==== +==== src/foo.mts (1 errors) ==== import d, {a} from './a.cjs'; import * as ns from './a.cjs'; export {d, a, ns}; d.a; - ~ -!!! error TS2339: Property 'a' does not exist on type '"string"'. ns.default.a; ~ !!! error TS2339: Property 'a' does not exist on type '"string"'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff index 51e133065e..d4b66f4f29 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff @@ -2,21 +2,18 @@ +++ new.nodeNextCjsNamespaceImportDefault2.errors.txt @@= skipped -0, +0 lines =@@ - -+src/foo.mts(5,3): error TS2339: Property 'a' does not exist on type '"string"'. +src/foo.mts(6,12): error TS2339: Property 'a' does not exist on type '"string"'. + + +==== src/a.cts (0 errors) ==== + export const a: number = 1; + export default 'string'; -+==== src/foo.mts (2 errors) ==== ++==== src/foo.mts (1 errors) ==== + import d, {a} from './a.cjs'; + import * as ns from './a.cjs'; + export {d, a, ns}; + + d.a; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '"string"'. + ns.default.a; + ~ +!!! error TS2339: Property 'a' does not exist on type '"string"'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols index 6c679d3e1c..cba09a427a 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols @@ -19,7 +19,9 @@ export {d, a, ns}; >ns : Symbol(ns, Decl(foo.mts, 2, 13)) d.a; +>d.a : Symbol(a, Decl(a.cts, 0, 12)) >d : Symbol(d, Decl(foo.mts, 0, 6)) +>a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; >ns.default : Symbol(default, Decl(a.cts, 0, 27)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff index 519a453e1c..c28b44f5f4 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff @@ -5,8 +5,10 @@ d.a; ->d.a : Symbol(d.a, Decl(a.cts, 0, 12)) ++>d.a : Symbol(a, Decl(a.cts, 0, 12)) >d : Symbol(d, Decl(foo.mts, 0, 6)) ->a : Symbol(d.a, Decl(a.cts, 0, 12)) ++>a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; ->ns.default.a : Symbol(d.a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types index 0ba99e8941..eb3b767623 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types @@ -8,26 +8,26 @@ export const a: number = 1; export default 'string'; === src/foo.mts === import d, {a} from './a.cjs'; ->d : "string" +>d : typeof d >a : number import * as ns from './a.cjs'; ->ns : typeof ns +>ns : typeof d export {d, a, ns}; ->d : "string" +>d : typeof d >a : number ->ns : typeof ns +>ns : typeof d d.a; ->d.a : any ->d : "string" ->a : any +>d.a : number +>d : typeof d +>a : number ns.default.a; >ns.default.a : any >ns.default : "string" ->ns : typeof ns +>ns : typeof d >default : "string" >a : any diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff index 274ae4da55..80a692a2c9 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff @@ -1,37 +1,31 @@ --- old.nodeNextCjsNamespaceImportDefault2.types +++ new.nodeNextCjsNamespaceImportDefault2.types -@@= skipped -7, +7 lines =@@ - export default 'string'; - === src/foo.mts === - import d, {a} from './a.cjs'; -->d : typeof d -+>d : "string" +@@= skipped -11, +11 lines =@@ >a : number import * as ns from './a.cjs'; - >ns : typeof ns +->ns : typeof ns ++>ns : typeof d export {d, a, ns}; -->d : typeof d -+>d : "string" + >d : typeof d >a : number - >ns : typeof ns +->ns : typeof ns ++>ns : typeof d d.a; -->d.a : number -->d : typeof d -->a : number -+>d.a : any -+>d : "string" -+>a : any + >d.a : number +@@= skipped -13, +13 lines =@@ + >a : number ns.default.a; ->ns.default.a : number ->ns.default : typeof d -+>ns.default.a : any -+>ns.default : "string" - >ns : typeof ns +->ns : typeof ns ->default : typeof d ->a : number ++>ns.default.a : any ++>ns.default : "string" ++>ns : typeof d +>default : "string" +>a : any diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt index 32101de391..754dde9109 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt @@ -6,12 +6,15 @@ main.ts(5,18): error TS2307: Cannot find module './file.mjs' or its correspondin main.ts(6,18): error TS2307: Cannot find module './file.cjs' or its corresponding type declarations. main.ts(7,18): error TS2307: Cannot find module './file.mts' or its corresponding type declarations. main.ts(8,18): error TS2307: Cannot find module './file.cts' or its corresponding type declarations. +main.ts(9,18): error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. +main.ts(10,19): error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. +main.ts(11,19): error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. ==== package.json (0 errors) ==== {"type": "module"} -==== main.ts (9 errors) ==== +==== main.ts (12 errors) ==== import def1 from "./file.js"; ~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.js' or its corresponding type declarations. @@ -37,8 +40,14 @@ main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corre ~~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.cts' or its corresponding type declarations. import def9 from "./file.d.ts"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. import def10 from "./file.d.cts"; + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. import def11 from "./file.d.mts"; + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. import def12 from "./file.d.json.ts"; ~~~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt.diff deleted file mode 100644 index 985247ee44..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node18).errors.txt -+++ new.declarationFileForTsJsImport(module=node18).errors.txt -@@= skipped -5, +5 lines =@@ - main.ts(6,18): error TS2307: Cannot find module './file.cjs' or its corresponding type declarations. - main.ts(7,18): error TS2307: Cannot find module './file.mts' or its corresponding type declarations. - main.ts(8,18): error TS2307: Cannot find module './file.cts' or its corresponding type declarations. --main.ts(9,18): error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. --main.ts(10,19): error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. --main.ts(11,19): error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. - main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. - - - ==== package.json (0 errors) ==== - {"type": "module"} --==== main.ts (12 errors) ==== -+==== main.ts (9 errors) ==== - import def1 from "./file.js"; - ~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.js' or its corresponding type declarations. -@@= skipped -34, +31 lines =@@ - ~~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.cts' or its corresponding type declarations. - import def9 from "./file.d.ts"; -- ~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. - import def10 from "./file.d.cts"; -- ~~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. - import def11 from "./file.d.mts"; -- ~~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. - import def12 from "./file.d.json.ts"; - ~~~~~~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types index 807edbddf6..f1d5204ee9 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types @@ -26,13 +26,13 @@ import def8 from "./file.cts"; >def8 : any import def9 from "./file.d.ts"; ->def9 : "bad3" +>def9 : any import def10 from "./file.d.cts"; ->def10 : "bad8" +>def10 : any import def11 from "./file.d.mts"; ->def11 : "bad7" +>def11 : any import def12 from "./file.d.json.ts"; >def12 : any diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types.diff deleted file mode 100644 index 6cd510c3c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node18).types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node18).types -+++ new.declarationFileForTsJsImport(module=node18).types -@@= skipped -25, +25 lines =@@ - >def8 : any - - import def9 from "./file.d.ts"; -->def9 : any -+>def9 : "bad3" - - import def10 from "./file.d.cts"; -->def10 : any -+>def10 : "bad8" - - import def11 from "./file.d.mts"; -->def11 : any -+>def11 : "bad7" - - import def12 from "./file.d.json.ts"; - >def12 : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt index 4497d365fa..f2f160a4bd 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt @@ -1,42 +1,32 @@ mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. -mod.mts(1,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. mod.mts(1,51): error TS2858: Import attribute values must be string literal expressions. -mod.mts(2,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. mod.mts(2,51): error TS2858: Import attribute values must be string literal expressions. mod.mts(3,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'RegExp' is not assignable to type 'string'. -mod.mts(3,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. mod.mts(3,51): error TS2858: Import attribute values must be string literal expressions. mod.mts(4,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'string[]' is not assignable to type 'string'. -mod.mts(4,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. mod.mts(4,51): error TS2858: Import attribute values must be string literal expressions. mod.mts(5,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type '{ a: number; }' is not assignable to type 'string'. -mod.mts(5,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. mod.mts(5,51): error TS2858: Import attribute values must be string literal expressions. -mod.mts(6,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. -==== mod.mts (16 errors) ==== +==== mod.mts (10 errors) ==== import * as thing1 from "./mod.mjs" with { field: 0 }; ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing2 from "./mod.mjs" with { field: `a` }; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing3 from "./mod.mjs" with { field: /a/g }; @@ -44,8 +34,6 @@ mod.mts(6,65): error TS2858: Import attribute values must be string literal expr !!! error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ~~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing4 from "./mod.mjs" with { field: ["a"] }; @@ -53,8 +41,6 @@ mod.mts(6,65): error TS2858: Import attribute values must be string literal expr !!! error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'string[]' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ~~~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; @@ -62,13 +48,9 @@ mod.mts(6,65): error TS2858: Import attribute values must be string literal expr !!! error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ~~~~~~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ~~~~~~~~~~~~~ !!! error TS2858: Import attribute values must be string literal expressions. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt.diff deleted file mode 100644 index 5cd3586873..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node18).errors.txt.diff +++ /dev/null @@ -1,78 +0,0 @@ ---- old.importAttributes6(module=node18).errors.txt -+++ new.importAttributes6(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. -+mod.mts(1,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - mod.mts(1,51): error TS2858: Import attribute values must be string literal expressions. -+mod.mts(2,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - mod.mts(2,51): error TS2858: Import attribute values must be string literal expressions. - mod.mts(3,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'RegExp' is not assignable to type 'string'. -+mod.mts(3,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - mod.mts(3,51): error TS2858: Import attribute values must be string literal expressions. - mod.mts(4,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'string[]' is not assignable to type 'string'. -+mod.mts(4,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - mod.mts(4,51): error TS2858: Import attribute values must be string literal expressions. - mod.mts(5,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type '{ a: number; }' is not assignable to type 'string'. -+mod.mts(5,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - mod.mts(5,51): error TS2858: Import attribute values must be string literal expressions. -+mod.mts(6,37): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. - - --==== mod.mts (10 errors) ==== -+==== mod.mts (16 errors) ==== - import * as thing1 from "./mod.mjs" with { field: 0 }; - ~~~~~~~~~~~~~~~~~ - !!! error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type 'number' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing2 from "./mod.mjs" with { field: `a` }; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing3 from "./mod.mjs" with { field: /a/g }; -@@= skipped -33, +43 lines =@@ - !!! error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing4 from "./mod.mjs" with { field: ["a"] }; -@@= skipped -7, +9 lines =@@ - !!! error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type 'string[]' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; -@@= skipped -7, +9 lines =@@ - !!! error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~~~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~~~~~~~~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt index 53356e56d4..f2f160a4bd 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt @@ -1,42 +1,32 @@ mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. -mod.mts(1,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. mod.mts(1,51): error TS2858: Import attribute values must be string literal expressions. -mod.mts(2,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. mod.mts(2,51): error TS2858: Import attribute values must be string literal expressions. mod.mts(3,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'RegExp' is not assignable to type 'string'. -mod.mts(3,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. mod.mts(3,51): error TS2858: Import attribute values must be string literal expressions. mod.mts(4,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'string[]' is not assignable to type 'string'. -mod.mts(4,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. mod.mts(4,51): error TS2858: Import attribute values must be string literal expressions. mod.mts(5,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type '{ a: number; }' is not assignable to type 'string'. -mod.mts(5,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. mod.mts(5,51): error TS2858: Import attribute values must be string literal expressions. -mod.mts(6,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. -==== mod.mts (16 errors) ==== +==== mod.mts (10 errors) ==== import * as thing1 from "./mod.mjs" with { field: 0 }; ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing2 from "./mod.mjs" with { field: `a` }; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing3 from "./mod.mjs" with { field: /a/g }; @@ -44,8 +34,6 @@ mod.mts(6,65): error TS2858: Import attribute values must be string literal expr !!! error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing4 from "./mod.mjs" with { field: ["a"] }; @@ -53,8 +41,6 @@ mod.mts(6,65): error TS2858: Import attribute values must be string literal expr !!! error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'string[]' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~~~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; @@ -62,13 +48,9 @@ mod.mts(6,65): error TS2858: Import attribute values must be string literal expr !!! error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~~~~~~~~ !!! error TS2858: Import attribute values must be string literal expressions. import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~~~~~~~~~~~~~ !!! error TS2858: Import attribute values must be string literal expressions. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt.diff deleted file mode 100644 index 27bb0afa94..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,78 +0,0 @@ ---- old.importAttributes6(module=nodenext).errors.txt -+++ new.importAttributes6(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. -+mod.mts(1,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - mod.mts(1,51): error TS2858: Import attribute values must be string literal expressions. -+mod.mts(2,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - mod.mts(2,51): error TS2858: Import attribute values must be string literal expressions. - mod.mts(3,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'RegExp' is not assignable to type 'string'. -+mod.mts(3,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - mod.mts(3,51): error TS2858: Import attribute values must be string literal expressions. - mod.mts(4,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'string[]' is not assignable to type 'string'. -+mod.mts(4,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - mod.mts(4,51): error TS2858: Import attribute values must be string literal expressions. - mod.mts(5,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type '{ a: number; }' is not assignable to type 'string'. -+mod.mts(5,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - mod.mts(5,51): error TS2858: Import attribute values must be string literal expressions. -+mod.mts(6,37): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. - - --==== mod.mts (10 errors) ==== -+==== mod.mts (16 errors) ==== - import * as thing1 from "./mod.mjs" with { field: 0 }; - ~~~~~~~~~~~~~~~~~ - !!! error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type 'number' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing2 from "./mod.mjs" with { field: `a` }; -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing3 from "./mod.mjs" with { field: /a/g }; -@@= skipped -33, +43 lines =@@ - !!! error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing4 from "./mod.mjs" with { field: ["a"] }; -@@= skipped -7, +9 lines =@@ - !!! error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type 'string[]' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ~~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; -@@= skipped -7, +9 lines =@@ - !!! error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. - !!! error TS2322: Property 'field' is incompatible with index signature. - !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ~~~~~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ~~~~~~~~~~~~~ - !!! error TS2858: Import attribute values must be string literal expressions. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt index 4f8553ba45..acd3f74984 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt @@ -1,40 +1,86 @@ -error TS2468: Cannot find global value 'Promise'. -index.cts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.cts(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. +index.cts(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. +index.cts(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. +index.cts(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. +index.cts(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. +index.cts(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. +index.cts(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. +index.cts(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. +index.cts(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. +index.cts(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. +index.cts(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. +index.cts(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cts(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cts(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cts(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cts(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.ts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.ts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.ts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.ts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.ts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.ts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.ts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.ts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.ts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -!!! error TS2468: Cannot find global value 'Promise'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = 1; @@ -71,7 +117,7 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // cjs format file const x = 1; export {x}; -==== index.mts (11 errors) ==== +==== index.mts (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -86,16 +132,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -122,7 +190,11 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); + ~~~~ +!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -130,8 +202,14 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -146,59 +224,75 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; -==== index.cts (11 errors) ==== +==== index.cts (27 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; + ~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. import * as m2 from "./index.mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. import * as m11 from "./subfolder2/another/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) import * as m13 from "./"; + ~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. import * as m15 from "./subfolder"; import * as m16 from "./subfolder/"; import * as m17 from "./subfolder/index"; @@ -206,8 +300,14 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m19 from "./subfolder2/"; import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. void m1; void m2; void m3; @@ -234,7 +334,11 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); + ~~~~ +!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -242,8 +346,14 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -258,42 +368,42 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; -==== index.ts (11 errors) ==== +==== index.ts (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -308,16 +418,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -344,7 +476,11 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); + ~~~~ +!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -352,8 +488,14 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -368,38 +510,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt.diff deleted file mode 100644 index 3f21f44064..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).errors.txt.diff +++ /dev/null @@ -1,535 +0,0 @@ ---- old.nodeModules1(module=node18).errors.txt -+++ new.nodeModules1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.cts(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. --index.cts(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. --index.cts(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. --index.cts(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. --index.cts(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. --index.cts(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. --index.cts(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. --index.cts(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. --index.cts(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. --index.cts(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. --index.cts(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. --index.cts(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.cts(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.cts(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.cts(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.cts(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.cts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.cts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.mts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.mts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.mts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.mts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.ts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.ts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.ts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.ts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.ts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.ts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.ts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.ts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.ts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -- -- -+error TS2468: Cannot find global value 'Promise'. -+index.cts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. - ==== subfolder/index.ts (0 errors) ==== - // cjs format file - const x = 1; -@@= skipped -116, +70 lines =@@ - // cjs format file - const x = 1; - export {x}; --==== index.mts (27 errors) ==== -+==== index.mts (11 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -15, +15 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -58, +36 lines =@@ - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -- ~~~~ --!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m25 = require("./index"); -- ~~~~~~~~~ --!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m26 = require("./subfolder"); - import m27 = require("./subfolder/"); - import m28 = require("./subfolder/index"); -@@= skipped -12, +8 lines =@@ - import m30 = require("./subfolder2/"); - import m31 = require("./subfolder2/index"); - import m32 = require("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m33 = require("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m34 = require("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; -@@= skipped -22, +16 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - // esm format file - const x = 1; - export {x}; --==== index.cts (27 errors) ==== -+==== index.cts (11 errors) ==== - // ESM-format imports below should issue errors - import * as m1 from "./index.js"; -- ~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. - import * as m2 from "./index.mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. - import * as m3 from "./index.cjs"; - import * as m4 from "./subfolder/index.js"; - import * as m5 from "./subfolder/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. - import * as m6 from "./subfolder/index.cjs"; - import * as m7 from "./subfolder2/index.js"; - import * as m8 from "./subfolder2/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. - import * as m9 from "./subfolder2/index.cjs"; - import * as m10 from "./subfolder2/another/index.js"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. - import * as m11 from "./subfolder2/another/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) - import * as m13 from "./"; -- ~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. - import * as m15 from "./subfolder"; - import * as m16 from "./subfolder/"; - import * as m17 from "./subfolder/index"; -@@= skipped -76, +60 lines =@@ - import * as m19 from "./subfolder2/"; - import * as m20 from "./subfolder2/index"; - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. - void m1; - void m2; - void m3; -@@= skipped -34, +28 lines =@@ - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -- ~~~~ --!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m25 = require("./index"); -- ~~~~~~~~~ --!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m26 = require("./subfolder"); - import m27 = require("./subfolder/"); - import m28 = require("./subfolder/index"); -@@= skipped -12, +8 lines =@@ - import m30 = require("./subfolder2/"); - import m31 = require("./subfolder2/index"); - import m32 = require("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m33 = require("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m34 = require("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; -@@= skipped -22, +16 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // cjs format file - const x = 1; - export {x}; --==== index.ts (27 errors) ==== -+==== index.ts (11 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -50, +50 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -58, +36 lines =@@ - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -- ~~~~ --!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m25 = require("./index"); -- ~~~~~~~~~ --!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m26 = require("./subfolder"); - import m27 = require("./subfolder/"); - import m28 = require("./subfolder/index"); -@@= skipped -12, +8 lines =@@ - import m30 = require("./subfolder2/"); - import m31 = require("./subfolder2/index"); - import m32 = require("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m33 = require("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m34 = require("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; -@@= skipped -22, +16 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // esm format file - const x = 1; - export {x}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types index 3004d4259a..bcf4d98022 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types @@ -120,37 +120,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -202,47 +202,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -324,58 +324,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise ->import("./") : Promise +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise ->import("./index") : Promise +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise ->import("./subfolder") : Promise +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise ->import("./subfolder/") : Promise +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise ->import("./subfolder/index") : Promise +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise ->import("./subfolder2") : Promise +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise ->import("./subfolder2/") : Promise +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise ->import("./subfolder2/index") : Promise +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise ->import("./subfolder2/another") : Promise +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise ->import("./subfolder2/another/") : Promise +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise ->import("./subfolder2/another/index") : Promise +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file @@ -630,58 +630,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise ->import("./") : Promise +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise ->import("./index") : Promise +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise ->import("./subfolder") : Promise +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise ->import("./subfolder/") : Promise +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise ->import("./subfolder/index") : Promise +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise ->import("./subfolder2") : Promise +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise ->import("./subfolder2/") : Promise +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise ->import("./subfolder2/index") : Promise +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise ->import("./subfolder2/another") : Promise +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise ->import("./subfolder2/another/") : Promise +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise ->import("./subfolder2/another/index") : Promise +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // cjs format file @@ -731,37 +731,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -813,47 +813,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -935,58 +935,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise ->import("./") : Promise +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise ->import("./index") : Promise +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise ->import("./subfolder") : Promise +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise ->import("./subfolder/") : Promise +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise ->import("./subfolder/index") : Promise +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise ->import("./subfolder2") : Promise +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise ->import("./subfolder2/") : Promise +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise ->import("./subfolder2/index") : Promise +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise ->import("./subfolder2/another") : Promise +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise ->import("./subfolder2/another/") : Promise +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise ->import("./subfolder2/another/index") : Promise +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff index d1fac46db4..2d868cb3bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff @@ -1,114 +1,6 @@ --- old.nodeModules1(module=node18).types +++ new.nodeModules1(module=node18).types -@@= skipped -119, +119 lines =@@ - - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ +@@= skipped -251, +251 lines =@@ >m25 : typeof m1 import m26 = require("./subfolder"); @@ -171,277 +63,7 @@ void m32; >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise -+>import("./") : Promise - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise -+>import("./index") : Promise - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise -+>import("./subfolder") : Promise - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise -+>import("./subfolder/") : Promise - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise -+>import("./subfolder/index") : Promise - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise -+>import("./subfolder2") : Promise - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise -+>import("./subfolder2/") : Promise - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise -+>import("./subfolder2/index") : Promise - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise -+>import("./subfolder2/another") : Promise - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise -+>import("./subfolder2/another/") : Promise - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise -+>import("./subfolder2/another/index") : Promise - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file -@@= skipped -306, +306 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise -+>import("./") : Promise - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise -+>import("./index") : Promise - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise -+>import("./subfolder") : Promise - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise -+>import("./subfolder/") : Promise - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise -+>import("./subfolder/index") : Promise - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise -+>import("./subfolder2") : Promise - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise -+>import("./subfolder2/") : Promise - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise -+>import("./subfolder2/index") : Promise - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise -+>import("./subfolder2/another") : Promise - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise -+>import("./subfolder2/another/") : Promise - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise -+>import("./subfolder2/another/index") : Promise - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // cjs format file -@@= skipped -101, +101 lines =@@ - - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ +@@= skipped -575, +575 lines =@@ >m25 : typeof m1 import m26 = require("./subfolder"); @@ -503,85 +125,4 @@ +>m31 : typeof m7 void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise -+>import("./") : Promise - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise -+>import("./index") : Promise - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise -+>import("./subfolder") : Promise - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise -+>import("./subfolder/") : Promise - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise -+>import("./subfolder/index") : Promise - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise -+>import("./subfolder2") : Promise - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise -+>import("./subfolder2/") : Promise - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise -+>import("./subfolder2/index") : Promise - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise -+>import("./subfolder2/another") : Promise - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise -+>import("./subfolder2/another/") : Promise - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise -+>import("./subfolder2/another/index") : Promise - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file \ No newline at end of file + >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt index acd3f74984..52d56aff66 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt @@ -1,19 +1,3 @@ -index.cts(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. -index.cts(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. -index.cts(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. -index.cts(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. -index.cts(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. -index.cts(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. -index.cts(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. -index.cts(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. -index.cts(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. -index.cts(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. -index.cts(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. -index.cts(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cts(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cts(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cts(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cts(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. @@ -36,11 +20,6 @@ index.mts(21,22): error TS2835: Relative import paths need explicit file extensi index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -index.mts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. @@ -63,11 +42,6 @@ index.ts(21,22): error TS2835: Relative import paths need explicit file extensio index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -index.ts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.ts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.ts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.ts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.ts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. @@ -117,7 +91,7 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio // cjs format file const x = 1; export {x}; -==== index.mts (27 errors) ==== +==== index.mts (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -190,11 +164,7 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~ -!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~ -!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -202,14 +172,8 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -260,39 +224,23 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio // esm format file const x = 1; export {x}; -==== index.cts (27 errors) ==== +==== index.cts (11 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; - ~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. import * as m2 from "./index.mjs"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. import * as m11 from "./subfolder2/another/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) import * as m13 from "./"; - ~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. import * as m14 from "./index"; - ~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. import * as m15 from "./subfolder"; import * as m16 from "./subfolder/"; import * as m17 from "./subfolder/index"; @@ -300,14 +248,8 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio import * as m19 from "./subfolder2/"; import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. import * as m22 from "./subfolder2/another/"; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. import * as m23 from "./subfolder2/another/index"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. void m1; void m2; void m3; @@ -334,11 +276,7 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~ -!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~ -!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -346,14 +284,8 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -403,7 +335,7 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio // cjs format file const x = 1; export {x}; -==== index.ts (27 errors) ==== +==== index.ts (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -476,11 +408,7 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~ -!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~ -!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -488,14 +416,8 @@ index.ts(84,21): error TS2835: Relative import paths need explicit file extensio import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt.diff deleted file mode 100644 index c9407c0653..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,201 +0,0 @@ ---- old.nodeModules1(module=nodenext).errors.txt -+++ new.nodeModules1(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -+index.cts(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. -+index.cts(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. -+index.cts(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. -+index.cts(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. -+index.cts(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. -+index.cts(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. -+index.cts(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. -+index.cts(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. -+index.cts(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. -+index.cts(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. -+index.cts(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. -+index.cts(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cts(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cts(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cts(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cts(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. - index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -@@= skipped -19, +35 lines =@@ - index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+index.mts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. - index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -@@= skipped -22, +27 lines =@@ - index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+index.ts(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.ts(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.ts(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.ts(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.ts(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. - index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -@@= skipped -49, +54 lines =@@ - // cjs format file - const x = 1; - export {x}; --==== index.mts (22 errors) ==== -+==== index.mts (27 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -73, +73 lines =@@ - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -+ ~~~~ -+!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m25 = require("./index"); -+ ~~~~~~~~~ -+!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m26 = require("./subfolder"); - import m27 = require("./subfolder/"); - import m28 = require("./subfolder/index"); -@@= skipped -8, +12 lines =@@ - import m30 = require("./subfolder2/"); - import m31 = require("./subfolder2/index"); - import m32 = require("./subfolder2/another"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m33 = require("./subfolder2/another/"); -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m34 = require("./subfolder2/another/index"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; -@@= skipped -52, +58 lines =@@ - // esm format file - const x = 1; - export {x}; --==== index.cts (11 errors) ==== -+==== index.cts (27 errors) ==== - // ESM-format imports below should issue errors - import * as m1 from "./index.js"; -+ ~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. - import * as m2 from "./index.mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. - import * as m3 from "./index.cjs"; - import * as m4 from "./subfolder/index.js"; - import * as m5 from "./subfolder/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. - import * as m6 from "./subfolder/index.cjs"; - import * as m7 from "./subfolder2/index.js"; - import * as m8 from "./subfolder2/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. - import * as m9 from "./subfolder2/index.cjs"; - import * as m10 from "./subfolder2/another/index.js"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. - import * as m11 from "./subfolder2/another/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) - import * as m13 from "./"; -+ ~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. - import * as m14 from "./index"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. - import * as m15 from "./subfolder"; - import * as m16 from "./subfolder/"; - import * as m17 from "./subfolder/index"; -@@= skipped -24, +40 lines =@@ - import * as m19 from "./subfolder2/"; - import * as m20 from "./subfolder2/index"; - import * as m21 from "./subfolder2/another"; -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. - import * as m22 from "./subfolder2/another/"; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. - import * as m23 from "./subfolder2/another/index"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. - void m1; - void m2; - void m3; -@@= skipped -28, +34 lines =@@ - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -+ ~~~~ -+!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m25 = require("./index"); -+ ~~~~~~~~~ -+!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m26 = require("./subfolder"); - import m27 = require("./subfolder/"); - import m28 = require("./subfolder/index"); -@@= skipped -8, +12 lines =@@ - import m30 = require("./subfolder2/"); - import m31 = require("./subfolder2/index"); - import m32 = require("./subfolder2/another"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m33 = require("./subfolder2/another/"); -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m34 = require("./subfolder2/another/index"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; -@@= skipped -51, +57 lines =@@ - // cjs format file - const x = 1; - export {x}; --==== index.ts (22 errors) ==== -+==== index.ts (27 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -73, +73 lines =@@ - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -+ ~~~~ -+!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m25 = require("./index"); -+ ~~~~~~~~~ -+!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m26 = require("./subfolder"); - import m27 = require("./subfolder/"); - import m28 = require("./subfolder/index"); -@@= skipped -8, +12 lines =@@ - import m30 = require("./subfolder2/"); - import m31 = require("./subfolder2/index"); - import m32 = require("./subfolder2/another"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m33 = require("./subfolder2/another/"); -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import m34 = require("./subfolder2/another/index"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).errors.txt index edf77fdc92..7cbf2626ec 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).errors.txt @@ -1,40 +1,86 @@ -error TS2468: Cannot find global value 'Promise'. -index.cjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.cjs(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. +index.cjs(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. +index.cjs(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. +index.cjs(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. +index.cjs(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. +index.cjs(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. +index.cjs(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. +index.cjs(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. +index.cjs(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. +index.cjs(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. +index.cjs(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. +index.cjs(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -!!! error TS2468: Cannot find global value 'Promise'. ==== subfolder/index.js (0 errors) ==== // cjs format file const x = 1; @@ -71,7 +117,7 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // esm format file const x = 1; export {x}; -==== index.js (11 errors) ==== +==== index.js (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -86,16 +132,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -122,7 +190,11 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); + ~~~~ +!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -130,8 +202,14 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -146,58 +224,74 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; -==== index.cjs (11 errors) ==== +==== index.cjs (27 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; + ~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. import * as m2 from "./index.mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. import * as m11 from "./subfolder2/another/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) import * as m13 from "./"; + ~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. import * as m15 from "./subfolder"; import * as m16 from "./subfolder/"; import * as m17 from "./subfolder/index"; @@ -205,8 +299,14 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m19 from "./subfolder2/"; import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. void m1; void m2; void m3; @@ -233,7 +333,11 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); + ~~~~ +!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -241,8 +345,14 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -257,42 +367,42 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; -==== index.mjs (11 errors) ==== +==== index.mjs (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -307,16 +417,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -343,7 +475,11 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); + ~~~~ +!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -351,8 +487,14 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -367,38 +509,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types index 53d365f5df..dcb59ef72a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types @@ -120,37 +120,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -202,47 +202,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -324,58 +324,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise ->import("./") : Promise +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise ->import("./index") : Promise +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise ->import("./subfolder") : Promise +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise ->import("./subfolder/") : Promise +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise ->import("./subfolder/index") : Promise +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise ->import("./subfolder2") : Promise +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise ->import("./subfolder2/") : Promise +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise ->import("./subfolder2/index") : Promise +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise ->import("./subfolder2/another") : Promise +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise ->import("./subfolder2/another/") : Promise +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise ->import("./subfolder2/another/index") : Promise +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file @@ -630,58 +630,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise ->import("./") : Promise +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise ->import("./index") : Promise +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise ->import("./subfolder") : Promise +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise ->import("./subfolder/") : Promise +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise ->import("./subfolder/index") : Promise +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise ->import("./subfolder2") : Promise +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise ->import("./subfolder2/") : Promise +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise ->import("./subfolder2/index") : Promise +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise ->import("./subfolder2/another") : Promise +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise ->import("./subfolder2/another/") : Promise +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise ->import("./subfolder2/another/index") : Promise +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // cjs format file @@ -731,37 +731,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -813,47 +813,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -935,58 +935,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise ->import("./") : Promise +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise ->import("./index") : Promise +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise ->import("./subfolder") : Promise +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise ->import("./subfolder/") : Promise +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise ->import("./subfolder/index") : Promise +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise ->import("./subfolder2") : Promise +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise ->import("./subfolder2/") : Promise +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise ->import("./subfolder2/index") : Promise +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise ->import("./subfolder2/another") : Promise +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise ->import("./subfolder2/another/") : Promise +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise ->import("./subfolder2/another/index") : Promise +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt index 7cbf2626ec..f766eb28b5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt @@ -1,19 +1,3 @@ -index.cjs(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. -index.cjs(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. -index.cjs(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. -index.cjs(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. -index.cjs(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. -index.cjs(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. -index.cjs(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. -index.cjs(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. -index.cjs(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. -index.cjs(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. -index.cjs(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. -index.cjs(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. @@ -36,11 +20,6 @@ index.js(21,22): error TS2835: Relative import paths need explicit file extensio index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. @@ -63,11 +42,6 @@ index.mjs(21,22): error TS2835: Relative import paths need explicit file extensi index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. @@ -117,7 +91,7 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi // esm format file const x = 1; export {x}; -==== index.js (27 errors) ==== +==== index.js (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -190,11 +164,7 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~ -!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~ -!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -202,14 +172,8 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -259,39 +223,23 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi // esm format file const x = 1; export {x}; -==== index.cjs (27 errors) ==== +==== index.cjs (11 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; - ~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. import * as m2 from "./index.mjs"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. import * as m11 from "./subfolder2/another/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) import * as m13 from "./"; - ~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. import * as m14 from "./index"; - ~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. import * as m15 from "./subfolder"; import * as m16 from "./subfolder/"; import * as m17 from "./subfolder/index"; @@ -299,14 +247,8 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi import * as m19 from "./subfolder2/"; import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. import * as m22 from "./subfolder2/another/"; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. import * as m23 from "./subfolder2/another/index"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. void m1; void m2; void m3; @@ -333,11 +275,7 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~ -!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~ -!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -345,14 +283,8 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; @@ -402,7 +334,7 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi // cjs format file const x = 1; export {x}; -==== index.mjs (27 errors) ==== +==== index.mjs (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -475,11 +407,7 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~ -!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~ -!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); import m27 = require("./subfolder/"); import m28 = require("./subfolder/index"); @@ -487,14 +415,8 @@ index.mjs(84,21): error TS2835: Relative import paths need explicit file extensi import m30 = require("./subfolder2/"); import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index 0b4dfccf9f..26f1b13e74 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,3 +1,5 @@ +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.cjs(11,21): error TS2307: Cannot find module 'inner/types' or its corresponding type declarations. @@ -68,11 +70,15 @@ node_modules/inner/index.d.ts(5,21): error TS2307: Cannot find module 'inner/typ ~~~~~~~~~ !!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (5 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt index 26f1b13e74..0b4dfccf9f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt @@ -1,5 +1,3 @@ -index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.cjs(11,21): error TS2307: Cannot find module 'inner/types' or its corresponding type declarations. @@ -70,15 +68,11 @@ node_modules/inner/index.d.ts(5,21): error TS2307: Cannot find module 'inner/typ ~~~~~~~~~ !!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. ts.mjsSource; -==== index.cjs (5 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; - ~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node18).errors.txt deleted file mode 100644 index fb1f8cfd94..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node18).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS2468: Cannot find global value 'Promise'. -index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.js (1 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== index.js (1 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt new file mode 100644 index 0000000000..b80fa4321a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt @@ -0,0 +1,35 @@ +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. + + +==== subfolder/index.js (0 errors) ==== + // cjs format file + const a = {}; + export = a; +==== subfolder/file.js (0 errors) ==== + // cjs format file + const a = {}; + module.exports = a; +==== index.js (1 errors) ==== + // esm format file + const a = {}; + 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) ==== + // 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", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt index 7caa7da9ca..6bdf1d41c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt @@ -1,6 +1,3 @@ -index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. @@ -19,18 +16,12 @@ subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is res ~~~~~~~~~~ !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file function require() {} - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. const exports = {}; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} export const __esModule = false; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node18).errors.txt new file mode 100644 index 0000000000..28110ed339 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node18).errors.txt @@ -0,0 +1,23 @@ +subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +==== subfolder/index.js (1 errors) ==== + // cjs format file + const x = import.meta.url; + ~~~~~~~~~~~ +!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + export {x}; +==== index.js (0 errors) ==== + // esm format file + const x = import.meta.url; + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types index 9ef6ca5e5d..a28566d8d4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types @@ -25,9 +25,9 @@ export async function f() { >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); ->mod4 : typeof mod2 ->await import ("./index.js") : typeof mod2 ->import ("./index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./index.js") : { f(): Promise; default: typeof mod2; } +>import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./index.js" : "./index.js" h(); @@ -59,9 +59,9 @@ export async function h() { >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); ->mod4 : typeof mod2 ->await import ("./subfolder/index.js") : typeof mod2 ->import ("./subfolder/index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } +>import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./subfolder/index.js" : "./subfolder/index.js" f(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt index 80886fb3df..4c4797fb6c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt @@ -1,45 +1,36 @@ -error TS2468: Cannot find global value 'Promise'. -index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.js(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +subfolder/index.js(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. + To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. +subfolder/index.js(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.js (3 errors) ==== +==== subfolder/index.js (2 errors) ==== // cjs format file import {h} from "../index.js"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. +!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. import mod = require("../index.js"); + ~~~~~~~~~~~~~ +!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import {f as _f} from "./index.js"; import mod2 = require("./index.js"); export async function f() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. h(); } -==== index.js (3 errors) ==== +==== index.js (1 errors) ==== // esm format file import {h as _h} from "./index.js"; import mod = require("./index.js"); + ~~~~~~~~~~~~ +!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import {f} from "./subfolder/index.js"; import mod2 = require("./subfolder/index.js"); export async function h() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. f(); } ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt deleted file mode 100644 index 4c4797fb6c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt +++ /dev/null @@ -1,45 +0,0 @@ -index.js(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -subfolder/index.js(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. - To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. -subfolder/index.js(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - - -==== subfolder/index.js (2 errors) ==== - // cjs format file - import {h} from "../index.js"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. - import mod = require("../index.js"); - ~~~~~~~~~~~~~ -!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f as _f} from "./index.js"; - import mod2 = require("./index.js"); - export async function f() { - const mod3 = await import ("../index.js"); - const mod4 = await import ("./index.js"); - h(); - } -==== index.js (1 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); - ~~~~~~~~~~~~ -!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f} from "./subfolder/index.js"; - import mod2 = require("./subfolder/index.js"); - export async function h() { - const mod3 = await import ("./index.js"); - const mod4 = await import ("./subfolder/index.js"); - f(); - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types index 9ef6ca5e5d..a28566d8d4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types @@ -25,9 +25,9 @@ export async function f() { >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); ->mod4 : typeof mod2 ->await import ("./index.js") : typeof mod2 ->import ("./index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./index.js") : { f(): Promise; default: typeof mod2; } +>import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./index.js" : "./index.js" h(); @@ -59,9 +59,9 @@ export async function h() { >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); ->mod4 : typeof mod2 ->await import ("./subfolder/index.js") : typeof mod2 ->import ("./subfolder/index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } +>import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./subfolder/index.js" : "./subfolder/index.js" f(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt index ddcf79bcd7..78c93edaa0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt @@ -1,27 +1,21 @@ -index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. ==== subfolder/index.js (2 errors) ==== // cjs format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -==== index.js (2 errors) ==== +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.js (0 errors) ==== // esm format file const x = await 1; - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} - ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt deleted file mode 100644 index 81e9b943c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. - - -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export const a = 1; -==== index.ts (1 errors) ==== - // esm format file - import mod from "./subfolder/index.js"; - ~~~ -!!! error TS1192: Module '"subfolder/index"' has no default export. - mod; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt.diff deleted file mode 100644 index 16f9492cf0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. -+ -+ -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ export const a = 1; -+==== index.ts (1 errors) ==== -+ // esm format file -+ import mod from "./subfolder/index.js"; -+ ~~~ -+!!! error TS1192: Module '"subfolder/index"' has no default export. -+ mod; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types index ff082de1b8..906754ee99 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types @@ -9,8 +9,8 @@ export const a = 1; === index.ts === // esm format file import mod from "./subfolder/index.js"; ->mod : any +>mod : typeof mod mod; ->mod : any +>mod : typeof mod diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types.diff deleted file mode 100644 index 59acf9bf65..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node16).types -@@= skipped -8, +8 lines =@@ - === index.ts === - // esm format file - import mod from "./subfolder/index.js"; -->mod : typeof mod -+>mod : any - - mod; -->mod : typeof mod -+>mod : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt deleted file mode 100644 index 81e9b943c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. - - -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export const a = 1; -==== index.ts (1 errors) ==== - // esm format file - import mod from "./subfolder/index.js"; - ~~~ -!!! error TS1192: Module '"subfolder/index"' has no default export. - mod; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt.diff deleted file mode 100644 index 97d3b4787a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. -+ -+ -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ export const a = 1; -+==== index.ts (1 errors) ==== -+ // esm format file -+ import mod from "./subfolder/index.js"; -+ ~~~ -+!!! error TS1192: Module '"subfolder/index"' has no default export. -+ mod; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types index ff082de1b8..906754ee99 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types @@ -9,8 +9,8 @@ export const a = 1; === index.ts === // esm format file import mod from "./subfolder/index.js"; ->mod : any +>mod : typeof mod mod; ->mod : any +>mod : typeof mod diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types.diff deleted file mode 100644 index d75b983437..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types -@@= skipped -8, +8 lines =@@ - === index.ts === - // esm format file - import mod from "./subfolder/index.js"; -->mod : typeof mod -+>mod : any - - mod; -->mod : typeof mod -+>mod : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt deleted file mode 100644 index 81e9b943c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt +++ /dev/null @@ -1,22 +0,0 @@ -index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. - - -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export const a = 1; -==== index.ts (1 errors) ==== - // esm format file - import mod from "./subfolder/index.js"; - ~~~ -!!! error TS1192: Module '"subfolder/index"' has no default export. - mod; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt.diff deleted file mode 100644 index 63b3bce539..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. -+ -+ -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ export const a = 1; -+==== index.ts (1 errors) ==== -+ // esm format file -+ import mod from "./subfolder/index.js"; -+ ~~~ -+!!! error TS1192: Module '"subfolder/index"' has no default export. -+ mod; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types index ff082de1b8..906754ee99 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types @@ -9,8 +9,8 @@ export const a = 1; === index.ts === // esm format file import mod from "./subfolder/index.js"; ->mod : any +>mod : typeof mod mod; ->mod : any +>mod : typeof mod diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types.diff deleted file mode 100644 index 87a6bfea99..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=nodenext).types -@@= skipped -8, +8 lines =@@ - === index.ts === - // esm format file - import mod from "./subfolder/index.js"; -->mod : typeof mod -+>mod : any - - mod; -->mod : typeof mod -+>mod : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt index d3d7cff04b..5ef737bc87 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,3 +1,5 @@ +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.cts(11,21): error TS2307: Cannot find module 'inner/types' or its corresponding type declarations. @@ -68,11 +70,15 @@ node_modules/inner/index.d.ts(5,21): error TS2307: Cannot find module 'inner/typ ~~~~~~~~~ !!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (5 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff index bf100b9434..de1e074d89 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff @@ -2,8 +2,8 @@ +++ new.nodeModulesConditionalPackageExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - @@ -112,16 +112,11 @@ + ~~~~~~~~~ +!!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. + ts.mjsSource; -+==== index.cts (3 errors) ==== ++==== index.cts (5 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - cjs; +@@= skipped -50, +82 lines =@@ mjs; type; import * as cjsi from "inner/a"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt index 5ef737bc87..d3d7cff04b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt @@ -1,5 +1,3 @@ -index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.cts(11,21): error TS2307: Cannot find module 'inner/types' or its corresponding type declarations. @@ -70,15 +68,11 @@ node_modules/inner/index.d.ts(5,21): error TS2307: Cannot find module 'inner/typ ~~~~~~~~~ !!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. ts.mjsSource; -==== index.cts (5 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; - ~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff index 7fb12ec327..193111b08f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff @@ -40,8 +40,6 @@ - typei.mjsSource; - ts.mjsSource; -==== index.cts (0 errors) ==== -+index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. +index.cts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. +index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +index.cts(11,21): error TS2307: Cannot find module 'inner/types' or its corresponding type declarations. @@ -112,16 +110,11 @@ + ~~~~~~~~~ +!!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. + ts.mjsSource; -+==== index.cts (5 errors) ==== ++==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - cjs; +@@= skipped -44, +76 lines =@@ mjs; type; import * as cjsi from "inner/a"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt deleted file mode 100644 index 534056af01..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt +++ /dev/null @@ -1,181 +0,0 @@ -error TS2468: Cannot find global value 'Promise'. -other.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(4,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -other.cts(5,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.cts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.cts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (0 errors) ==== - // esm format file - export {}; -==== index.mts (0 errors) ==== - // esm format file - export {}; -==== index.cts (0 errors) ==== - // cjs format file - export {}; -==== other.ts (9 errors) ==== - // esm format file - export const a = await import("package/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = await import("package/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = await import("package"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = await import("inner"); - ~ -!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.ts (6 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~ -!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = await import("inner/mjs"); - ~ -!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.mts (8 errors) ==== - // esm format file - export const a = await import("package/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = await import("package/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = await import("package"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = await import("inner"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.mts (4 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = await import("inner/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.cts (5 errors) ==== - // cjs format file, no TLA - export const a = import("package/cjs"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = import("package/mjs"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = import("package"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = import("inner"); - ~ -!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.cts (4 errors) ==== - // cjs format file, no TLA - export const d = import("inner/cjs"); - ~ -!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = import("inner/mjs"); - ~ -!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const cjsMain = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const esm = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const cjsNonmain = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 228292c66b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,185 +0,0 @@ ---- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt -+++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS2468: Cannot find global value 'Promise'. -+other.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(4,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -+other.cts(5,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -+other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.cts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.cts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.ts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.ts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ export {}; -+==== index.mts (0 errors) ==== -+ // esm format file -+ export {}; -+==== index.cts (0 errors) ==== -+ // cjs format file -+ export {}; -+==== other.ts (9 errors) ==== -+ // esm format file -+ export const a = await import("package/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = await import("package/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = await import("package"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = await import("inner"); -+ ~ -+!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.ts (6 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~ -+!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = await import("inner/mjs"); -+ ~ -+!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.mts (8 errors) ==== -+ // esm format file -+ export const a = await import("package/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = await import("package/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = await import("package"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = await import("inner"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.mts (4 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = await import("inner/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.cts (5 errors) ==== -+ // cjs format file, no TLA -+ export const a = import("package/cjs"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = import("package/mjs"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = import("package"); -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = import("inner"); -+ ~ -+!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.cts (4 errors) ==== -+ // cjs format file, no TLA -+ export const d = import("inner/cjs"); -+ ~ -+!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = import("inner/mjs"); -+ ~ -+!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== node_modules/inner/index.d.ts (0 errors) ==== -+ // cjs format file -+ export const cjsMain = true; -+==== node_modules/inner/index.d.mts (0 errors) ==== -+ // esm format file -+ export const esm = true; -+==== node_modules/inner/index.d.cts (0 errors) ==== -+ // cjs format file -+ export const cjsNonmain = true; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": { -+ "./cjs": "./index.cjs", -+ "./mjs": "./index.mjs", -+ ".": "./index.js" -+ } -+ } -+==== node_modules/inner/package.json (0 errors) ==== -+ { -+ "name": "inner", -+ "private": true, -+ "exports": { -+ "./cjs": "./index.cjs", -+ "./mjs": "./index.mjs", -+ ".": "./index.js" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js index 09d59ac0ff..b35036b2c0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js @@ -140,40 +140,31 @@ export {}; export {}; //// [other.d.ts] // esm format file -export declare const a: typeof import("./index.cts"); -export declare const b: typeof import("./index.mts"); -export declare const c: typeof import("."); -export declare const f: any; +export declare const a: typeof import("package/cjs"); +export declare const b: typeof import("package/mjs"); +export declare const c: typeof import("package"); +export declare const f: typeof import("inner"); //// [other2.d.ts] // esm format file -export declare const d: any; -export declare const e: any; +export declare const d: typeof import("inner/cjs"); +export declare const e: typeof import("inner/mjs"); //// [other.d.mts] // esm format file export declare const a: typeof import("package/cjs"); export declare const b: typeof import("package/mjs"); export declare const c: typeof import("package"); -export declare const f: { - cjsMain: true; - default: typeof import("inner"); -}; +export declare const f: typeof import("inner"); //// [other2.d.mts] // esm format file -export declare const d: { - cjsNonmain: true; - default: typeof import("inner/cjs"); -}; -export declare const e: { - esm: true; - default: typeof import("inner/mjs"); -}; +export declare const d: typeof import("inner/cjs"); +export declare const e: typeof import("inner/mjs"); //// [other.d.cts] // cjs format file, no TLA export declare const a: Promise; -export declare const b: Promise; -export declare const c: Promise; -export declare const f: any; +export declare const b: Promise; +export declare const c: Promise; +export declare const f: Promise; //// [other2.d.cts] // cjs format file, no TLA -export declare const d: any; -export declare const e: any; +export declare const d: Promise; +export declare const e: Promise; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff index 966545ee2e..9f7c2629bf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff @@ -77,26 +77,23 @@ -export declare const a: { - default: typeof import("package/cjs"); -}; --export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); ++// esm format file ++export declare const a: typeof import("package/cjs"); + export declare const b: typeof import("package/mjs"); + export declare const c: typeof import("package"); -export declare const f: { - cjsMain: true; - default: typeof import("inner"); -}; -+// esm format file -+export declare const a: typeof import("./index.cts"); -+export declare const b: typeof import("./index.mts"); -+export declare const c: typeof import("."); -+export declare const f: any; ++export declare const f: typeof import("inner"); //// [other2.d.ts] -export declare const d: { - cjsNonmain: true; - default: typeof import("inner/cjs"); -}; --export declare const e: typeof import("inner/mjs"); +// esm format file -+export declare const d: any; -+export declare const e: any; ++export declare const d: typeof import("inner/cjs"); + export declare const e: typeof import("inner/mjs"); //// [other.d.mts] -export declare const a: { - default: typeof import("package/cjs"); @@ -105,42 +102,37 @@ +export declare const a: typeof import("package/cjs"); export declare const b: typeof import("package/mjs"); export declare const c: typeof import("package"); - export declare const f: { -@@= skipped -32, +28 lines =@@ - default: typeof import("inner"); - }; +-export declare const f: { +- cjsMain: true; +- default: typeof import("inner"); +-}; ++export declare const f: typeof import("inner"); //// [other2.d.mts] +-export declare const d: { +- cjsNonmain: true; +- default: typeof import("inner/cjs"); +-}; +// esm format file - export declare const d: { - cjsNonmain: true; - default: typeof import("inner/cjs"); - }; --export declare const e: typeof import("inner/mjs"); -+export declare const e: { -+ esm: true; -+ default: typeof import("inner/mjs"); -+}; ++export declare const d: typeof import("inner/cjs"); + export declare const e: typeof import("inner/mjs"); //// [other.d.cts] -export declare const a: Promise<{ - default: typeof import("./index.cjs"); -}>; --export declare const b: Promise; --export declare const c: Promise; ++// cjs format file, no TLA ++export declare const a: Promise; + export declare const b: Promise; + export declare const c: Promise; -export declare const f: Promise<{ - cjsMain: true; - default: typeof import("inner"); -}>; -+// cjs format file, no TLA -+export declare const a: Promise; -+export declare const b: Promise; -+export declare const c: Promise; -+export declare const f: any; ++export declare const f: Promise; //// [other2.d.cts] -export declare const d: Promise<{ - cjsNonmain: true; - default: typeof import("inner/cjs"); -}>; --export declare const e: Promise; +// cjs format file, no TLA -+export declare const d: any; -+export declare const e: any; \ No newline at end of file ++export declare const d: Promise; + export declare const e: Promise; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types index 6886f9c9a1..ffe5cad9e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types @@ -15,41 +15,41 @@ export {}; === other.ts === // esm format file export const a = await import("package/cjs"); ->a : typeof import("./index.cts") ->await import("package/cjs") : typeof import("./index.cts") ->import("package/cjs") : Promise +>a : typeof import("package/cjs") +>await import("package/cjs") : typeof import("package/cjs") +>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("./index.mts") ->await import("package/mjs") : typeof import("./index.mts") ->import("package/mjs") : Promise +>b : typeof import("package/mjs") +>await import("package/mjs") : typeof import("package/mjs") +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import(".") ->await import("package") : typeof import(".") ->import("package") : Promise +>c : typeof import("package") +>await import("package") : typeof import("package") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("./node_modules/inner"); } ->await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner"); }> +>f : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" === other2.ts === // esm format file export const d = await import("inner/cjs"); ->d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> +>d : typeof import("inner/cjs") +>await import("inner/cjs") : typeof import("inner/cjs") +>import("inner/cjs") : Promise >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> +>e : typeof import("inner/mjs") +>await import("inner/mjs") : typeof import("inner/mjs") +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.mts === @@ -73,23 +73,23 @@ export const c = await import("package"); >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("inner"); } ->await import("inner") : { cjsMain: true; default: typeof import("inner"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> +>f : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" === other2.mts === // esm format file export const d = await import("inner/cjs"); ->d : { cjsNonmain: true; default: typeof import("inner/cjs"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> +>d : typeof import("inner/cjs") +>await import("inner/cjs") : typeof import("inner/cjs") +>import("inner/cjs") : Promise >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("inner/mjs"); } ->await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> +>e : typeof import("inner/mjs") +>await import("inner/mjs") : typeof import("inner/mjs") +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.cts === @@ -100,30 +100,30 @@ export const a = import("package/cjs"); >"package/cjs" : "package/cjs" export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise +>b : Promise +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise ->import("package") : Promise +>c : Promise +>import("package") : Promise >"package" : "package" export const f = import("inner"); ->f : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner"); }> ->import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner"); }> +>f : Promise +>import("inner") : Promise >"inner" : "inner" === other2.cts === // cjs format file, no TLA export const d = import("inner/cjs"); ->d : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> +>d : Promise +>import("inner/cjs") : Promise >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> +>e : Promise +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff index 7b1cf0387b..68527e9a16 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff @@ -7,36 +7,36 @@ ->a : { default: typeof import("index"); } ->await import("package/cjs") : { default: typeof import("index"); } ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : typeof import("./index.cts") -+>await import("package/cjs") : typeof import("./index.cts") -+>import("package/cjs") : Promise ++>a : typeof import("package/cjs") ++>await import("package/cjs") : typeof import("package/cjs") ++>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("index") ->await import("package/mjs") : typeof import("index") ->import("package/mjs") : Promise -+>b : typeof import("./index.mts") -+>await import("package/mjs") : typeof import("./index.mts") -+>import("package/mjs") : Promise ++>b : typeof import("package/mjs") ++>await import("package/mjs") : typeof import("package/mjs") ++>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("index") ->await import("package") : typeof import("index") ->import("package") : Promise -+>c : typeof import(".") -+>await import("package") : typeof import(".") -+>import("package") : Promise ++>c : typeof import("package") ++>await import("package") : typeof import("package") ++>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner") : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> -+>f : { cjsMain: true; default: typeof import("./node_modules/inner"); } -+>await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner"); } -+>import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner"); }> ++>f : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" === other2.ts === @@ -45,18 +45,18 @@ ->d : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> -+>d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> ++>d : typeof import("inner/cjs") ++>await import("inner/cjs") : typeof import("inner/cjs") ++>import("inner/cjs") : Promise >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> ++>e : typeof import("inner/mjs") ++>await import("inner/mjs") : typeof import("inner/mjs") ++>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.mts === @@ -92,9 +92,9 @@ ->f : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner") : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> -+>f : { cjsMain: true; default: typeof import("inner"); } -+>await import("inner") : { cjsMain: true; default: typeof import("inner"); } -+>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> ++>f : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" === other2.mts === @@ -103,18 +103,18 @@ ->d : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> -+>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } -+>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } -+>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> ++>d : typeof import("inner/cjs") ++>await import("inner/cjs") : typeof import("inner/cjs") ++>import("inner/cjs") : Promise >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("inner/mjs"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> ++>e : typeof import("inner/mjs") ++>await import("inner/mjs") : typeof import("inner/mjs") ++>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.cts === @@ -129,22 +129,22 @@ export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise -+>b : Promise -+>import("package/mjs") : Promise ++>b : Promise ++>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise ->import("package") : Promise -+>c : Promise -+>import("package") : Promise ++>c : Promise ++>import("package") : Promise >"package" : "package" export const f = import("inner"); ->f : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> ->import("inner") : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> -+>f : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner"); }> -+>import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner"); }> ++>f : Promise ++>import("inner") : Promise >"inner" : "inner" === other2.cts === @@ -152,15 +152,15 @@ export const d = import("inner/cjs"); ->d : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> -+>d : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> -+>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> ++>d : Promise ++>import("inner/cjs") : Promise >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise -+>e : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> ++>e : Promise ++>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js index 39cd09d224..4f9573ac89 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js @@ -126,7 +126,9 @@ export {}; export {}; //// [other.d.ts] // esm format file -export declare const a: typeof import("package/cjs"); +export declare const a: { + default: typeof import("package/cjs"); +}; export declare const b: typeof import("package/mjs"); export declare const c: typeof import("package"); export declare const f: { @@ -139,13 +141,12 @@ export declare const d: { cjsNonmain: true; default: typeof import("inner/cjs"); }; -export declare const e: { - esm: true; - default: typeof import("inner/mjs"); -}; +export declare const e: typeof import("inner/mjs"); //// [other.d.mts] // esm format file -export declare const a: typeof import("package/cjs"); +export declare const a: { + default: typeof import("package/cjs"); +}; export declare const b: typeof import("package/mjs"); export declare const c: typeof import("package"); export declare const f: { @@ -158,13 +159,12 @@ export declare const d: { cjsNonmain: true; default: typeof import("inner/cjs"); }; -export declare const e: { - esm: true; - default: typeof import("inner/mjs"); -}; +export declare const e: typeof import("inner/mjs"); //// [other.d.cts] // cjs format file, no TLA -export declare const a: Promise; +export declare const a: Promise<{ + default: typeof import("./index.cts"); +}>; export declare const b: Promise; export declare const c: Promise; export declare const f: Promise<{ @@ -177,7 +177,4 @@ export declare const d: Promise<{ cjsNonmain: true; default: typeof import("inner/cjs", { with: { "resolution-mode": "import" } }); }>; -export declare const e: Promise<{ - esm: true; - default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); -}>; +export declare const e: Promise; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff index 503f662b26..78039388dd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff @@ -13,15 +13,11 @@ +// cjs format file export {}; //// [other.d.ts] --export declare const a: { -- default: typeof import("package/cjs"); --}; +// esm format file -+export declare const a: typeof import("package/cjs"); - export declare const b: typeof import("package/mjs"); - export declare const c: typeof import("package"); - export declare const f: { -@@= skipped -16, +18 lines =@@ + export declare const a: { + default: typeof import("package/cjs"); + }; +@@= skipped -16, +20 lines =@@ default: typeof import("inner"); }; //// [other2.d.ts] @@ -30,21 +26,13 @@ cjsNonmain: true; default: typeof import("inner/cjs"); }; --export declare const e: typeof import("inner/mjs"); -+export declare const e: { -+ esm: true; -+ default: typeof import("inner/mjs"); -+}; + export declare const e: typeof import("inner/mjs"); //// [other.d.mts] --export declare const a: { -- default: typeof import("package/cjs"); --}; +// esm format file -+export declare const a: typeof import("package/cjs"); - export declare const b: typeof import("package/mjs"); - export declare const c: typeof import("package"); - export declare const f: { -@@= skipped -16, +19 lines =@@ + export declare const a: { + default: typeof import("package/cjs"); + }; +@@= skipped -16, +18 lines =@@ default: typeof import("inner"); }; //// [other2.d.mts] @@ -53,17 +41,13 @@ cjsNonmain: true; default: typeof import("inner/cjs"); }; --export declare const e: typeof import("inner/mjs"); -+export declare const e: { -+ esm: true; -+ default: typeof import("inner/mjs"); -+}; + export declare const e: typeof import("inner/mjs"); //// [other.d.cts] --export declare const a: Promise<{ -- default: typeof import("./index.cjs"); --}>; +// cjs format file, no TLA -+export declare const a: Promise; + export declare const a: Promise<{ +- default: typeof import("./index.cjs"); ++ default: typeof import("./index.cts"); + }>; export declare const b: Promise; export declare const c: Promise; export declare const f: Promise<{ @@ -76,11 +60,6 @@ export declare const d: Promise<{ cjsNonmain: true; - default: typeof import("inner/cjs"); --}>; --export declare const e: Promise; + default: typeof import("inner/cjs", { with: { "resolution-mode": "import" } }); -+}>; -+export declare const e: Promise<{ -+ esm: true; -+ default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); -+}>; \ No newline at end of file + }>; + export declare const e: Promise; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types index 56f8a5fe7f..c0b718f5e0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types @@ -15,9 +15,9 @@ export {}; === other.ts === // esm format file export const a = await import("package/cjs"); ->a : typeof import("package/cjs") ->await import("package/cjs") : typeof import("package/cjs") ->import("package/cjs") : Promise +>a : { default: typeof import("package/cjs"); } +>await import("package/cjs") : { default: typeof import("package/cjs"); } +>import("package/cjs") : Promise<{ default: typeof import("package/cjs"); }> >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); @@ -47,17 +47,17 @@ export const d = await import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("inner/mjs"); } ->await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> +>e : typeof import("inner/mjs") +>await import("inner/mjs") : typeof import("inner/mjs") +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.mts === // esm format file export const a = await import("package/cjs"); ->a : typeof import("package/cjs") ->await import("package/cjs") : typeof import("package/cjs") ->import("package/cjs") : Promise +>a : { default: typeof import("package/cjs"); } +>await import("package/cjs") : { default: typeof import("package/cjs"); } +>import("package/cjs") : Promise<{ default: typeof import("package/cjs"); }> >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); @@ -87,16 +87,16 @@ export const d = await import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("inner/mjs"); } ->await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> +>e : typeof import("inner/mjs") +>await import("inner/mjs") : typeof import("inner/mjs") +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.cts === // cjs format file, no TLA export const a = import("package/cjs"); ->a : Promise ->import("package/cjs") : Promise +>a : Promise<{ default: typeof import("./index.cts"); }> +>import("package/cjs") : Promise<{ default: typeof import("./index.cts"); }> >"package/cjs" : "package/cjs" export const b = import("package/mjs"); @@ -122,8 +122,8 @@ export const d = import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> +>e : Promise +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff index 4ad77fd641..20b3ea6284 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff @@ -7,9 +7,9 @@ ->a : { default: typeof import("index"); } ->await import("package/cjs") : { default: typeof import("index"); } ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : typeof import("package/cjs") -+>await import("package/cjs") : typeof import("package/cjs") -+>import("package/cjs") : Promise ++>a : { default: typeof import("package/cjs"); } ++>await import("package/cjs") : { default: typeof import("package/cjs"); } ++>import("package/cjs") : Promise<{ default: typeof import("package/cjs"); }> >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); @@ -54,9 +54,9 @@ ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("inner/mjs"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> ++>e : typeof import("inner/mjs") ++>await import("inner/mjs") : typeof import("inner/mjs") ++>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.mts === @@ -65,9 +65,9 @@ ->a : { default: typeof import("index"); } ->await import("package/cjs") : { default: typeof import("index"); } ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : typeof import("package/cjs") -+>await import("package/cjs") : typeof import("package/cjs") -+>import("package/cjs") : Promise ++>a : { default: typeof import("package/cjs"); } ++>await import("package/cjs") : { default: typeof import("package/cjs"); } ++>import("package/cjs") : Promise<{ default: typeof import("package/cjs"); }> >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); @@ -112,9 +112,9 @@ ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("inner/mjs"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> ++>e : typeof import("inner/mjs") ++>await import("inner/mjs") : typeof import("inner/mjs") ++>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === other.cts === @@ -122,8 +122,8 @@ export const a = import("package/cjs"); ->a : Promise<{ default: typeof import("index"); }> ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : Promise -+>import("package/cjs") : Promise ++>a : Promise<{ default: typeof import("./index.cts"); }> ++>import("package/cjs") : Promise<{ default: typeof import("./index.cts"); }> >"package/cjs" : "package/cjs" export const b = import("package/mjs"); @@ -159,8 +159,8 @@ export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise -+>e : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> ++>e : Promise ++>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt index ee951d981a..f82891bb16 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt @@ -1,5 +1,10 @@ +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. +index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. node_modules/inner/index.d.cts(5,1): error TS1036: Statements are not allowed in ambient contexts. node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. @@ -31,24 +36,32 @@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in export const d = cjsi; export const e = mjsi; export const f = typei; -==== index.cts (0 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. export const a = cjs; export const b = mjs; export const c = type; import * as cjsi from "inner/cjs"; import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. import * as typei from "inner"; export const d = cjsi; export const e = mjsi; export const f = typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. import * as type from "inner"; cjs; ~~~ @@ -67,10 +80,12 @@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in mjs; type; export const esm = true; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. import * as type from "inner"; cjs; ~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt.diff index fb109992c6..fe5127f4e7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt.diff @@ -2,66 +2,14 @@ +++ new.nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - node_modules/inner/index.d.cts(5,1): error TS1036: Statements are not allowed in ambient contexts. - node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +@@= skipped -8, +7 lines =@@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.ts (0 errors) ==== // esm format file - import * as cjs from "package/cjs"; -@@= skipped -37, +30 lines =@@ - export const d = cjsi; - export const e = mjsi; - export const f = typei; --==== index.cts (3 errors) ==== -+==== index.cts (0 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - import * as mjs from "package/mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - export const a = cjs; - export const b = mjs; - export const c = type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as typei from "inner"; - export const d = cjsi; - export const e = mjsi; - export const f = typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - cjs; - ~~~ -@@= skipped -44, +36 lines =@@ - mjs; - type; - export const esm = true; --==== node_modules/inner/index.d.cts (2 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - cjs; - ~~~ \ No newline at end of file + import * as cjs from "package/cjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt index f82891bb16..ee951d981a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt @@ -1,10 +1,5 @@ -index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. node_modules/inner/index.d.cts(5,1): error TS1036: Statements are not allowed in ambient contexts. node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. @@ -36,32 +31,24 @@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in export const d = cjsi; export const e = mjsi; export const f = typei; -==== index.cts (3 errors) ==== +==== index.cts (0 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; - ~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. export const a = cjs; export const b = mjs; export const c = type; import * as cjsi from "inner/cjs"; import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. import * as typei from "inner"; export const d = cjsi; export const e = mjsi; export const f = typei; -==== node_modules/inner/index.d.ts (2 errors) ==== +==== node_modules/inner/index.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. import * as type from "inner"; cjs; ~~~ @@ -80,12 +67,10 @@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in mjs; type; export const esm = true; -==== node_modules/inner/index.d.cts (2 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. import * as type from "inner"; cjs; ~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt.diff index 42efc71e2b..aacb51049e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt.diff @@ -2,66 +2,12 @@ +++ new.nodeModulesDeclarationEmitWithPackageExports(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -+index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. node_modules/inner/index.d.cts(5,1): error TS1036: Statements are not allowed in ambient contexts. node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.ts (0 errors) ==== // esm format file - import * as cjs from "package/cjs"; -@@= skipped -32, +35 lines =@@ - export const d = cjsi; - export const e = mjsi; - export const f = typei; --==== index.cts (0 errors) ==== -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - export const a = cjs; - export const b = mjs; - export const c = type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as typei from "inner"; - export const d = cjsi; - export const e = mjsi; - export const f = typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - cjs; - ~~~ -@@= skipped -36, +44 lines =@@ - mjs; - type; - export const esm = true; --==== node_modules/inner/index.d.cts (1 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - cjs; - ~~~ \ No newline at end of file + import * as cjs from "package/cjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node18).errors.txt deleted file mode 100644 index 042a4981be..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node18).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS2468: Cannot find global value 'Promise'. -index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.ts (1 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== index.ts (1 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node18).errors.txt.diff deleted file mode 100644 index 10d7baab56..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node18).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesDynamicImport(module=node18).errors.txt -+++ new.nodeModulesDynamicImport(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS2468: Cannot find global value 'Promise'. -+index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.ts (1 errors) ==== -+ // cjs format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== index.ts (1 errors) ==== -+ // esm format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node18).errors.txt new file mode 100644 index 0000000000..edb49c7a61 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node18).errors.txt @@ -0,0 +1,23 @@ +index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + + +==== subfolder/index.ts (0 errors) ==== + // cjs format file + const a = {}; + export = a; +==== index.ts (1 errors) ==== + // esm format file + const a = {}; + export = 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", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node18).errors.txt.diff deleted file mode 100644 index 75ee808623..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node18).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodeModulesExportAssignments(module=node18).errors.txt -+++ new.nodeModulesExportAssignments(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -- -- --==== subfolder/index.ts (0 errors) ==== -- // cjs format file -- const a = {}; -- export = a; --==== index.ts (1 errors) ==== -- // esm format file -- const a = {}; -- export = 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", -- "private": true, -- "type": "module" -- } --==== subfolder/package.json (0 errors) ==== -- { -- "type": "commonjs" -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types index 76e9254e94..94a25e7b28 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff index f662049978..451442e5be 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt index 36793ad238..7e86097227 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt @@ -1,23 +1,15 @@ -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt.diff deleted file mode 100644 index 48706f944c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt -+++ new.nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. --index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -- -- --==== index.ts (2 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner")).x(); - ~ --!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types index d59b1d2229..94a25e7b28 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types @@ -6,14 +6,14 @@ import { Thing } from "inner/other"; >Thing : any export const a = (await import("inner")).x(); ->a : import("./node_modules/inner/other").Thing ->(await import("inner")).x() : import("./node_modules/inner/other").Thing ->(await import("inner")).x : () => import("./node_modules/inner/other").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" ->x : () => import("./node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types.diff index 5c47cf5f7d..dabd7849c0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node18).types.diff @@ -10,15 +10,15 @@ ->(await import("inner")) : typeof import("node_modules/inner/index") ->await import("inner") : typeof import("node_modules/inner/index") ->import("inner") : Promise -+>a : import("./node_modules/inner/other").Thing -+>(await import("inner")).x() : import("./node_modules/inner/other").Thing -+>(await import("inner")).x : () => import("./node_modules/inner/other").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> ++>a : import("./node_modules/inner/other.js").Thing ++>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing ++>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing -+>x : () => import("./node_modules/inner/other").Thing ++>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types index 76e9254e94..94a25e7b28 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff index d1f71c8196..3b3058b23c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt index 06558ee7f8..358a0e6143 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt @@ -1,23 +1,15 @@ -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. import {a as a2} from "package"; ==== node_modules/inner/index.ts (0 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt.diff deleted file mode 100644 index 440461dfe0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeModulesExportsSourceTs(module=node18).errors.txt -+++ new.nodeModulesExportsSourceTs(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. --index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -- -- --==== index.ts (2 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner")).x(); - ~ --!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - import {a as a2} from "package"; - ==== node_modules/inner/index.ts (0 errors) ==== - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types index a290bfc193..31a1c001b4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types @@ -6,18 +6,18 @@ import { Thing } from "inner/other"; >Thing : any export const a = (await import("inner")).x(); ->a : import("./node_modules/inner/other").Thing ->(await import("inner")).x() : import("./node_modules/inner/other").Thing ->(await import("inner")).x : () => import("./node_modules/inner/other").Thing ->(await import("inner")) : typeof import("./node_modules/inner") ->await import("inner") : typeof import("./node_modules/inner") ->import("inner") : Promise +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" ->x : () => import("./node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing import {a as a2} from "package"; ->a : import("./node_modules/inner/other").Thing ->a2 : import("./node_modules/inner/other").Thing +>a : import("./node_modules/inner/other.js").Thing +>a2 : import("./node_modules/inner/other.js").Thing === node_modules/inner/index.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types.diff index 5adb76c0d5..2c9f98fc96 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node18).types.diff @@ -10,21 +10,21 @@ ->(await import("inner")) : typeof import("node_modules/inner/index") ->await import("inner") : typeof import("node_modules/inner/index") ->import("inner") : Promise -+>a : import("./node_modules/inner/other").Thing -+>(await import("inner")).x() : import("./node_modules/inner/other").Thing -+>(await import("inner")).x : () => import("./node_modules/inner/other").Thing -+>(await import("inner")) : typeof import("./node_modules/inner") -+>await import("inner") : typeof import("./node_modules/inner") -+>import("inner") : Promise ++>a : import("./node_modules/inner/other.js").Thing ++>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing ++>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing -+>x : () => import("./node_modules/inner/other").Thing ++>x : () => import("./node_modules/inner/other.js").Thing import {a as a2} from "package"; ->a : import("node_modules/inner/other").Thing ->a2 : import("node_modules/inner/other").Thing -+>a : import("./node_modules/inner/other").Thing -+>a2 : import("./node_modules/inner/other").Thing ++>a : import("./node_modules/inner/other.js").Thing ++>a2 : import("./node_modules/inner/other.js").Thing === node_modules/inner/index.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types index 5b44029f91..42a647a83d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff index 9994082a99..46710ccfde 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt index 6f42511f4d..371eb946e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt @@ -1,23 +1,15 @@ -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other.js"; // should fail ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt.diff index f8fad9a96b..99914993e3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt.diff @@ -1,29 +1,21 @@ --- old.nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt +++ new.nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. - - -==== index.ts (1 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. + + -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== ++==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other.js"; // should fail ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); + ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types index 8bebd986fc..42a647a83d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types @@ -6,14 +6,14 @@ import { Thing } from "inner/other.js"; // should fail >Thing : any export const a = (await import("inner")).x(); ->a : import("./node_modules/inner/other").Thing ->(await import("inner")).x() : import("./node_modules/inner/other").Thing ->(await import("inner")).x : () => import("./node_modules/inner/other").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" ->x : () => import("./node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types.diff index ff0f00977d..791f4a20d6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node18).types.diff @@ -10,15 +10,15 @@ ->(await import("inner")) : typeof import("node_modules/inner/index") ->await import("inner") : typeof import("node_modules/inner/index") ->import("inner") : Promise -+>a : import("./node_modules/inner/other").Thing -+>(await import("inner")).x() : import("./node_modules/inner/other").Thing -+>(await import("inner")).x : () => import("./node_modules/inner/other").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> ++>a : import("./node_modules/inner/other.js").Thing ++>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing ++>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing -+>x : () => import("./node_modules/inner/other").Thing ++>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types index 5b44029f91..42a647a83d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff index f0a0c34685..1908dce05f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types index 33d1174764..3e242f9d4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> +>(await import("inner/index.js")) : typeof import("inner/index.js") +>await import("inner/index.js") : typeof import("inner/index.js") +>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff index 715a27d419..1b8375ffda 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> ++>(await import("inner/index.js")) : typeof import("inner/index.js") ++>await import("inner/index.js") : typeof import("inner/index.js") ++>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt index 2cb2b49faa..cef716eae2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt @@ -1,23 +1,15 @@ -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt.diff index ce226d12cd..e42dbe106d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt.diff @@ -1,29 +1,21 @@ --- old.nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt +++ new.nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - - -==== index.ts (1 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. + + -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== ++==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); + ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types index 19f6656baf..3e242f9d4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types @@ -6,14 +6,14 @@ import { Thing } from "inner/other"; >Thing : any export const a = (await import("inner/index.js")).x(); ->a : import("./node_modules/inner/other").Thing ->(await import("inner/index.js")).x() : import("./node_modules/inner/other").Thing ->(await import("inner/index.js")).x : () => import("./node_modules/inner/other").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")) : typeof import("inner/index.js") +>await import("inner/index.js") : typeof import("inner/index.js") +>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("./node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types.diff index 9cdc2554e3..ff29cf84df 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types.diff @@ -10,15 +10,15 @@ ->(await import("inner/index.js")) : typeof import("node_modules/inner/index") ->await import("inner/index.js") : typeof import("node_modules/inner/index") ->import("inner/index.js") : Promise -+>a : import("./node_modules/inner/other").Thing -+>(await import("inner/index.js")).x() : import("./node_modules/inner/other").Thing -+>(await import("inner/index.js")).x : () => import("./node_modules/inner/other").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> ++>a : import("./node_modules/inner/other.js").Thing ++>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing ++>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ++>(await import("inner/index.js")) : typeof import("inner/index.js") ++>await import("inner/index.js") : typeof import("inner/index.js") ++>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing -+>x : () => import("./node_modules/inner/other").Thing ++>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types index 33d1174764..3e242f9d4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> +>(await import("inner/index.js")) : typeof import("inner/index.js") +>await import("inner/index.js") : typeof import("inner/index.js") +>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff index a83a840bf5..241ffa1252 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> ++>(await import("inner/index.js")) : typeof import("inner/index.js") ++>await import("inner/index.js") : typeof import("inner/index.js") ++>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types index 69f3818ed7..ee7faef3f9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> +>(await import("inner/index.js")) : typeof import("inner/index.js") +>await import("inner/index.js") : typeof import("inner/index.js") +>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff index 1b1ecd439e..62ca47170f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> ++>(await import("inner/index.js")) : typeof import("inner/index.js") ++>await import("inner/index.js") : typeof import("inner/index.js") ++>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt index ff0a187754..d524ddcfca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt @@ -1,23 +1,15 @@ -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt.diff index 7868e9119c..11a9c1e343 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt.diff @@ -1,29 +1,21 @@ --- old.nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt +++ new.nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - - -==== index.ts (1 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. + + -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== ++==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); + ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types index a5aabf2c50..ee7faef3f9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types @@ -6,14 +6,14 @@ import { Thing } from "inner/other"; >Thing : any export const a = (await import("inner/index.js")).x(); ->a : import("./node_modules/inner/other").Thing ->(await import("inner/index.js")).x() : import("./node_modules/inner/other").Thing ->(await import("inner/index.js")).x : () => import("./node_modules/inner/other").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")) : typeof import("inner/index.js") +>await import("inner/index.js") : typeof import("inner/index.js") +>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("./node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types.diff index dc8aa7dd26..6bf15a3cd8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node18).types.diff @@ -10,15 +10,15 @@ ->(await import("inner/index.js")) : typeof import("node_modules/inner/index") ->await import("inner/index.js") : typeof import("node_modules/inner/index") ->import("inner/index.js") : Promise -+>a : import("./node_modules/inner/other").Thing -+>(await import("inner/index.js")).x() : import("./node_modules/inner/other").Thing -+>(await import("inner/index.js")).x : () => import("./node_modules/inner/other").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other").Thing; default: typeof import("./node_modules/inner"); }> ++>a : import("./node_modules/inner/other.js").Thing ++>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing ++>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ++>(await import("inner/index.js")) : typeof import("inner/index.js") ++>await import("inner/index.js") : typeof import("inner/index.js") ++>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing -+>x : () => import("./node_modules/inner/other").Thing ++>x : () => import("./node_modules/inner/other.js").Thing === node_modules/inner/index.d.ts === // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types index 69f3818ed7..ee7faef3f9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> +>(await import("inner/index.js")) : typeof import("inner/index.js") +>await import("inner/index.js") : typeof import("inner/index.js") +>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff index d4f139adfd..fe236dcadc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> ++>(await import("inner/index.js")) : typeof import("inner/index.js") ++>await import("inner/index.js") : typeof import("inner/index.js") ++>import("inner/index.js") : Promise >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt index 382666d34e..cba5d90874 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt @@ -1,6 +1,3 @@ -index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. @@ -19,18 +16,12 @@ subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is res ~~~~~~~~~~ !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file function require() {} - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. const exports = {}; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} export const __esModule = false; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt.diff index 5846cc25fd..9e5199223b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node18).errors.txt.diff @@ -1,9 +1,6 @@ --- old.nodeModulesGeneratedNameCollisions(module=node18).errors.txt +++ new.nodeModulesGeneratedNameCollisions(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -+index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 with module Node18. @@ -15,7 +12,7 @@ // cjs format file function require() {} ~~~~~~~ -@@= skipped -12, +14 lines =@@ +@@= skipped -12, +11 lines =@@ ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} @@ -23,21 +20,4 @@ -!!! error TS2725: Class name cannot be 'Object' when targeting ES5 with module Node18. export const __esModule = false; ~~~~~~~~~~ - !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; --==== index.ts (0 errors) ==== -+==== index.ts (3 errors) ==== - // esm format file - function require() {} -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - const exports = {}; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - class Object {} - export const __esModule = false; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; - ==== package.json (0 errors) ==== - { \ No newline at end of file + !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types index 044c9fa189..0d5c792171 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types @@ -11,8 +11,8 @@ import json from "./package.json" assert { type: "json" }; // should error, cjs >type : any const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine ->json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> ->import("./package.json", { assert: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> >"./package.json" : "./package.json" >{ assert: { type: "json" } } : { assert: { type: string; }; } >assert : { type: string; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types.diff deleted file mode 100644 index e8e7898a6b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node16).types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportAssertions(module=node16).types -+++ new.nodeModulesImportAssertions(module=node16).types -@@= skipped -10, +10 lines =@@ - >type : any - - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine -->json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> -->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -+>json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> -+>import("./package.json", { assert: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> - >"./package.json" : "./package.json" - >{ assert: { type: "json" } } : { assert: { type: string; }; } - >assert : { type: string; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt index a39fd4c1df..dc5617cd1a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt @@ -1,22 +1,18 @@ -error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +otherc.cts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== otherc.cts (3 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions + ~~~~ +!!! error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +!!! related TS2594 package.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt.diff index 7fc1af860d..b79ffe993b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).errors.txt.diff @@ -1,31 +1,22 @@ --- old.nodeModulesImportAssertions(module=node18).errors.txt +++ new.nodeModulesImportAssertions(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -- -- --==== index.ts (0 errors) ==== -+error TS2468: Cannot find global value 'Promise'. -+index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++otherc.cts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag + otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (1 errors) ==== + + + ==== index.ts (0 errors) ==== import json from "./package.json" assert { type: "json" }; -==== otherc.cts (1 errors) ==== -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +==== otherc.cts (3 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ++ ~~~~ ++!!! error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag ++!!! related TS2594 package.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + !!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types index 044c9fa189..3572106eba 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types @@ -7,12 +7,12 @@ import json from "./package.json" assert { type: "json" }; === otherc.cts === import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ->json : { name: string; private: boolean; type: string; } +>json : any >type : any const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine ->json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> ->import("./package.json", { assert: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> >"./package.json" : "./package.json" >{ assert: { type: "json" } } : { assert: { type: string; }; } >assert : { type: string; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types.diff index 4aca2e240c..987f81c363 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node18).types.diff @@ -1,13 +1,11 @@ --- old.nodeModulesImportAssertions(module=node18).types +++ new.nodeModulesImportAssertions(module=node18).types -@@= skipped -10, +10 lines =@@ +@@= skipped -6, +6 lines =@@ + + === otherc.cts === + import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +->json : { name: string; private: boolean; type: string; } ++>json : any >type : any - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine -->json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> -->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -+>json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> -+>import("./package.json", { assert: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> - >"./package.json" : "./package.json" - >{ assert: { type: "json" } } : { assert: { type: string; }; } - >assert : { type: string; } \ No newline at end of file + const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt index 0ff770a77b..c1227dbbdf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt @@ -1,15 +1,15 @@ -index.ts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== otherc.cts (1 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt.diff index dddc9a608f..ae670eaf3b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).errors.txt.diff @@ -1,24 +1,16 @@ --- old.nodeModulesImportAssertions(module=nodenext).errors.txt +++ new.nodeModulesImportAssertions(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+index.ts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - +@@= skipped -3, +3 lines =@@ ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== otherc.cts (1 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine - ==== package.json (0 errors) ==== - { \ No newline at end of file + ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types index 044c9fa189..0d5c792171 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types @@ -11,8 +11,8 @@ import json from "./package.json" assert { type: "json" }; // should error, cjs >type : any const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine ->json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> ->import("./package.json", { assert: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> >"./package.json" : "./package.json" >{ assert: { type: "json" } } : { assert: { type: string; }; } >assert : { type: string; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types.diff deleted file mode 100644 index bb6c3118bc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=nodenext).types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportAssertions(module=nodenext).types -+++ new.nodeModulesImportAssertions(module=nodenext).types -@@= skipped -10, +10 lines =@@ - >type : any - - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine -->json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> -->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -+>json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> -+>import("./package.json", { assert: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> - >"./package.json" : "./package.json" - >{ assert: { type: "json" } } : { assert: { type: string; }; } - >assert : { type: string; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types index e3526d0a12..a6b4943e6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types @@ -11,8 +11,8 @@ import json from "./package.json" with { type: "json" }; // should error, cjs mo >type : any const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ->json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> ->import("./package.json", { with: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> >"./package.json" : "./package.json" >{ with: { type: "json" } } : { with: { type: string; }; } >with : { type: string; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types.diff deleted file mode 100644 index 64dd40992f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node16).types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportAttributes(module=node16).types -+++ new.nodeModulesImportAttributes(module=node16).types -@@= skipped -10, +10 lines =@@ - >type : any - - const json2 = import("./package.json", { with: { type: "json" } }); // should be fine -->json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> -->import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -+>json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> -+>import("./package.json", { with: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> - >"./package.json" : "./package.json" - >{ with: { type: "json" } } : { with: { type: string; }; } - >with : { type: string; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt index 3958ccdd8f..8d62b711ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt @@ -1,22 +1,18 @@ -error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -otherc.cts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +otherc.cts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== otherc.cts (3 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~ +!!! error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +!!! related TS2594 package.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt.diff index f175f08a7f..b84ac1b6a1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).errors.txt.diff @@ -1,31 +1,22 @@ --- old.nodeModulesImportAttributes(module=node18).errors.txt +++ new.nodeModulesImportAttributes(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -- -- --==== index.ts (0 errors) ==== -+error TS2468: Cannot find global value 'Promise'. -+index.ts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+otherc.cts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ++otherc.cts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag + otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (1 errors) ==== + + + ==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; -==== otherc.cts (1 errors) ==== -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +==== otherc.cts (3 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ++ ~~~~ ++!!! error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag ++!!! related TS2594 package.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types index e3526d0a12..73b67e357e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types @@ -7,12 +7,12 @@ import json from "./package.json" with { type: "json" }; === otherc.cts === import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ->json : { name: string; private: boolean; type: string; } +>json : any >type : any const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ->json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> ->import("./package.json", { with: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> >"./package.json" : "./package.json" >{ with: { type: "json" } } : { with: { type: string; }; } >with : { type: string; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types.diff index 2e0fde756a..acf54dc1f2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node18).types.diff @@ -1,13 +1,11 @@ --- old.nodeModulesImportAttributes(module=node18).types +++ new.nodeModulesImportAttributes(module=node18).types -@@= skipped -10, +10 lines =@@ +@@= skipped -6, +6 lines =@@ + + === otherc.cts === + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +->json : { name: string; private: boolean; type: string; } ++>json : any >type : any - const json2 = import("./package.json", { with: { type: "json" } }); // should be fine -->json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> -->import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -+>json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> -+>import("./package.json", { with: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> - >"./package.json" : "./package.json" - >{ with: { type: "json" } } : { with: { type: string; }; } - >with : { type: string; } \ No newline at end of file + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt index 3d986872d9..8f85517984 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt @@ -1,11 +1,8 @@ -index.ts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== otherc.cts (1 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt.diff deleted file mode 100644 index 43b00007a0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesImportAttributes(module=nodenext).errors.txt -+++ new.nodeModulesImportAttributes(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -+index.ts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - --==== index.ts (0 errors) ==== -+==== index.ts (1 errors) ==== - import json from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - ==== otherc.cts (1 errors) ==== - import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes - ~~~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types index e3526d0a12..a6b4943e6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types @@ -11,8 +11,8 @@ import json from "./package.json" with { type: "json" }; // should error, cjs mo >type : any const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ->json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> ->import("./package.json", { with: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> >"./package.json" : "./package.json" >{ with: { type: "json" } } : { with: { type: string; }; } >with : { type: string; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types.diff deleted file mode 100644 index c2969390a5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=nodenext).types.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportAttributes(module=nodenext).types -+++ new.nodeModulesImportAttributes(module=nodenext).types -@@= skipped -10, +10 lines =@@ - >type : any - - const json2 = import("./package.json", { with: { type: "json" } }); // should be fine -->json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> -->import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -+>json2 : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> -+>import("./package.json", { with: { type: "json" } }) : Promise<{ name: string; private: boolean; type: string; default: { name: string; private: boolean; type: string; }; }> - >"./package.json" : "./package.json" - >{ with: { type: "json" } } : { with: { type: string; }; } - >with : { type: string; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt index dc92388a5f..bf4698ad28 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt @@ -1,6 +1,6 @@ -/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== @@ -11,12 +11,12 @@ import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff deleted file mode 100644 index 36eb02d9cd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - - ==== /index.ts (3 errors) ==== -@@= skipped -10, +10 lines =@@ - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ - !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt index 4dbf0eda90..5c93150f88 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt @@ -1,6 +1,6 @@ -/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. ==== /index.ts (3 errors) ==== @@ -10,13 +10,13 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff deleted file mode 100644 index 81b605a93d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. --/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -+/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - - ==== /index.ts (3 errors) ==== -@@= skipped -9, +9 lines =@@ - export interface LocalInterface extends RequireInterface, ImportInterface {} - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; -- ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; -+ ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols index ad56b2736e..d76777ff60 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols @@ -13,10 +13,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols.diff deleted file mode 100644 index 4af3119158..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols -@@= skipped -12, +12 lines =@@ - >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - >Req : Symbol(Req, Decl(index.ts, 5, 8)) - - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) - >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) - - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt index d8a8228e80..5c93150f88 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,6 +1,6 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. ==== /index.ts (3 errors) ==== @@ -13,10 +13,10 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff deleted file mode 100644 index e4d75e6df7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. --/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -+/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - - ==== /index.ts (3 errors) ==== -@@= skipped -12, +12 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt index 4bd1844e48..c45ca1322b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt @@ -1,15 +1,15 @@ -/index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only @@ -17,11 +17,11 @@ ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff deleted file mode 100644 index 324dad0f4a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. --/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - - ==== /index.ts (5 errors) ==== - // incorrect mode - import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - // not type-only -@@= skipped -16, +16 lines =@@ - ~~~~~~~~~~~~~~~ - !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - // not exclusively type-only - import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - export interface LocalInterface extends RequireInterface, ImportInterface {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt deleted file mode 100644 index 777b06a355..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -==== /index.ts (1 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff deleted file mode 100644 index d1ba9c1f43..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /index.ts (1 errors) ==== -+ export type LocalInterface = -+ & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface -+ & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; -+ -+ export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); -+ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export interface ImportInterface {} -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js index 9fbb7e7ce6..cca2ca8a85 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js @@ -33,4 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff index 8fadb84545..1673732ecd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff @@ -5,6 +5,5 @@ //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +export declare const a: import("pkg").RequireInterface; -+export declare const b: any; \ No newline at end of file + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt index bc82a35047..f5aea7c4ad 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt @@ -1,7 +1,5 @@ -error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -9,9 +7,8 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(3,51): error TS1128: Declaration or statement expected. /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. -/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(6,49): error TS1005: 'with' expected. /other.ts(6,66): error TS1005: ';' expected. @@ -42,9 +39,8 @@ error TS2468: Cannot find global value 'Promise'. /other3.ts(3,55): error TS1005: ';' expected. /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. -/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(6,48): error TS1005: '{' expected. /other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. @@ -59,9 +55,8 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(6,31): error TS1128: Declaration or statement expected. /other4.ts(6,32): error TS1128: Declaration or statement expected. /other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. -/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other4.ts(9,48): error TS1005: '{' expected. /other4.ts(9,58): error TS1005: ',' expected. @@ -80,7 +75,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -96,7 +90,7 @@ error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (3 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -107,10 +101,8 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing with: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface @@ -130,12 +122,10 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); ~~~~~~~~~~~~~~~ @@ -199,7 +189,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -==== /other3.ts (17 errors) ==== +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface @@ -217,12 +207,10 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); ~~~~~~~~~~~~~ @@ -245,7 +233,7 @@ error TS2468: Cannot find global value 'Promise'. ~ !!! error TS1005: ',' expected. -==== /other4.ts (19 errors) ==== +==== /other4.ts (18 errors) ==== // Indirected attribute objecty-thing - not allowed type Attribute1 = { with: {"resolution-mode": "require"} }; type Attribute2 = { with: {"resolution-mode": "import"} }; @@ -268,13 +256,11 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. !!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. & import("pkg", Attribute2).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~ !!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. ~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. export const a = (null as any as import("pkg", Attribute1).RequireInterface); ~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff index 793a63e223..e770892216 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff @@ -1,108 +1,56 @@ --- old.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt +++ new.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. - /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other.ts(3,22): error TS1005: 'with' expected. - /other.ts(3,39): error TS1005: ';' expected. -@@= skipped -6, +8 lines =@@ - /other.ts(3,51): error TS1128: Declaration or statement expected. +@@= skipped -7, +7 lines =@@ /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -+/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +-/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -32, +33 lines =@@ - /other3.ts(3,55): error TS1005: ';' expected. + /other.ts(6,49): error TS1005: 'with' expected. + /other.ts(6,66): error TS1005: ';' expected. +@@= skipped -32, +32 lines =@@ /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -+/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +-/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -16, +17 lines =@@ - /other4.ts(6,31): error TS1128: Declaration or statement expected. + /other3.ts(6,48): error TS1005: '{' expected. + /other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +@@= skipped -16, +16 lines =@@ /other4.ts(6,32): error TS1128: Declaration or statement expected. /other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -+/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. - /other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +-/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -20, +21 lines =@@ - /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -+!!! error TS2468: Cannot find global value 'Promise'. - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -15, +16 lines =@@ - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} - --==== /index.ts (2 errors) ==== -+==== /index.ts (3 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -11, +11 lines =@@ - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - --==== /other.ts (27 errors) ==== -+==== /other.ts (28 errors) ==== - // missing with: - export type LocalInterface = - & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -21, +23 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", {"resolution-mode": "import"}).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + /other4.ts(9,48): error TS1005: '{' expected. + /other4.ts(9,58): error TS1005: ',' expected. +@@= skipped -69, +69 lines =@@ ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -@@= skipped -67, +69 lines =@@ - ~~~~~~~~~~~~~~~ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. --==== /other3.ts (16 errors) ==== -+==== /other3.ts (17 errors) ==== - // Array instead of object-y thing - export type LocalInterface = - & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface -@@= skipped -18, +18 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~~~~~~~~~~~ +@@= skipped -85, +85 lines =@@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -@@= skipped -26, +28 lines =@@ - ~ - !!! error TS1005: ',' expected. +-!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. --==== /other4.ts (18 errors) ==== -+==== /other4.ts (19 errors) ==== - // Indirected attribute objecty-thing - not allowed - type Attribute1 = { with: {"resolution-mode": "require"} }; - type Attribute2 = { with: {"resolution-mode": "import"} }; -@@= skipped -23, +23 lines =@@ - !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. - !!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. - & import("pkg", Attribute2).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~ + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~~~~~~~~~ +@@= skipped -50, +50 lines =@@ !!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. - !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. \ No newline at end of file + !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. + ~~~~~~~~~~~~~~~ +-!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. + + export const a = (null as any as import("pkg", Attribute1).RequireInterface); + ~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js index 8e46ab64f1..e8308c808a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js @@ -128,7 +128,7 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] // missing with: export type LocalInterface = import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff index 6c360e87db..1ec7d4cb31 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff @@ -5,9 +5,8 @@ //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +export declare const a: import("pkg").RequireInterface; -+export declare const b: any; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] +// missing with: export type LocalInterface = import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types index bc8f825a8e..86908c224d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types @@ -40,7 +40,7 @@ export type LocalInterface = & import("pkg", {"resolution-mode": "import"}).ImportInterface; >import("pkg", {"resolution-mode": "import"}).ImportInterface : any ->import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> +>import("pkg", {"resolution-mode": "import"}) : Promise >"pkg" : "pkg" >{"resolution-mode": "import"} : { "resolution-mode": string; } >"resolution-mode" : string @@ -97,7 +97,7 @@ export type LocalInterface = & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; >import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any ->import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise >"pkg" : "pkg" >[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] >{"resolution-mode": "import"} : { "resolution-mode": string; } @@ -145,7 +145,7 @@ export type LocalInterface = & import("pkg", Attribute2).ImportInterface; >import("pkg", Attribute2).ImportInterface : any ->import("pkg", Attribute2) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> +>import("pkg", Attribute2) : Promise >"pkg" : "pkg" >Attribute2 : any >ImportInterface : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff index a7d5568ede..848f21828d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff @@ -27,7 +27,7 @@ & import("pkg", {"resolution-mode": "import"}).ImportInterface; >import("pkg", {"resolution-mode": "import"}).ImportInterface : any ->import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> -+>import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> ++>import("pkg", {"resolution-mode": "import"}) : Promise >"pkg" : "pkg" >{"resolution-mode": "import"} : { "resolution-mode": string; } >"resolution-mode" : string @@ -49,7 +49,7 @@ & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; >import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any ->import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> -+>import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> ++>import("pkg", [ {"resolution-mode": "import"} ]) : Promise >"pkg" : "pkg" >[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] >{"resolution-mode": "import"} : { "resolution-mode": string; } @@ -58,7 +58,7 @@ & import("pkg", Attribute2).ImportInterface; >import("pkg", Attribute2).ImportInterface : any ->import("pkg", Attribute2) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> -+>import("pkg", Attribute2) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> ++>import("pkg", Attribute2) : Promise >"pkg" : "pkg" >Attribute2 : any >ImportInterface : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js index cc626353af..8dd77961a8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js @@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.fs = void 0; const tslib_1 = require("tslib"); // esm format file -tslib_1.__exportStar(require("fs"), exports); +__exportStar(require("fs"), exports); exports.fs = require("fs"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js.diff index f138b39bda..c14f215bf2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node18).js.diff @@ -21,7 +21,7 @@ +exports.fs = void 0; +const tslib_1 = require("tslib"); +// esm format file -+tslib_1.__exportStar(require("fs"), exports); ++__exportStar(require("fs"), exports); +exports.fs = require("fs"); + + diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node18).errors.txt new file mode 100644 index 0000000000..dc4849ff50 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node18).errors.txt @@ -0,0 +1,23 @@ +subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +==== subfolder/index.ts (1 errors) ==== + // cjs format file + const x = import.meta.url; + ~~~~~~~~~~~ +!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + export {x}; +==== index.ts (0 errors) ==== + // esm format file + const x = import.meta.url; + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node18).errors.txt.diff deleted file mode 100644 index cddf48dc3e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node18).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodeModulesImportMeta(module=node18).errors.txt -+++ new.nodeModulesImportMeta(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -- -- --==== subfolder/index.ts (1 errors) ==== -- // cjs format file -- const x = import.meta.url; -- ~~~~~~~~~~~ --!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -- export {x}; --==== index.ts (0 errors) ==== -- // esm format file -- const x = import.meta.url; -- export {x}; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== subfolder/package.json (0 errors) ==== -- { -- "type": "commonjs" -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt index 550ef21197..e77140972a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@ -1,6 +1,6 @@ -/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== @@ -11,12 +11,12 @@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff deleted file mode 100644 index cc94414981..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt -+++ new.nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - - ==== /index.ts (3 errors) ==== -@@= skipped -10, +10 lines =@@ - - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ - !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index e77140972a..b81d5cf9c7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,6 +1,6 @@ -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /index.ts (3 errors) ==== @@ -11,12 +11,12 @@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff index 37f29a9c7e..53fe2f724b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff @@ -1,29 +1,17 @@ --- old.nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ new.nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - - - ==== /index.ts (3 errors) ==== @@= skipped -9, +9 lines =@@ export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt index 44447996ab..47c2ad040c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt @@ -1,6 +1,6 @@ -/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. ==== /index.ts (3 errors) ==== @@ -10,13 +10,13 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff deleted file mode 100644 index bb22153115..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt -+++ new.nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. --/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -+/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - - ==== /index.ts (3 errors) ==== -@@= skipped -9, +9 lines =@@ - export interface LocalInterface extends RequireInterface, ImportInterface {} - - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -- ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; -+ ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols index 21ec7573e9..8d280aee6f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols @@ -13,10 +13,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols.diff deleted file mode 100644 index 563ecc9c49..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node18).symbols -+++ new.nodeModulesImportModeDeclarationEmit2(module=node18).symbols -@@= skipped -12, +12 lines =@@ - >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) - - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - >Req : Symbol(Req, Decl(index.ts, 5, 8)) - - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) - >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) - - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index e72c71d9a7..4d278fd27c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,6 +1,6 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /index.ts (3 errors) ==== @@ -13,10 +13,10 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff index a8e1f1d008..0eff3f24d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff @@ -1,27 +1,15 @@ --- old.nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ new.nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - - - ==== /index.ts (3 errors) ==== @@= skipped -11, +11 lines =@@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt index 1bf72bb46a..e1be072618 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,15 +1,15 @@ -/index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only @@ -17,11 +17,11 @@ ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff deleted file mode 100644 index 90eb52262e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt -+++ new.nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. --/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - - ==== /index.ts (5 errors) ==== - // incorrect mode - import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - // not type-only -@@= skipped -16, +16 lines =@@ - ~~~~~~~~~~~~~~~ - !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - // not exclusively type-only - import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - export interface LocalInterface extends RequireInterface, ImportInterface {} - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index e1be072618..3615fe44ff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,15 +1,15 @@ -/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only @@ -17,11 +17,11 @@ ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff index 2689bd1337..f097d1cb30 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff @@ -1,39 +1,25 @@ --- old.nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ new.nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - - +@@= skipped -7, +7 lines =@@ ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. - // not type-only +@@= skipped -8, +8 lines =@@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - export interface LocalInterface extends RequireInterface, ImportInterface {} - \ No newline at end of file + export interface LocalInterface extends RequireInterface, ImportInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt deleted file mode 100644 index 676f67dd9e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -==== /index.ts (1 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff deleted file mode 100644 index 120aa8429d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /index.ts (1 errors) ==== -+ export type LocalInterface = -+ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface -+ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; -+ -+ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); -+ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export interface ImportInterface {} -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js index 26d582ef14..6c0a3531fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js @@ -33,4 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff deleted file mode 100644 index 1296b80d51..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node18).js -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node18).js -@@= skipped -32, +32 lines =@@ - //// [index.d.ts] - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt index f7c0a4cb5c..9322401b8e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,7 +1,5 @@ -error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -9,9 +7,8 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(3,51): error TS1128: Declaration or statement expected. /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. -/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(6,49): error TS1005: 'with' expected. /other.ts(6,66): error TS1005: ';' expected. @@ -42,9 +39,8 @@ error TS2468: Cannot find global value 'Promise'. /other3.ts(3,55): error TS1005: ';' expected. /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. -/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(6,48): error TS1005: '{' expected. /other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. @@ -59,9 +55,8 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(6,29): error TS1128: Declaration or statement expected. /other4.ts(6,30): error TS1128: Declaration or statement expected. /other4.ts(6,31): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. -/other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other4.ts(9,48): error TS1005: '{' expected. /other4.ts(9,56): error TS1005: ',' expected. @@ -80,7 +75,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -94,7 +88,7 @@ error TS2468: Cannot find global value 'Promise'. export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (3 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -105,9 +99,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface @@ -127,12 +119,10 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); ~~~~~~~~~~~~~~~ @@ -194,7 +184,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -==== /other3.ts (17 errors) ==== +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface @@ -212,12 +202,10 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); ~~~~~~~~~~~~~ @@ -239,7 +227,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. ~ !!! error TS1005: ',' expected. -==== /other4.ts (19 errors) ==== +==== /other4.ts (18 errors) ==== // Indirected assertion objecty-thing - not allowed type Asserts1 = { assert: {"resolution-mode": "require"} }; type Asserts2 = { assert: {"resolution-mode": "import"} }; @@ -262,13 +250,11 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. !!! related TS2728 /other4.ts:9:58: 'RequireInterface' is declared here. & import("pkg", Asserts2).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~ !!! error TS2448: Block-scoped variable 'Asserts2' used before its declaration. !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. ~~~~~~~~~~~~~~~ -!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. export const a = (null as any as import("pkg", Asserts1).RequireInterface); ~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff index 2ee67f2fd4..007a5c5ad8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff @@ -1,107 +1,56 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS2468: Cannot find global value 'Promise'. - /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other.ts(3,22): error TS1005: 'with' expected. - /other.ts(3,39): error TS1005: ';' expected. -@@= skipped -6, +8 lines =@@ - /other.ts(3,51): error TS1128: Declaration or statement expected. +@@= skipped -7, +7 lines =@@ /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -+/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +-/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -32, +33 lines =@@ - /other3.ts(3,55): error TS1005: ';' expected. + /other.ts(6,49): error TS1005: 'with' expected. + /other.ts(6,66): error TS1005: ';' expected. +@@= skipped -32, +32 lines =@@ /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -+/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +-/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -16, +17 lines =@@ - /other4.ts(6,29): error TS1128: Declaration or statement expected. + /other3.ts(6,48): error TS1005: '{' expected. + /other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +@@= skipped -16, +16 lines =@@ /other4.ts(6,30): error TS1128: Declaration or statement expected. /other4.ts(6,31): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -+/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. - /other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +-/other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++/other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -20, +21 lines =@@ - /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -+!!! error TS2468: Cannot find global value 'Promise'. - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -13, +14 lines =@@ - export interface ImportInterface {} - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} --==== /index.ts (2 errors) ==== -+==== /index.ts (3 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -11, +11 lines =@@ - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); --==== /other.ts (27 errors) ==== -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+==== /other.ts (28 errors) ==== - // missing assert: - export type LocalInterface = - & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -20, +22 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", {"resolution-mode": "import"}).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + /other4.ts(9,48): error TS1005: '{' expected. + /other4.ts(9,56): error TS1005: ',' expected. +@@= skipped -66, +66 lines =@@ ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -@@= skipped -65, +67 lines =@@ - !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. - ~~~~~~~~~~~~~~~ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. --==== /other3.ts (16 errors) ==== -+==== /other3.ts (17 errors) ==== - // Array instead of object-y thing - export type LocalInterface = - & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface -@@= skipped -18, +18 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +-!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~~~~~~~~~~~ +@@= skipped -83, +83 lines =@@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -@@= skipped -25, +27 lines =@@ - !!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. - ~ - !!! error TS1005: ',' expected. --==== /other4.ts (18 errors) ==== -+==== /other4.ts (19 errors) ==== - // Indirected assertion objecty-thing - not allowed - type Asserts1 = { assert: {"resolution-mode": "require"} }; - type Asserts2 = { assert: {"resolution-mode": "import"} }; -@@= skipped -23, +23 lines =@@ - !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. - !!! related TS2728 /other4.ts:9:58: 'RequireInterface' is declared here. - & import("pkg", Asserts2).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~ +-!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~~~~~~~~~ +@@= skipped -49, +49 lines =@@ !!! error TS2448: Block-scoped variable 'Asserts2' used before its declaration. - !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. \ No newline at end of file + !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. + ~~~~~~~~~~~~~~~ +-!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. ++!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise'. + + export const a = (null as any as import("pkg", Asserts1).RequireInterface); + ~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js index 7c4b9cd77d..c18dc767f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js @@ -122,7 +122,7 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] // missing assert: export type LocalInterface = import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff index 37aa4e9198..c1f5274063 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff @@ -1,11 +1,8 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js -@@= skipped -121, +121 lines =@@ - //// [index.d.ts] - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; +@@= skipped -123, +123 lines =@@ export declare const a: import("pkg").RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const b: any; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] +// missing assert: export type LocalInterface = import("pkg", { with: {} }); @@ -23,7 +20,7 @@ export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; -@@= skipped -17, +20 lines =@@ +@@= skipped -15, +18 lines =@@ export declare const b: any; //// [other4.d.ts] export type LocalInterface = import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types index c740f9eb8a..e5f51142b0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types @@ -38,7 +38,7 @@ export type LocalInterface = & import("pkg", {"resolution-mode": "import"}).ImportInterface; >import("pkg", {"resolution-mode": "import"}).ImportInterface : any ->import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> +>import("pkg", {"resolution-mode": "import"}) : Promise >"pkg" : "pkg" >{"resolution-mode": "import"} : { "resolution-mode": string; } >"resolution-mode" : string @@ -95,7 +95,7 @@ export type LocalInterface = & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; >import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any ->import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise >"pkg" : "pkg" >[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] >{"resolution-mode": "import"} : { "resolution-mode": string; } @@ -143,7 +143,7 @@ export type LocalInterface = & import("pkg", Asserts2).ImportInterface; >import("pkg", Asserts2).ImportInterface : any ->import("pkg", Asserts2) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> +>import("pkg", Asserts2) : Promise >"pkg" : "pkg" >Asserts2 : any >ImportInterface : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff index d918947324..e585c40f51 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff @@ -27,7 +27,7 @@ & import("pkg", {"resolution-mode": "import"}).ImportInterface; >import("pkg", {"resolution-mode": "import"}).ImportInterface : any ->import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> -+>import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> ++>import("pkg", {"resolution-mode": "import"}) : Promise >"pkg" : "pkg" >{"resolution-mode": "import"} : { "resolution-mode": string; } >"resolution-mode" : string @@ -49,7 +49,7 @@ & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; >import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any ->import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> -+>import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> ++>import("pkg", [ {"resolution-mode": "import"} ]) : Promise >"pkg" : "pkg" >[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] >{"resolution-mode": "import"} : { "resolution-mode": string; } @@ -58,7 +58,7 @@ & import("pkg", Asserts2).ImportInterface; >import("pkg", Asserts2).ImportInterface : any ->import("pkg", Asserts2) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> -+>import("pkg", Asserts2) : Promise<{ default: typeof import("./node_modules/pkg/import"); }> ++>import("pkg", Asserts2) : Promise >"pkg" : "pkg" >Asserts2 : any >ImportInterface : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt index 33ecb9f718..ac054ff166 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt @@ -3,9 +3,10 @@ /main.mts(5,36): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(6,52): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(9,47): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode16'. /main.mts(10,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(11,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(13,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. +/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. ==== /node_modules/not.json/package.json (0 errors) ==== @@ -42,7 +43,7 @@ "version": 1 } -==== /main.mts (6 errors) ==== +==== /main.mts (7 errors) ==== import { oops } from "not.json"; // Ok import moreOops from "actually-json"; // Error in nodenext import typed from "actually-json/typed"; // Error in nodenext @@ -59,15 +60,17 @@ ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { version } from "./config.json" with { type: "json" }; // Error, named import + ~~~~~~~ +!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode16'. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import * as config3 from "./config.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. config3.version; // Error - config3.default; // Ok ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. +!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + config3.default; // Ok ==== /loosey.cts (2 errors) ==== import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt.diff index ff10e9b94e..0716da415c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).errors.txt.diff @@ -5,39 +5,16 @@ /main.mts(6,52): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(9,47): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node16'. ++/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode16'. /main.mts(10,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(11,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. --/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. -+/main.mts(13,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. - - - ==== /node_modules/not.json/package.json (0 errors) ==== -@@= skipped -40, +39 lines =@@ - "version": 1 - } - --==== /main.mts (7 errors) ==== -+==== /main.mts (6 errors) ==== - import { oops } from "not.json"; // Ok - import moreOops from "actually-json"; // Error in nodenext - import typed from "actually-json/typed"; // Error in nodenext -@@= skipped -17, +17 lines =@@ - ~~~~~~~~~~~~~~~~~~~~~ + /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. +@@= skipped -58, +58 lines =@@ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { version } from "./config.json" with { type: "json" }; // Error, named import -- ~~~~~~~ + ~~~~~~~ -!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node16'. ++!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode16'. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import * as config3 from "./config.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - config3.version; // Error -- ~~~~~~~ --!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. - config3.default; // Ok -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. - - ==== /loosey.cts (2 errors) ==== - import config from "./config.json" with { type: "json" }; // Error \ No newline at end of file + import * as config3 from "./config.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols index ef8b0a9558..71d9a42d4e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols @@ -55,12 +55,12 @@ import * as config3 from "./config.json" with { type: "json" }; >config3 : Symbol(config3, Decl(main.mts, 10, 6)) config3.version; // Error ->config3.version : Symbol("version", Decl(config.json, 0, 1)) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) ->version : Symbol("version", Decl(config.json, 0, 1)) config3.default; // Ok +>config3.default : Symbol(default) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) +>default : Symbol(default) === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols.diff index 3c63ecee35..ca80b01d49 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).symbols.diff @@ -9,22 +9,19 @@ >config1 : Symbol(config1, Decl(main.mts, 5, 8)) import config2 from "./config.json"; // Error in nodenext, no attribute -@@= skipped -19, +19 lines =@@ +@@= skipped -22, +22 lines =@@ >config3 : Symbol(config3, Decl(main.mts, 10, 6)) - config3.version; // Error -+>config3.version : Symbol("version", Decl(config.json, 0, 1)) - >config3 : Symbol(config3, Decl(main.mts, 10, 6)) -+>version : Symbol("version", Decl(config.json, 0, 1)) - config3.default; // Ok ->config3.default : Symbol("/config") ++>config3.default : Symbol(default) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) ->default : Symbol("/config") ++>default : Symbol(default) === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error -@@= skipped -21, +21 lines =@@ +@@= skipped -18, +18 lines =@@ >config3 : Symbol(config3, Decl(loosey.cts, 3, 6)) config3.version; // Ok diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types index 19c6ffc615..845f651a55 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types @@ -33,7 +33,7 @@ import moreOops from "actually-json"; // Error in nodenext >moreOops : {} import typed from "actually-json/typed"; // Error in nodenext ->typed : {} +>typed : typeof typed import config from "./config.json" with { type: "json" }; // Ok >config : { version: number; } @@ -59,18 +59,18 @@ import { version } from "./config.json" with { type: "json" }; // Error, named i >type : any import * as config3 from "./config.json" with { type: "json" }; ->config3 : { version: number; } +>config3 : { default: { version: number; }; } >type : any config3.version; // Error ->config3.version : number ->config3 : { version: number; } ->version : number +>config3.version : any +>config3 : { default: { version: number; }; } +>version : any config3.default; // Ok ->config3.default : any ->config3 : { version: number; } ->default : any +>config3.default : { version: number; } +>config3 : { default: { version: number; }; } +>default : { version: number; } === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types.diff deleted file mode 100644 index 25789522da..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node16).types.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.nodeModulesJson(module=node16).types -+++ new.nodeModulesJson(module=node16).types -@@= skipped -32, +32 lines =@@ - >moreOops : {} - - import typed from "actually-json/typed"; // Error in nodenext -->typed : typeof typed -+>typed : {} - - import config from "./config.json" with { type: "json" }; // Ok - >config : { version: number; } -@@= skipped -26, +26 lines =@@ - >type : any - - import * as config3 from "./config.json" with { type: "json" }; -->config3 : { default: { version: number; }; } -+>config3 : { version: number; } - >type : any - - config3.version; // Error -->config3.version : any -->config3 : { default: { version: number; }; } -->version : any -+>config3.version : number -+>config3 : { version: number; } -+>version : number - - config3.default; // Ok -->config3.default : { version: number; } -->config3 : { default: { version: number; }; } -->default : { version: number; } -+>config3.default : any -+>config3 : { version: number; } -+>default : any - - === /loosey.cts === - import config from "./config.json" with { type: "json" }; // Error \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt index 33ecb9f718..b1a2ced62d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt @@ -1,11 +1,13 @@ -/loosey.cts(1,36): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/loosey.cts(1,8): error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +/loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/loosey.cts(2,8): error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. -/main.mts(5,36): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(6,52): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(9,47): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(10,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(11,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/main.mts(13,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. +/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. +/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. +/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. +/main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. +/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode18'. +/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. ==== /node_modules/not.json/package.json (0 errors) ==== @@ -45,35 +47,41 @@ ==== /main.mts (6 errors) ==== import { oops } from "not.json"; // Ok import moreOops from "actually-json"; // Error in nodenext + ~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. import typed from "actually-json/typed"; // Error in nodenext + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. import config from "./config.json" with { type: "json" }; // Ok - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { default as config1 } from "./config.json" with { type: "json" }; // Ok - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import config2 from "./config.json"; // Error in nodenext, no attribute + ~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. import type config2Type from "./config.json"; // Ok, type-only import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. import { version } from "./config.json" with { type: "json" }; // Error, named import - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + ~~~~~~~ +!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode18'. import * as config3 from "./config.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. config3.version; // Error - config3.default; // Ok ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. +!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + config3.default; // Ok -==== /loosey.cts (2 errors) ==== +==== /loosey.cts (4 errors) ==== import config from "./config.json" with { type: "json" }; // Error + ~~~~~~ +!!! error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +!!! related TS2594 /config.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import config2 from "./config.json"; // Ok + ~~~~~~~ +!!! error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +!!! related TS2594 /config.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. import { version } from "./config.json"; // Ok import * as config3 from "./config.json"; config3.version; // Ok diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt.diff index bbbffe81ed..2643d8b700 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).errors.txt.diff @@ -1,68 +1,65 @@ --- old.nodeModulesJson(module=node18).errors.txt +++ new.nodeModulesJson(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --/loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/loosey.cts(1,36): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ++/loosey.cts(1,8): error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag + /loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ++/loosey.cts(2,8): error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. -/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. -/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. -/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. --/main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. ++/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. ++/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. ++/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. + /main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. -/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node18'. --/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. -+/main.mts(5,36): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/main.mts(6,52): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/main.mts(9,47): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/main.mts(10,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/main.mts(11,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/main.mts(13,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. ++/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode18'. + /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. - ==== /node_modules/not.json/package.json (0 errors) ==== -@@= skipped -44, +44 lines =@@ - ==== /main.mts (6 errors) ==== +@@= skipped -45, +47 lines =@@ import { oops } from "not.json"; // Ok import moreOops from "actually-json"; // Error in nodenext -- ~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ -!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. ++!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. import typed from "actually-json/typed"; // Error in nodenext -- ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. ++!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. import config from "./config.json" with { type: "json" }; // Ok -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { default as config1 } from "./config.json" with { type: "json" }; // Ok -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import config2 from "./config.json"; // Error in nodenext, no attribute -- ~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ -!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. ++!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNode18'. import type config2Type from "./config.json"; // Ok, type-only import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2857: Import attributes cannot be used with type-only imports or exports. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + !!! error TS2857: Import attributes cannot be used with type-only imports or exports. import { version } from "./config.json" with { type: "json" }; // Error, named import -- ~~~~~~~ + ~~~~~~~ -!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node18'. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ++!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNode18'. import * as config3 from "./config.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. config3.version; // Error -- ~~~~~~~ --!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + ~~~~~~~ + !!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. config3.default; // Ok -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. - ==== /loosey.cts (2 errors) ==== +-==== /loosey.cts (2 errors) ==== ++==== /loosey.cts (4 errors) ==== import config from "./config.json" with { type: "json" }; // Error ++ ~~~~~~ ++!!! error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag ++!!! related TS2594 /config.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import config2 from "./config.json"; // Ok ++ ~~~~~~~ ++!!! error TS1259: Module '"/config"' can only be default-imported using the 'allowSyntheticDefaultImports' flag ++!!! related TS2594 /config.json:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. import { version } from "./config.json"; // Ok - import * as config3 from "./config.json"; \ No newline at end of file + import * as config3 from "./config.json"; + config3.version; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols index ef8b0a9558..71d9a42d4e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols @@ -55,12 +55,12 @@ import * as config3 from "./config.json" with { type: "json" }; >config3 : Symbol(config3, Decl(main.mts, 10, 6)) config3.version; // Error ->config3.version : Symbol("version", Decl(config.json, 0, 1)) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) ->version : Symbol("version", Decl(config.json, 0, 1)) config3.default; // Ok +>config3.default : Symbol(default) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) +>default : Symbol(default) === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols.diff index bf630aa0c4..575853b793 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).symbols.diff @@ -9,22 +9,19 @@ >config1 : Symbol(config1, Decl(main.mts, 5, 8)) import config2 from "./config.json"; // Error in nodenext, no attribute -@@= skipped -19, +19 lines =@@ +@@= skipped -22, +22 lines =@@ >config3 : Symbol(config3, Decl(main.mts, 10, 6)) - config3.version; // Error -+>config3.version : Symbol("version", Decl(config.json, 0, 1)) - >config3 : Symbol(config3, Decl(main.mts, 10, 6)) -+>version : Symbol("version", Decl(config.json, 0, 1)) - config3.default; // Ok ->config3.default : Symbol("/config") ++>config3.default : Symbol(default) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) ->default : Symbol("/config") ++>default : Symbol(default) === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error -@@= skipped -21, +21 lines =@@ +@@= skipped -18, +18 lines =@@ >config3 : Symbol(config3, Decl(loosey.cts, 3, 6)) config3.version; // Ok diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types index 19c6ffc615..36337d45da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types @@ -33,7 +33,7 @@ import moreOops from "actually-json"; // Error in nodenext >moreOops : {} import typed from "actually-json/typed"; // Error in nodenext ->typed : {} +>typed : typeof typed import config from "./config.json" with { type: "json" }; // Ok >config : { version: number; } @@ -59,26 +59,26 @@ import { version } from "./config.json" with { type: "json" }; // Error, named i >type : any import * as config3 from "./config.json" with { type: "json" }; ->config3 : { version: number; } +>config3 : { default: { version: number; }; } >type : any config3.version; // Error ->config3.version : number ->config3 : { version: number; } ->version : number +>config3.version : any +>config3 : { default: { version: number; }; } +>version : any config3.default; // Ok ->config3.default : any ->config3 : { version: number; } ->default : any +>config3.default : { version: number; } +>config3 : { default: { version: number; }; } +>default : { version: number; } === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error ->config : { version: number; } +>config : any >type : any import config2 from "./config.json"; // Ok ->config2 : { version: number; } +>config2 : any import { version } from "./config.json"; // Ok >version : number diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types.diff index 3cc74fc9ba..39640eed66 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node18).types.diff @@ -1,37 +1,16 @@ --- old.nodeModulesJson(module=node18).types +++ new.nodeModulesJson(module=node18).types -@@= skipped -32, +32 lines =@@ - >moreOops : {} +@@= skipped -73, +73 lines =@@ - import typed from "actually-json/typed"; // Error in nodenext -->typed : typeof typed -+>typed : {} - - import config from "./config.json" with { type: "json" }; // Ok - >config : { version: number; } -@@= skipped -26, +26 lines =@@ - >type : any - - import * as config3 from "./config.json" with { type: "json" }; -->config3 : { default: { version: number; }; } -+>config3 : { version: number; } + === /loosey.cts === + import config from "./config.json" with { type: "json" }; // Error +->config : { version: number; } ++>config : any >type : any - config3.version; // Error -->config3.version : any -->config3 : { default: { version: number; }; } -->version : any -+>config3.version : number -+>config3 : { version: number; } -+>version : number - - config3.default; // Ok -->config3.default : { version: number; } -->config3 : { default: { version: number; }; } -->default : { version: number; } -+>config3.default : any -+>config3 : { version: number; } -+>default : any + import config2 from "./config.json"; // Ok +->config2 : { version: number; } ++>config2 : any - === /loosey.cts === - import config from "./config.json" with { type: "json" }; // Error \ No newline at end of file + import { version } from "./config.json"; // Ok + >version : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt index a5920cea5c..f732c7ebb9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt @@ -1,11 +1,11 @@ /loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. -/main.mts(5,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/main.mts(6,52): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/main.mts(9,47): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/main.mts(10,41): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/main.mts(11,42): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/main.mts(13,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. +/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. +/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. +/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. +/main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. +/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNodeNext'. +/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. ==== /node_modules/not.json/package.json (0 errors) ==== @@ -45,29 +45,29 @@ ==== /main.mts (6 errors) ==== import { oops } from "not.json"; // Ok import moreOops from "actually-json"; // Error in nodenext + ~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. import typed from "actually-json/typed"; // Error in nodenext + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. import config from "./config.json" with { type: "json" }; // Ok - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import { default as config1 } from "./config.json" with { type: "json" }; // Ok - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import config2 from "./config.json"; // Error in nodenext, no attribute + ~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. import type config2Type from "./config.json"; // Ok, type-only import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. import { version } from "./config.json" with { type: "json" }; // Error, named import - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + ~~~~~~~ +!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNodeNext'. import * as config3 from "./config.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. config3.version; // Error - config3.default; // Ok ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. +!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + config3.default; // Ok ==== /loosey.cts (2 errors) ==== import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt.diff index 4e545b19e1..2a8c2e6d9b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).errors.txt.diff @@ -6,56 +6,40 @@ -/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. -/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. -/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. --/main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. ++/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. ++/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. ++/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. + /main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. -/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'NodeNext'. --/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. -+/main.mts(5,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/main.mts(6,52): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/main.mts(9,47): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/main.mts(10,41): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/main.mts(11,42): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/main.mts(13,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. ++/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNodeNext'. + /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. - ==== /node_modules/not.json/package.json (0 errors) ==== -@@= skipped -44, +44 lines =@@ - ==== /main.mts (6 errors) ==== +@@= skipped -45, +45 lines =@@ import { oops } from "not.json"; // Ok import moreOops from "actually-json"; // Error in nodenext -- ~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ -!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. ++!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. import typed from "actually-json/typed"; // Error in nodenext -- ~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. ++!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. import config from "./config.json" with { type: "json" }; // Ok -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import { default as config1 } from "./config.json" with { type: "json" }; // Ok -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. import config2 from "./config.json"; // Error in nodenext, no attribute -- ~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ -!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'. ++!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'ModuleKindNodeNext'. import type config2Type from "./config.json"; // Ok, type-only import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2857: Import attributes cannot be used with type-only imports or exports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2857: Import attributes cannot be used with type-only imports or exports. import { version } from "./config.json" with { type: "json" }; // Error, named import -- ~~~~~~~ + ~~~~~~~ -!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'NodeNext'. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ++!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'ModuleKindNodeNext'. import * as config3 from "./config.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. config3.version; // Error -- ~~~~~~~ --!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. - config3.default; // Ok -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. - - ==== /loosey.cts (2 errors) ==== - import config from "./config.json" with { type: "json" }; // Error \ No newline at end of file + ~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols index ef8b0a9558..71d9a42d4e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols @@ -55,12 +55,12 @@ import * as config3 from "./config.json" with { type: "json" }; >config3 : Symbol(config3, Decl(main.mts, 10, 6)) config3.version; // Error ->config3.version : Symbol("version", Decl(config.json, 0, 1)) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) ->version : Symbol("version", Decl(config.json, 0, 1)) config3.default; // Ok +>config3.default : Symbol(default) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) +>default : Symbol(default) === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols.diff index f46a25228a..2283e34586 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).symbols.diff @@ -9,22 +9,19 @@ >config1 : Symbol(config1, Decl(main.mts, 5, 8)) import config2 from "./config.json"; // Error in nodenext, no attribute -@@= skipped -19, +19 lines =@@ +@@= skipped -22, +22 lines =@@ >config3 : Symbol(config3, Decl(main.mts, 10, 6)) - config3.version; // Error -+>config3.version : Symbol("version", Decl(config.json, 0, 1)) - >config3 : Symbol(config3, Decl(main.mts, 10, 6)) -+>version : Symbol("version", Decl(config.json, 0, 1)) - config3.default; // Ok ->config3.default : Symbol("/config") ++>config3.default : Symbol(default) >config3 : Symbol(config3, Decl(main.mts, 10, 6)) ->default : Symbol("/config") ++>default : Symbol(default) === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error -@@= skipped -21, +21 lines =@@ +@@= skipped -18, +18 lines =@@ >config3 : Symbol(config3, Decl(loosey.cts, 3, 6)) config3.version; // Ok diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types index 19c6ffc615..845f651a55 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types @@ -33,7 +33,7 @@ import moreOops from "actually-json"; // Error in nodenext >moreOops : {} import typed from "actually-json/typed"; // Error in nodenext ->typed : {} +>typed : typeof typed import config from "./config.json" with { type: "json" }; // Ok >config : { version: number; } @@ -59,18 +59,18 @@ import { version } from "./config.json" with { type: "json" }; // Error, named i >type : any import * as config3 from "./config.json" with { type: "json" }; ->config3 : { version: number; } +>config3 : { default: { version: number; }; } >type : any config3.version; // Error ->config3.version : number ->config3 : { version: number; } ->version : number +>config3.version : any +>config3 : { default: { version: number; }; } +>version : any config3.default; // Ok ->config3.default : any ->config3 : { version: number; } ->default : any +>config3.default : { version: number; } +>config3 : { default: { version: number; }; } +>default : { version: number; } === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types.diff deleted file mode 100644 index 1383939ad8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=nodenext).types.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.nodeModulesJson(module=nodenext).types -+++ new.nodeModulesJson(module=nodenext).types -@@= skipped -32, +32 lines =@@ - >moreOops : {} - - import typed from "actually-json/typed"; // Error in nodenext -->typed : typeof typed -+>typed : {} - - import config from "./config.json" with { type: "json" }; // Ok - >config : { version: number; } -@@= skipped -26, +26 lines =@@ - >type : any - - import * as config3 from "./config.json" with { type: "json" }; -->config3 : { default: { version: number; }; } -+>config3 : { version: number; } - >type : any - - config3.version; // Error -->config3.version : any -->config3 : { default: { version: number; }; } -->version : any -+>config3.version : number -+>config3 : { version: number; } -+>version : number - - config3.default; // Ok -->config3.default : { version: number; } -->config3 : { default: { version: number; }; } -->default : { version: number; } -+>config3.default : any -+>config3 : { version: number; } -+>default : any - - === /loosey.cts === - import config from "./config.json" with { type: "json" }; // Error \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff index 6e3aad1bc7..549e862520 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff @@ -2,112 +2,28 @@ +++ new.nodeModulesPackageExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- -- + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + + -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -- // cjs format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -- import * as type from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; + ==== index.ts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; +@@= skipped -55, +52 lines =@@ + cjsi; + mjsi; + typei; -==== node_modules/inner/index.d.ts (2 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs"; ++==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- import * as type from "inner"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs"; -- import * as mjs from "inner/mjs"; -- import * as type from "inner"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs"; -- import * as mjs from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- import * as type from "inner"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- "exports": { -- "./cjs": "./index.cjs", -- "./mjs": "./index.mjs", -- ".": "./index.js" -- } -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs": "./index.cjs", -- "./mjs": "./index.mjs", -- ".": "./index.js" -- } -- } -+ \ No newline at end of file + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff index 9e0ed28b46..8664f03d23 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff @@ -6,63 +6,93 @@ - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -+index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+ -+ - ==== index.ts (0 errors) ==== - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -30, +32 lines =@@ - cjsi; - mjsi; - typei; +-==== index.ts (0 errors) ==== +- // esm format file +- import * as cjs from "package/cjs"; +- import * as mjs from "package/mjs"; +- import * as type from "package"; +- cjs; +- mjs; +- type; +- import * as cjsi from "inner/cjs"; +- import * as mjsi from "inner/mjs"; +- import * as typei from "inner"; +- cjsi; +- mjsi; +- typei; +-==== index.mts (0 errors) ==== +- // esm format file +- import * as cjs from "package/cjs"; +- import * as mjs from "package/mjs"; +- import * as type from "package"; +- cjs; +- mjs; +- type; +- import * as cjsi from "inner/cjs"; +- import * as mjsi from "inner/mjs"; +- import * as typei from "inner"; +- cjsi; +- mjsi; +- typei; -==== index.cts (0 errors) ==== -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as typei from "inner"; - cjsi; - mjsi; -@@= skipped -17, +23 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; +- // cjs format file +- import * as cjs from "package/cjs"; +- import * as mjs from "package/mjs"; +- import * as type from "package"; +- cjs; +- mjs; +- type; +- import * as cjsi from "inner/cjs"; +- import * as mjsi from "inner/mjs"; +- import * as typei from "inner"; +- cjsi; +- mjsi; +- typei; +-==== node_modules/inner/index.d.ts (1 errors) ==== +- // cjs format file +- import * as cjs from "inner/cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ - export { cjs }; - export { mjs }; - export { type }; +- import * as mjs from "inner/mjs"; +- import * as type from "inner"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== node_modules/inner/index.d.mts (0 errors) ==== +- // esm format file +- import * as cjs from "inner/cjs"; +- import * as mjs from "inner/mjs"; +- import * as type from "inner"; +- export { cjs }; +- export { mjs }; +- export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - export { cjs }; - export { mjs }; \ No newline at end of file +- // cjs format file +- import * as cjs from "inner/cjs"; +- import * as mjs from "inner/mjs"; +- import * as type from "inner"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- "exports": { +- "./cjs": "./index.cjs", +- "./mjs": "./index.mjs", +- ".": "./index.js" +- } +- } +-==== node_modules/inner/package.json (0 errors) ==== +- { +- "name": "inner", +- "private": true, +- "exports": { +- "./cjs": "./index.cjs", +- "./mjs": "./index.mjs", +- ".": "./index.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node18).errors.txt.diff deleted file mode 100644 index 468a7879f0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node18).errors.txt.diff +++ /dev/null @@ -1,48 +0,0 @@ ---- old.nodeModulesPackageImports(module=node18).errors.txt -+++ new.nodeModulesPackageImports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "#cjs"; -- import * as mjs from "#mjs"; -- import * as type from "#type"; -- cjs; -- mjs; -- type; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "#cjs"; -- import * as mjs from "#mjs"; -- import * as type from "#type"; -- cjs; -- mjs; -- type; --==== index.cts (2 errors) ==== -- // esm format file -- import * as cjs from "#cjs"; -- import * as mjs from "#mjs"; -- ~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. -- import * as type from "#type"; -- ~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -- cjs; -- mjs; -- type; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- "exports": "./index.js", -- "imports": { -- "#cjs": "./index.cjs", -- "#mjs": "./index.mjs", -- "#type": "./index.js" -- } -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=nodenext).errors.txt.diff deleted file mode 100644 index f09c70687c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,48 +0,0 @@ ---- old.nodeModulesPackageImports(module=nodenext).errors.txt -+++ new.nodeModulesPackageImports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. -+index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -+ -+ -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== index.cts (2 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ ~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. -+ import * as type from "#type"; -+ ~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -+ cjs; -+ mjs; -+ type; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js", -+ "imports": { -+ "#cjs": "./index.cjs", -+ "#mjs": "./index.mjs", -+ "#type": "./index.js" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff index 56027923ad..dc743a6e3b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff @@ -1,82 +1,22 @@ --- old.nodeModulesPackagePatternExports(module=node18).errors.txt +++ new.nodeModulesPackagePatternExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cts (1 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + + +@@= skipped -29, +28 lines =@@ + cjsi; + mjsi; + typei; -==== node_modules/inner/index.d.ts (2 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; ++==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -+ \ No newline at end of file + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff index 73161bbdcb..f55c361081 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff @@ -2,49 +2,72 @@ +++ new.nodeModulesPackagePatternExports(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - - ==== index.ts (0 errors) ==== -@@= skipped -16, +18 lines =@@ - cjsi; - mjsi; - typei; +- +- +-==== index.ts (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index"; +- import * as mjsi from "inner/mjs/index"; +- import * as typei from "inner/js/index"; +- cjsi; +- mjsi; +- typei; +-==== index.mts (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index"; +- import * as mjsi from "inner/mjs/index"; +- import * as typei from "inner/js/index"; +- cjsi; +- mjsi; +- typei; -==== index.cts (0 errors) ==== -+==== index.cts (1 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as typei from "inner/js/index"; - cjsi; - mjsi; -@@= skipped -11, +13 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; +- // cjs format file +- import * as cjsi from "inner/cjs/index"; +- import * as mjsi from "inner/mjs/index"; +- import * as typei from "inner/js/index"; +- cjsi; +- mjsi; +- typei; +-==== node_modules/inner/index.d.ts (1 errors) ==== +- // cjs format file +- import * as cjs from "inner/cjs/index"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ - export { cjs }; - export { mjs }; - export { type }; +- import * as mjs from "inner/mjs/index"; +- import * as type from "inner/js/index"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== node_modules/inner/index.d.mts (0 errors) ==== +- // esm format file +- import * as cjs from "inner/cjs/index"; +- import * as mjs from "inner/mjs/index"; +- import * as type from "inner/js/index"; +- export { cjs }; +- export { mjs }; +- export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; \ No newline at end of file +- // cjs format file +- import * as cjs from "inner/cjs/index"; +- import * as mjs from "inner/mjs/index"; +- import * as type from "inner/js/index"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- } +-==== node_modules/inner/package.json (0 errors) ==== +- { +- "name": "inner", +- "private": true, +- "exports": { +- "./cjs/*": "./*.cjs", +- "./mjs/*": "./*.mjs", +- "./js/*": "./*.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt index 7b905f13c1..491a598cda 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -1,6 +1,7 @@ index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +index.cts(9,24): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. index.mts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.mts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. @@ -16,6 +17,8 @@ node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module ' node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -58,7 +61,7 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== index.cts (3 errors) ==== +==== index.cts (4 errors) ==== // cjs format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -74,6 +77,8 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i typei; import * as cjsi2 from "inner/cjs/index"; import * as mjsi2 from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as typei2 from "inner/js/index"; cjsi2; mjsi2; @@ -120,10 +125,12 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (0 errors) ==== +==== node_modules/inner/index.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as type from "inner/js/index"; export { cjs }; export { mjs }; @@ -136,10 +143,12 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as type from "inner/js/index"; export { cjs }; export { mjs }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff index fd451d2ab5..a13dc3c492 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff @@ -1,68 +1,23 @@ --- old.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ new.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --index.cts(9,24): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - index.mts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.mts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -16, +15 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +@@= skipped -17, +17 lines =@@ node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - ==== index.ts (3 errors) ==== -@@= skipped -45, +42 lines =@@ - cjsi2; - mjsi2; - typei2; --==== index.cts (4 errors) ==== -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/exclude/index"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -@@= skipped -16, +16 lines =@@ - typei; - import * as cjsi2 from "inner/cjs/index"; - import * as mjsi2 from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as typei2 from "inner/js/index"; - cjsi2; - mjsi2; -@@= skipped -48, +46 lines =@@ +@@= skipped -108, +107 lines =@@ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== ++==== node_modules/inner/index.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; -@@= skipped -20, +16 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -+==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; \ No newline at end of file + ~~~~~~~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt index 491a598cda..7b905f13c1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt @@ -1,7 +1,6 @@ index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -index.cts(9,24): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. index.mts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.mts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. @@ -17,8 +16,6 @@ node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module ' node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -61,7 +58,7 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -77,8 +74,6 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ typei; import * as cjsi2 from "inner/cjs/index"; import * as mjsi2 from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as typei2 from "inner/js/index"; cjsi2; mjsi2; @@ -125,12 +120,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as type from "inner/js/index"; export { cjs }; export { mjs }; @@ -143,12 +136,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as type from "inner/js/index"; export { cjs }; export { mjs }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff index 542603d962..222b759f1a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff @@ -1,64 +1,23 @@ --- old.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt +++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -+index.cts(9,24): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - index.mts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.mts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -15, +16 lines =@@ +@@= skipped -15, +15 lines =@@ node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== -@@= skipped -43, +44 lines =@@ - cjsi2; - mjsi2; - typei2; --==== index.cts (3 errors) ==== -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/exclude/index"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -@@= skipped -16, +16 lines =@@ - typei; - import * as cjsi2 from "inner/cjs/index"; - import * as mjsi2 from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as typei2 from "inner/js/index"; - cjsi2; - mjsi2; -@@= skipped -49, +51 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ +@@= skipped -105, +104 lines =@@ export { cjs }; export { mjs }; export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== +-==== node_modules/inner/index.d.ts (1 errors) ==== ++==== node_modules/inner/index.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; +- ~~~ +-!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; \ No newline at end of file + export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff index 0a664350e0..9477452c75 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff @@ -1,82 +1,22 @@ --- old.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt +++ new.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cts (1 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + + +@@= skipped -29, +28 lines =@@ + cjsi; + mjsi; + typei; -==== node_modules/inner/index.d.ts (2 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; ++==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -+ \ No newline at end of file + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff index 994ec6850e..daf09e2176 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff @@ -2,49 +2,72 @@ +++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - - ==== index.ts (0 errors) ==== -@@= skipped -16, +18 lines =@@ - cjsi; - mjsi; - typei; +- +- +-==== index.ts (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index.cjs"; +- import * as mjsi from "inner/mjs/index.mjs"; +- import * as typei from "inner/js/index.js"; +- cjsi; +- mjsi; +- typei; +-==== index.mts (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index.cjs"; +- import * as mjsi from "inner/mjs/index.mjs"; +- import * as typei from "inner/js/index.js"; +- cjsi; +- mjsi; +- typei; -==== index.cts (0 errors) ==== -+==== index.cts (1 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; -@@= skipped -11, +13 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; +- // cjs format file +- import * as cjsi from "inner/cjs/index.cjs"; +- import * as mjsi from "inner/mjs/index.mjs"; +- import * as typei from "inner/js/index.js"; +- cjsi; +- mjsi; +- typei; +-==== node_modules/inner/index.d.ts (1 errors) ==== +- // cjs format file +- import * as cjs from "inner/cjs/index.cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ - export { cjs }; - export { mjs }; - export { type }; +- import * as mjs from "inner/mjs/index.mjs"; +- import * as type from "inner/js/index.js"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== node_modules/inner/index.d.mts (0 errors) ==== +- // esm format file +- import * as cjs from "inner/cjs/index.cjs"; +- import * as mjs from "inner/mjs/index.mjs"; +- import * as type from "inner/js/index.js"; +- export { cjs }; +- export { mjs }; +- export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; \ No newline at end of file +- // cjs format file +- import * as cjs from "inner/cjs/index.cjs"; +- import * as mjs from "inner/mjs/index.mjs"; +- import * as type from "inner/js/index.js"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- } +-==== node_modules/inner/package.json (0 errors) ==== +- { +- "name": "inner", +- "private": true, +- "exports": { +- "./cjs/*.cjs": "./*.cjs", +- "./mjs/*.mjs": "./*.mjs", +- "./js/*.js": "./*.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt index e58bcaf69d..6489409b7b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt @@ -1,13 +1,11 @@ index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -index.mts(5,33): error TS2339: Property 'name' does not exist on type 'string'. index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. index.ts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -==== index.ts (3 errors) ==== +==== index.ts (2 errors) ==== import pkg from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -17,8 +15,6 @@ index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== index.cts (1 errors) ==== import pkg from "./package.json"; export const name = pkg.name; @@ -27,7 +23,7 @@ index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. export const name2 = ns.default.name; ~~~~ !!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (3 errors) ==== +==== index.mts (2 errors) ==== import pkg from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -37,8 +33,6 @@ index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff index 4eca1a3e61..6e52fd3548 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff @@ -4,45 +4,20 @@ +index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+index.mts(5,33): error TS2339: Property 'name' does not exist on type 'string'. index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - index.ts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -- -- --==== index.ts (2 errors) ==== -+index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+==== index.ts (3 errors) ==== - import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -@@= skipped -13, +16 lines =@@ +@@= skipped -13, +14 lines =@@ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; -==== index.cts (0 errors) ==== -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. +==== index.cts (1 errors) ==== import pkg from "./package.json"; export const name = pkg.name; import * as ns from "./package.json"; export const thing = ns; export const name2 = ns.default.name; --==== index.mts (2 errors) ==== + ~~~~ +!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (3 errors) ==== + ==== index.mts (2 errors) ==== import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -@@= skipped -16, +20 lines =@@ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export const thing = ns; - export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. - ==== package.json (0 errors) ==== - { - "name": "pkg", \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js index 0debb13709..0dc0d13c8d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js @@ -78,12 +78,14 @@ export const name2 = ns.default.name; //// [index.d.ts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.cts] export declare const name: string; export declare const thing: { @@ -96,9 +98,11 @@ export declare const name2: any; //// [index.d.mts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff index 71a734fc7f..23c7c75cb5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff @@ -45,26 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -@@= skipped -38, +28 lines =@@ - //// [index.d.ts] - export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.cts] - export declare const name: string; - export declare const thing: { +@@= skipped -52, +42 lines =@@ name: string; version: string; type: string; @@ -80,17 +61,4 @@ +export declare const name2: any; //// [index.d.mts] export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; \ No newline at end of file + export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols index 1fe2f280f8..2d76a809e0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols @@ -19,9 +19,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) ->ns.default : Symbol("default", Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol("default", Decl(package.json, 3, 21)) +>default : Symbol(default) +>name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === import pkg from "./package.json"; @@ -65,9 +67,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.mts, 4, 12)) ->ns.default : Symbol("default", Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.mts, 2, 6)) ->default : Symbol("default", Decl(package.json, 3, 21)) +>default : Symbol(default) +>name : Symbol("name", Decl(package.json, 0, 1)) === package.json === { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff index 9cc1ac541c..110f5f6642 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff @@ -1,20 +1,18 @@ --- old.nodeModulesResolveJsonModule(module=node16).symbols +++ new.nodeModulesResolveJsonModule(module=node16).symbols -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) + >ns.default.name : Symbol("name", Decl(package.json, 0, 1)) ->ns.default : Symbol("package") -+>ns.default : Symbol("default", Decl(package.json, 3, 21)) ++>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol("default", Decl(package.json, 3, 21)) ++>default : Symbol(default) + >name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === - import pkg from "./package.json"; -@@= skipped -25, +23 lines =@@ +@@= skipped -24, +24 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) @@ -28,17 +26,15 @@ === index.mts === import pkg from "./package.json" with { type: "json" }; -@@= skipped -25, +23 lines =@@ - +@@= skipped -26, +24 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.mts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) + >ns.default.name : Symbol("name", Decl(package.json, 0, 1)) ->ns.default : Symbol("package") -+>ns.default : Symbol("default", Decl(package.json, 3, 21)) ++>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.mts, 2, 6)) ->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol("default", Decl(package.json, 3, 21)) ++>default : Symbol(default) + >name : Symbol("name", Decl(package.json, 0, 1)) - === package.json === - { \ No newline at end of file + === package.json === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types index 016230ef6f..8fd2b5dc73 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types @@ -12,20 +12,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.cts === import pkg from "./package.json"; @@ -64,20 +64,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === package.json === { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff index 721162ccab..cf78840e09 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff @@ -1,36 +1,6 @@ --- old.nodeModulesResolveJsonModule(module=node16).types +++ new.nodeModulesResolveJsonModule(module=node16).types -@@= skipped -11, +11 lines =@@ - >name : string - - import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - >type : any - - export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === index.cts === - import pkg from "./package.json"; -@@= skipped -26, +26 lines =@@ +@@= skipped -37, +37 lines =@@ >name : string import * as ns from "./package.json"; @@ -58,34 +28,4 @@ +>name : any === index.mts === - import pkg from "./package.json" with { type: "json" }; -@@= skipped -26, +26 lines =@@ - >name : string - - import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - >type : any - - export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === package.json === - { \ No newline at end of file + import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt index e58bcaf69d..25c8da6d8e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt @@ -1,44 +1,29 @@ +index.cts(2,25): error TS2339: Property 'name' does not exist on type 'string'. index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -index.mts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -index.ts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const name = pkg.name; import * as ns from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.cts (1 errors) ==== +==== index.cts (2 errors) ==== import pkg from "./package.json"; export const name = pkg.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type 'string'. import * as ns from "./package.json"; export const thing = ns; export const name2 = ns.default.name; ~~~~ !!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const name = pkg.name; import * as ns from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff index ad97d42571..a992636f5a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff @@ -2,47 +2,32 @@ +++ new.nodeModulesResolveJsonModule(module=node18).errors.txt @@= skipped -0, +0 lines =@@ - ++index.cts(2,25): error TS2339: Property 'name' does not exist on type 'string'. +index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+index.mts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+index.ts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. + + -+==== index.ts (3 errors) ==== ++==== index.ts (0 errors) ==== + import pkg from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + export const name = pkg.name; + import * as ns from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + export const thing = ns; + export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.cts (1 errors) ==== ++==== index.cts (2 errors) ==== + import pkg from "./package.json"; + export const name = pkg.name; ++ ~~~~ ++!!! error TS2339: Property 'name' does not exist on type 'string'. + import * as ns from "./package.json"; + export const thing = ns; + export const name2 = ns.default.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (3 errors) ==== ++==== index.mts (0 errors) ==== + import pkg from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + export const name = pkg.name; + import * as ns from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. + export const thing = ns; + export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. +==== package.json (0 errors) ==== + { + "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js index 127ee490dd..7575e58f0c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js @@ -58,14 +58,16 @@ exports.name2 = ns.default.name; //// [index.d.ts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.cts] -export declare const name: string; +export declare const name: any; export declare const thing: { name: string; version: string; @@ -76,9 +78,11 @@ export declare const name2: any; //// [index.d.mts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff index 632b73db44..2a50e0db74 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff @@ -89,23 +89,12 @@ //// [index.d.ts] - export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; +@@= skipped -78, +41 lines =@@ }; --export declare const name2: string; -+export declare const name2: any; + export declare const name2: string; //// [index.d.cts] - export declare const name: string; +-export declare const name: string; ++export declare const name: any; export declare const thing: { name: string; version: string; @@ -122,17 +111,4 @@ +export declare const name2: any; //// [index.d.mts] export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; \ No newline at end of file + export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols index 1fe2f280f8..65b05c682b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols @@ -19,9 +19,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) ->ns.default : Symbol("default", Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol("default", Decl(package.json, 3, 21)) +>default : Symbol(default) +>name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === import pkg from "./package.json"; @@ -29,9 +31,7 @@ import pkg from "./package.json"; export const name = pkg.name; >name : Symbol(name, Decl(index.cts, 1, 12)) ->pkg.name : Symbol("name", Decl(package.json, 0, 1)) >pkg : Symbol(pkg, Decl(index.cts, 0, 6)) ->name : Symbol("name", Decl(package.json, 0, 1)) import * as ns from "./package.json"; >ns : Symbol(ns, Decl(index.cts, 2, 6)) @@ -65,9 +65,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.mts, 4, 12)) ->ns.default : Symbol("default", Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.mts, 2, 6)) ->default : Symbol("default", Decl(package.json, 3, 21)) +>default : Symbol(default) +>name : Symbol("name", Decl(package.json, 0, 1)) === package.json === { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff index 20c06f03a1..c78a700a12 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff @@ -1,20 +1,28 @@ --- old.nodeModulesResolveJsonModule(module=node18).symbols +++ new.nodeModulesResolveJsonModule(module=node18).symbols -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) + >ns.default.name : Symbol("name", Decl(package.json, 0, 1)) ->ns.default : Symbol("package") -+>ns.default : Symbol("default", Decl(package.json, 3, 21)) ++>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol("default", Decl(package.json, 3, 21)) ++>default : Symbol(default) + >name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === - import pkg from "./package.json"; -@@= skipped -25, +23 lines =@@ +@@= skipped -11, +11 lines =@@ + + export const name = pkg.name; + >name : Symbol(name, Decl(index.cts, 1, 12)) +->pkg.name : Symbol("name", Decl(package.json, 0, 1)) + >pkg : Symbol(pkg, Decl(index.cts, 0, 6)) +->name : Symbol("name", Decl(package.json, 0, 1)) + + import * as ns from "./package.json"; + >ns : Symbol(ns, Decl(index.cts, 2, 6)) +@@= skipped -13, +11 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) @@ -28,17 +36,15 @@ === index.mts === import pkg from "./package.json" with { type: "json" }; -@@= skipped -25, +23 lines =@@ - +@@= skipped -26, +24 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.mts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) + >ns.default.name : Symbol("name", Decl(package.json, 0, 1)) ->ns.default : Symbol("package") -+>ns.default : Symbol("default", Decl(package.json, 3, 21)) ++>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.mts, 2, 6)) ->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol("default", Decl(package.json, 3, 21)) ++>default : Symbol(default) + >name : Symbol("name", Decl(package.json, 0, 1)) - === package.json === - { \ No newline at end of file + === package.json === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types index 016230ef6f..915882d58a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types @@ -12,30 +12,30 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.cts === import pkg from "./package.json"; ->pkg : { name: string; version: string; type: string; default: string; } +>pkg : string export const name = pkg.name; ->name : string ->pkg.name : string ->pkg : { name: string; version: string; type: string; default: string; } ->name : string +>name : any +>pkg.name : any +>pkg : string +>name : any import * as ns from "./package.json"; >ns : { name: string; version: string; type: string; default: string; } @@ -64,20 +64,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === package.json === { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff index 131b877dcf..55b9ba98d8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff @@ -9,39 +9,31 @@ export const name = pkg.name; >name : string -@@= skipped -9, +9 lines =@@ - >name : string +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } + >ns : { default: { name: string; version: string; type: string; default: string; }; } ->type : error -+>ns : { name: string; version: string; type: string; default: string; } +>type : any export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any + >thing : { default: { name: string; version: string; type: string; default: string; }; } +@@= skipped -16, +16 lines =@@ === index.cts === import pkg from "./package.json"; -@@= skipped -26, +26 lines =@@ - >name : string +->pkg : { name: string; version: string; type: string; default: string; } ++>pkg : string + + export const name = pkg.name; +->name : string +->pkg.name : string +->pkg : { name: string; version: string; type: string; default: string; } +->name : string ++>name : any ++>pkg.name : any ++>pkg : string ++>name : any import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } @@ -75,34 +67,12 @@ export const name = pkg.name; >name : string -@@= skipped -26, +26 lines =@@ - >name : string +@@= skipped -36, +36 lines =@@ import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } + >ns : { default: { name: string; version: string; type: string; default: string; }; } ->type : error -+>ns : { name: string; version: string; type: string; default: string; } +>type : any export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === package.json === - { \ No newline at end of file + >thing : { default: { name: string; version: string; type: string; default: string; }; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt index 96d31a39cb..10ebcd6562 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt @@ -1,24 +1,12 @@ index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -index.mts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.mts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.mts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -index.ts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.ts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export const name = pkg.name; import * as ns from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== index.cts (1 errors) ==== import pkg from "./package.json"; export const name = pkg.name; @@ -27,18 +15,12 @@ index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. export const name2 = ns.default.name; ~~~~ !!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export const name = pkg.name; import * as ns from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff index f971898143..3aaa56d587 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff @@ -3,26 +3,14 @@ @@= skipped -0, +0 lines =@@ - +index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+index.mts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.mts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.mts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+index.ts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.ts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. + + -+==== index.ts (3 errors) ==== ++==== index.ts (0 errors) ==== + import pkg from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + export const name = pkg.name; + import * as ns from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + export const thing = ns; + export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. +==== index.cts (1 errors) ==== + import pkg from "./package.json"; + export const name = pkg.name; @@ -31,18 +19,12 @@ + export const name2 = ns.default.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (3 errors) ==== ++==== index.mts (0 errors) ==== + import pkg from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + export const name = pkg.name; + import * as ns from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + export const thing = ns; + export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. +==== package.json (0 errors) ==== + { + "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js index 0debb13709..0dc0d13c8d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js @@ -78,12 +78,14 @@ export const name2 = ns.default.name; //// [index.d.ts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.cts] export declare const name: string; export declare const thing: { @@ -96,9 +98,11 @@ export declare const name2: any; //// [index.d.mts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff index f3d88d4568..17bf3670d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff @@ -45,26 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -@@= skipped -38, +28 lines =@@ - //// [index.d.ts] - export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.cts] - export declare const name: string; - export declare const thing: { +@@= skipped -52, +42 lines =@@ name: string; version: string; type: string; @@ -80,17 +61,4 @@ +export declare const name2: any; //// [index.d.mts] export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; \ No newline at end of file + export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols index 1fe2f280f8..2d76a809e0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols @@ -19,9 +19,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) ->ns.default : Symbol("default", Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol("default", Decl(package.json, 3, 21)) +>default : Symbol(default) +>name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === import pkg from "./package.json"; @@ -65,9 +67,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.mts, 4, 12)) ->ns.default : Symbol("default", Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.mts, 2, 6)) ->default : Symbol("default", Decl(package.json, 3, 21)) +>default : Symbol(default) +>name : Symbol("name", Decl(package.json, 0, 1)) === package.json === { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff index 49d207277e..7c989222da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff @@ -1,20 +1,18 @@ --- old.nodeModulesResolveJsonModule(module=nodenext).symbols +++ new.nodeModulesResolveJsonModule(module=nodenext).symbols -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) + >ns.default.name : Symbol("name", Decl(package.json, 0, 1)) ->ns.default : Symbol("package") -+>ns.default : Symbol("default", Decl(package.json, 3, 21)) ++>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol("default", Decl(package.json, 3, 21)) ++>default : Symbol(default) + >name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === - import pkg from "./package.json"; -@@= skipped -25, +23 lines =@@ +@@= skipped -24, +24 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) @@ -28,17 +26,15 @@ === index.mts === import pkg from "./package.json" with { type: "json" }; -@@= skipped -25, +23 lines =@@ - +@@= skipped -26, +24 lines =@@ export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.mts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) + >ns.default.name : Symbol("name", Decl(package.json, 0, 1)) ->ns.default : Symbol("package") -+>ns.default : Symbol("default", Decl(package.json, 3, 21)) ++>ns.default : Symbol(default) >ns : Symbol(ns, Decl(index.mts, 2, 6)) ->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol("default", Decl(package.json, 3, 21)) ++>default : Symbol(default) + >name : Symbol("name", Decl(package.json, 0, 1)) - === package.json === - { \ No newline at end of file + === package.json === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types index 016230ef6f..8fd2b5dc73 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types @@ -12,20 +12,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.cts === import pkg from "./package.json"; @@ -64,20 +64,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === package.json === { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff index 26203f449e..2dbb41b979 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff @@ -9,38 +9,16 @@ export const name = pkg.name; >name : string -@@= skipped -9, +9 lines =@@ - >name : string +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } + >ns : { default: { name: string; version: string; type: string; default: string; }; } ->type : error -+>ns : { name: string; version: string; type: string; default: string; } +>type : any export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === index.cts === - import pkg from "./package.json"; -@@= skipped -26, +26 lines =@@ + >thing : { default: { name: string; version: string; type: string; default: string; }; } +@@= skipped -25, +25 lines =@@ >name : string import * as ns from "./package.json"; @@ -75,34 +53,12 @@ export const name = pkg.name; >name : string -@@= skipped -26, +26 lines =@@ - >name : string +@@= skipped -27, +27 lines =@@ import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } + >ns : { default: { name: string; version: string; type: string; default: string; }; } ->type : error -+>ns : { name: string; version: string; type: string; default: string; } +>type : any export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === package.json === - { \ No newline at end of file + >thing : { default: { name: string; version: string; type: string; default: string; }; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types index 9e80a34c40..f4631698cc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types @@ -25,9 +25,9 @@ export async function f() { >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); ->mod4 : typeof mod2 ->await import ("./index.js") : typeof mod2 ->import ("./index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./index.js") : { f(): Promise; default: typeof mod2; } +>import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./index.js" : "./index.js" h(); @@ -59,9 +59,9 @@ export async function h() { >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); ->mod4 : typeof mod2 ->await import ("./subfolder/index.js") : typeof mod2 ->import ("./subfolder/index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } +>import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./subfolder/index.js" : "./subfolder/index.js" f(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types.diff deleted file mode 100644 index 0caf21b76b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node16).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node16).types -+++ new.nodeModulesSynchronousCallErrors(module=node16).types -@@= skipped -24, +24 lines =@@ - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./index.js") : { f(): Promise; default: typeof mod2; } -->import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./index.js") : typeof mod2 -+>import ("./index.js") : Promise - >"./index.js" : "./index.js" - - h(); -@@= skipped -34, +34 lines =@@ - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } -->import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./subfolder/index.js") : typeof mod2 -+>import ("./subfolder/index.js") : Promise - >"./subfolder/index.js" : "./subfolder/index.js" - - f(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt index 161fab45dd..44537a76c9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt @@ -1,45 +1,36 @@ -error TS2468: Cannot find global value 'Promise'. -index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +subfolder/index.ts(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. + To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. +subfolder/index.ts(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.ts (3 errors) ==== +==== subfolder/index.ts (2 errors) ==== // cjs format file import {h} from "../index.js"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. +!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. import mod = require("../index.js"); + ~~~~~~~~~~~~~ +!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import {f as _f} from "./index.js"; import mod2 = require("./index.js"); export async function f() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. h(); } -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import {h as _h} from "./index.js"; import mod = require("./index.js"); + ~~~~~~~~~~~~ +!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import {f} from "./subfolder/index.js"; import mod2 = require("./subfolder/index.js"); export async function h() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. f(); } ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt.diff deleted file mode 100644 index 636141a78b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node18).errors.txt.diff +++ /dev/null @@ -1,63 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node18).errors.txt -+++ new.nodeModulesSynchronousCallErrors(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.ts(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --subfolder/index.ts(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -- To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. --subfolder/index.ts(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -- -- --==== subfolder/index.ts (2 errors) ==== -+error TS2468: Cannot find global value 'Promise'. -+index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.ts (3 errors) ==== - // cjs format file - import {h} from "../index.js"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. --!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. - import mod = require("../index.js"); -- ~~~~~~~~~~~~~ --!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f as _f} from "./index.js"; - import mod2 = require("./index.js"); - export async function f() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("../index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - h(); - } --==== index.ts (1 errors) ==== -+==== index.ts (3 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); -- ~~~~~~~~~~~~ --!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f} from "./subfolder/index.js"; - import mod2 = require("./subfolder/index.js"); - export async function h() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./subfolder/index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - f(); - } - ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt deleted file mode 100644 index 44537a76c9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt +++ /dev/null @@ -1,45 +0,0 @@ -index.ts(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -subfolder/index.ts(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. - To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. -subfolder/index.ts(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - - -==== subfolder/index.ts (2 errors) ==== - // cjs format file - import {h} from "../index.js"; - ~~~~~~~~~~~~~ -!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. - import mod = require("../index.js"); - ~~~~~~~~~~~~~ -!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f as _f} from "./index.js"; - import mod2 = require("./index.js"); - export async function f() { - const mod3 = await import ("../index.js"); - const mod4 = await import ("./index.js"); - h(); - } -==== index.ts (1 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); - ~~~~~~~~~~~~ -!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f} from "./subfolder/index.js"; - import mod2 = require("./subfolder/index.js"); - export async function h() { - const mod3 = await import ("./index.js"); - const mod4 = await import ("./subfolder/index.js"); - f(); - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt.diff deleted file mode 100644 index b84e52326b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=nodenext).errors.txt -+++ new.nodeModulesSynchronousCallErrors(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+subfolder/index.ts(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -+ To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. -+subfolder/index.ts(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+ -+ -+==== subfolder/index.ts (2 errors) ==== -+ // cjs format file -+ import {h} from "../index.js"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -+!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. -+ import mod = require("../index.js"); -+ ~~~~~~~~~~~~~ -+!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+ import {f as _f} from "./index.js"; -+ import mod2 = require("./index.js"); -+ export async function f() { -+ const mod3 = await import ("../index.js"); -+ const mod4 = await import ("./index.js"); -+ h(); -+ } -+==== index.ts (1 errors) ==== -+ // esm format file -+ import {h as _h} from "./index.js"; -+ import mod = require("./index.js"); -+ ~~~~~~~~~~~~ -+!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+ import {f} from "./subfolder/index.js"; -+ import mod2 = require("./subfolder/index.js"); -+ export async function h() { -+ const mod3 = await import ("./index.js"); -+ const mod4 = await import ("./subfolder/index.js"); -+ f(); -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types index 9e80a34c40..f4631698cc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types @@ -25,9 +25,9 @@ export async function f() { >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); ->mod4 : typeof mod2 ->await import ("./index.js") : typeof mod2 ->import ("./index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./index.js") : { f(): Promise; default: typeof mod2; } +>import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./index.js" : "./index.js" h(); @@ -59,9 +59,9 @@ export async function h() { >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); ->mod4 : typeof mod2 ->await import ("./subfolder/index.js") : typeof mod2 ->import ("./subfolder/index.js") : Promise +>mod4 : { f(): Promise; default: typeof mod2; } +>await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } +>import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> >"./subfolder/index.js" : "./subfolder/index.js" f(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types.diff deleted file mode 100644 index 205f7503d2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=nodenext).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=nodenext).types -+++ new.nodeModulesSynchronousCallErrors(module=nodenext).types -@@= skipped -24, +24 lines =@@ - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./index.js") : { f(): Promise; default: typeof mod2; } -->import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./index.js") : typeof mod2 -+>import ("./index.js") : Promise - >"./index.js" : "./index.js" - - h(); -@@= skipped -34, +34 lines =@@ - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } -->import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./subfolder/index.js") : typeof mod2 -+>import ("./subfolder/index.js") : Promise - >"./subfolder/index.js" : "./subfolder/index.js" - - f(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt index af867ac388..0fd2e5390c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt @@ -1,27 +1,21 @@ -index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. ==== subfolder/index.ts (2 errors) ==== // cjs format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -==== index.ts (2 errors) ==== +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.ts (0 errors) ==== // esm format file const x = await 1; - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} - ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt.diff deleted file mode 100644 index c048b2a5bc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node18).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTopLevelAwait(module=node18).errors.txt -+++ new.nodeModulesTopLevelAwait(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - - - ==== subfolder/index.ts (2 errors) ==== - // cjs format file - const x = await 1; - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --==== index.ts (0 errors) ==== -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+==== index.ts (2 errors) ==== - // esm format file - const x = await 1; -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} -+ ~~~~~ -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt deleted file mode 100644 index d07fb3dfc1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. - - -==== /index.ts (1 errors) ==== - /// - export interface LocalInterface extends ImportInterface {} - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ImportInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt.diff deleted file mode 100644 index ea0652cf75..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. -+ -+ -+==== /index.ts (1 errors) ==== -+ /// -+ export interface LocalInterface extends ImportInterface {} -+ ~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'ImportInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js index 89bc75d1fe..ad43258895 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js @@ -37,3 +37,41 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] export interface LocalInterface extends ImportInterface { } + + +//// [DtsFileErrors] + + +out/index.d.ts(1,41): error TS2304: Cannot find name 'ImportInterface'. + + +==== out/index.d.ts (1 errors) ==== + export interface LocalInterface extends ImportInterface { + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + } + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface {} + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface {} + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js.diff index 6cf684d0d3..8029440b1d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js.diff @@ -13,4 +13,42 @@ //// [index.d.ts] -/// export interface LocalInterface extends ImportInterface { - } \ No newline at end of file + } ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/index.d.ts(1,41): error TS2304: Cannot find name 'ImportInterface'. ++ ++ ++==== out/index.d.ts (1 errors) ==== ++ export interface LocalInterface extends ImportInterface { ++ ~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'ImportInterface'. ++ } ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export {}; ++ declare global { ++ interface ImportInterface {} ++ } ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export {}; ++ declare global { ++ interface RequireInterface {} ++ } ++==== /package.json (0 errors) ==== ++ { ++ "private": true, ++ "type": "module" ++ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols index f410e5fca7..dfccc41309 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols @@ -4,12 +4,13 @@ /// export interface LocalInterface extends ImportInterface {} >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { ->global : Symbol(global, Decl(require.d.ts, 0, 10)) +>global : Symbol(global, Decl(import.d.ts, 0, 10)) - interface RequireInterface {} ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) + interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols.diff deleted file mode 100644 index 5c1b00fec5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols -@@= skipped -3, +3 lines =@@ - /// - export interface LocalInterface extends ImportInterface {} - >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) - --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -+>global : Symbol(global, Decl(require.d.ts, 0, 10)) - -- interface ImportInterface {} -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -+ interface RequireInterface {} -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types index 161a51956e..f2f8e65465 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types @@ -4,10 +4,10 @@ /// export interface LocalInterface extends ImportInterface {} -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { >global : any - interface RequireInterface {} + interface ImportInterface {} } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types.diff deleted file mode 100644 index 7e11085772..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types -@@= skipped -3, +3 lines =@@ - - /// - export interface LocalInterface extends ImportInterface {} --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { - >global : any - -- interface ImportInterface {} -+ interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt deleted file mode 100644 index bb4c18976f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. - - -==== /index.ts (1 errors) ==== - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" - import obj2 from "./sub2/uses.js" - export default [obj1, obj2.default] as const; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface { _i: any; } - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface { _r: any; } - function getInterR(): RequireInterface; - } -==== /sub1/uses.ts (0 errors) ==== - /// - export default getInterI(); -==== /sub1/package.json (0 errors) ==== - { - "private": true, - "type": "module" - } -==== /sub2/uses.ts (0 errors) ==== - /// - export default getInterR(); -==== /sub2/package.json (0 errors) ==== - { - "private": true, - "type": "commonjs" - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt.diff deleted file mode 100644 index 3d3925d48f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt.diff +++ /dev/null @@ -1,56 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+ -+ -+==== /index.ts (1 errors) ==== -+ // only an esm file can `import` both kinds of files -+ import obj1 from "./sub1/uses.js" -+ import obj2 from "./sub2/uses.js" -+ export default [obj1, obj2.default] as const; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface { _i: any; } -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface { _r: any; } -+ function getInterR(): RequireInterface; -+ } -+==== /sub1/uses.ts (0 errors) ==== -+ /// -+ export default getInterI(); -+==== /sub1/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } -+==== /sub2/uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); -+==== /sub2/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "commonjs" -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js index a584c2db77..41e3b9ac02 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js @@ -70,5 +70,66 @@ export default _default; declare const _default: RequireInterface; export default _default; //// [index.d.ts] -declare const _default: readonly [ImportInterface, any]; +declare const _default: readonly [ImportInterface, RequireInterface]; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. +out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (2 errors) ==== + declare const _default: readonly [ImportInterface, RequireInterface]; + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface { _i: any; } + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface { _r: any; } + function getInterR(): RequireInterface; + } +==== out/sub1/uses.d.ts (0 errors) ==== + declare const _default: ImportInterface; + export default _default; + +==== /sub1/package.json (0 errors) ==== + { + "private": true, + "type": "module" + } +==== out/sub2/uses.d.ts (0 errors) ==== + declare const _default: RequireInterface; + export default _default; + +==== /sub2/package.json (0 errors) ==== + { + "private": true, + "type": "commonjs" + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js.diff index e7cda6a316..8a030e993c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).js.diff @@ -12,69 +12,19 @@ declare const _default: RequireInterface; export default _default; //// [index.d.ts] --declare const _default: readonly [ImportInterface, RequireInterface]; -+declare const _default: readonly [ImportInterface, any]; - export default _default; -- -- --//// [DtsFileErrors] -- -- --out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. --out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. -- -- --==== out/index.d.ts (2 errors) ==== -- declare const _default: readonly [ImportInterface, RequireInterface]; -- ~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'ImportInterface'. -- ~~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'RequireInterface'. -- export default _default; -- --==== /node_modules/pkg/package.json (0 errors) ==== -- { -- "name": "pkg", -- "version": "0.0.1", -- "exports": { -- "import": "./import.js", -- "require": "./require.js" -- } -- } --==== /node_modules/pkg/import.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface ImportInterface { _i: any; } -- function getInterI(): ImportInterface; -- } --==== /node_modules/pkg/require.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface RequireInterface { _r: any; } -- function getInterR(): RequireInterface; -- } --==== out/sub1/uses.d.ts (0 errors) ==== +@@= skipped -49, +47 lines =@@ + function getInterR(): RequireInterface; + } + ==== out/sub1/uses.d.ts (0 errors) ==== - /// -- declare const _default: ImportInterface; -- export default _default; -- --==== /sub1/package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } --==== out/sub2/uses.d.ts (0 errors) ==== + declare const _default: ImportInterface; + export default _default; + +@@= skipped -10, +9 lines =@@ + "type": "module" + } + ==== out/sub2/uses.d.ts (0 errors) ==== - /// -- declare const _default: RequireInterface; -- export default _default; -- --==== /sub2/package.json (0 errors) ==== -- { -- "private": true, -- "type": "commonjs" -- } --==== /package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } \ No newline at end of file + declare const _default: RequireInterface; + export default _default; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols index 69f4886b16..d87554a0f4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols @@ -10,7 +10,9 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) +>obj2.default : Symbol(default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) +>default : Symbol(default, Decl(uses.ts, 0, 0)) >const : Symbol(const) === /node_modules/pkg/import.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols.diff index 11c9e53c86..dbbc02c20e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).symbols.diff @@ -5,12 +5,14 @@ export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) ->obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) ++>obj2.default : Symbol(default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) ->default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) ++>default : Symbol(default, Decl(uses.ts, 0, 0)) >const : Symbol(const) === /node_modules/pkg/import.d.ts === -@@= skipped -12, +10 lines =@@ +@@= skipped -12, +12 lines =@@ interface ImportInterface { _i: any; } >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types index feec0c28a6..8fe9ea5bac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types @@ -6,15 +6,15 @@ import obj1 from "./sub1/uses.js" >obj1 : ImportInterface import obj2 from "./sub2/uses.js" ->obj2 : RequireInterface +>obj2 : typeof obj2 export default [obj1, obj2.default] as const; ->[obj1, obj2.default] as const : readonly [ImportInterface, any] ->[obj1, obj2.default] : readonly [ImportInterface, any] +>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] +>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] >obj1 : ImportInterface ->obj2.default : any ->obj2 : RequireInterface ->default : any +>obj2.default : RequireInterface +>obj2 : typeof obj2 +>default : RequireInterface === /node_modules/pkg/import.d.ts === export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types.diff deleted file mode 100644 index 91c989224d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node16).types -@@= skipped -5, +5 lines =@@ - >obj1 : ImportInterface - - import obj2 from "./sub2/uses.js" -->obj2 : typeof obj2 -+>obj2 : RequireInterface - - export default [obj1, obj2.default] as const; -->[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] -->[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] -+>[obj1, obj2.default] as const : readonly [ImportInterface, any] -+>[obj1, obj2.default] : readonly [ImportInterface, any] - >obj1 : ImportInterface -->obj2.default : RequireInterface -->obj2 : typeof obj2 -->default : RequireInterface -+>obj2.default : any -+>obj2 : RequireInterface -+>default : any - - === /node_modules/pkg/import.d.ts === - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt deleted file mode 100644 index d6ecea604b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt +++ /dev/null @@ -1,56 +0,0 @@ -/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -/sub1/uses.ts(2,16): error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? - - -==== /index.ts (1 errors) ==== - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" - import obj2 from "./sub2/uses.js" - export default [obj1, obj2.default] as const; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface { _i: any; } - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface { _r: any; } - function getInterR(): RequireInterface; - } -==== /sub1/uses.ts (1 errors) ==== - /// - export default getInterI(); - ~~~~~~~~~ -!!! error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -!!! related TS2728 /node_modules/pkg/require.d.ts:4:14: 'getInterR' is declared here. -==== /sub1/package.json (0 errors) ==== - { - "private": true, - "type": "module" - } -==== /sub2/uses.ts (0 errors) ==== - /// - export default getInterR(); -==== /sub2/package.json (0 errors) ==== - { - "private": true, - "type": "commonjs" - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt.diff deleted file mode 100644 index b117d89af0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+/sub1/uses.ts(2,16): error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -+ -+ -+==== /index.ts (1 errors) ==== -+ // only an esm file can `import` both kinds of files -+ import obj1 from "./sub1/uses.js" -+ import obj2 from "./sub2/uses.js" -+ export default [obj1, obj2.default] as const; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface { _i: any; } -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface { _r: any; } -+ function getInterR(): RequireInterface; -+ } -+==== /sub1/uses.ts (1 errors) ==== -+ /// -+ export default getInterI(); -+ ~~~~~~~~~ -+!!! error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -+!!! related TS2728 /node_modules/pkg/require.d.ts:4:14: 'getInterR' is declared here. -+==== /sub1/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } -+==== /sub2/uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); -+==== /sub2/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "commonjs" -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js index 1893540c96..bb5bbb5856 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js @@ -68,11 +68,72 @@ exports.default = [uses_js_1.default, uses_js_2.default.default]; //// [uses.d.ts] -declare const _default: any; +declare const _default: ImportInterface; export default _default; //// [uses.d.ts] declare const _default: RequireInterface; export default _default; //// [index.d.ts] -declare const _default: readonly [any, any]; +declare const _default: readonly [ImportInterface, RequireInterface]; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. +out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (2 errors) ==== + declare const _default: readonly [ImportInterface, RequireInterface]; + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface { _i: any; } + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface { _r: any; } + function getInterR(): RequireInterface; + } +==== out/sub1/uses.d.ts (0 errors) ==== + declare const _default: ImportInterface; + export default _default; + +==== /sub1/package.json (0 errors) ==== + { + "private": true, + "type": "module" + } +==== out/sub2/uses.d.ts (0 errors) ==== + declare const _default: RequireInterface; + export default _default; + +==== /sub2/package.json (0 errors) ==== + { + "private": true, + "type": "commonjs" + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js.diff index 3b52c90776..b6bda16489 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js.diff @@ -28,77 +28,26 @@ //// [uses.d.ts] -/// --declare const _default: ImportInterface; -+declare const _default: any; + declare const _default: ImportInterface; export default _default; //// [uses.d.ts] -/// declare const _default: RequireInterface; export default _default; //// [index.d.ts] --declare const _default: readonly [ImportInterface, RequireInterface]; -+declare const _default: readonly [any, any]; - export default _default; -- -- --//// [DtsFileErrors] -- -- --out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. --out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. -- -- --==== out/index.d.ts (2 errors) ==== -- declare const _default: readonly [ImportInterface, RequireInterface]; -- ~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'ImportInterface'. -- ~~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'RequireInterface'. -- export default _default; -- --==== /node_modules/pkg/package.json (0 errors) ==== -- { -- "name": "pkg", -- "version": "0.0.1", -- "exports": { -- "import": "./import.js", -- "require": "./require.js" -- } -- } --==== /node_modules/pkg/import.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface ImportInterface { _i: any; } -- function getInterI(): ImportInterface; -- } --==== /node_modules/pkg/require.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface RequireInterface { _r: any; } -- function getInterR(): RequireInterface; -- } --==== out/sub1/uses.d.ts (0 errors) ==== +@@= skipped -64, +66 lines =@@ + function getInterR(): RequireInterface; + } + ==== out/sub1/uses.d.ts (0 errors) ==== - /// -- declare const _default: ImportInterface; -- export default _default; -- --==== /sub1/package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } --==== out/sub2/uses.d.ts (0 errors) ==== + declare const _default: ImportInterface; + export default _default; + +@@= skipped -10, +9 lines =@@ + "type": "module" + } + ==== out/sub2/uses.d.ts (0 errors) ==== - /// -- declare const _default: RequireInterface; -- export default _default; -- --==== /sub2/package.json (0 errors) ==== -- { -- "private": true, -- "type": "commonjs" -- } --==== /package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } \ No newline at end of file + declare const _default: RequireInterface; + export default _default; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols index caebc3574f..d87554a0f4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols @@ -10,9 +10,24 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) +>obj2.default : Symbol(default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) +>default : Symbol(default, Decl(uses.ts, 0, 0)) >const : Symbol(const) +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + interface ImportInterface { _i: any; } +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +>_i : Symbol(_i, Decl(import.d.ts, 2, 31)) + + function getInterI(): ImportInterface; +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +} === /node_modules/pkg/require.d.ts === export {}; declare global { @@ -27,9 +42,10 @@ declare global { >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) } === /sub1/uses.ts === - /// export default getInterI(); +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) + === /sub2/uses.ts === /// export default getInterR(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols.diff index bde971819d..75889d7d2f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols.diff @@ -5,27 +5,23 @@ export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) ->obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) ++>obj2.default : Symbol(default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) ->default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) ++>default : Symbol(default, Decl(uses.ts, 0, 0)) >const : Symbol(const) --=== /node_modules/pkg/import.d.ts === --export {}; --declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -- -- interface ImportInterface { _i: any; } -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) + === /node_modules/pkg/import.d.ts === +@@= skipped -12, +12 lines =@@ + + interface ImportInterface { _i: any; } + >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) ->_i : Symbol(ImportInterface._i, Decl(import.d.ts, 2, 31)) -- -- function getInterI(): ImportInterface; -->getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) --} - === /node_modules/pkg/require.d.ts === - export {}; - declare global { -@@= skipped -25, +10 lines =@@ ++>_i : Symbol(_i, Decl(import.d.ts, 2, 31)) + + function getInterI(): ImportInterface; + >getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) +@@= skipped -13, +13 lines =@@ interface RequireInterface { _r: any; } >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) @@ -33,15 +29,4 @@ +>_r : Symbol(_r, Decl(require.d.ts, 2, 32)) function getInterR(): RequireInterface; - >getInterR : Symbol(getInterR, Decl(require.d.ts, 2, 43)) - >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) - } - === /sub1/uses.ts === -+ - /// - export default getInterI(); -->getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) -- - === /sub2/uses.ts === - /// - export default getInterR(); \ No newline at end of file + >getInterR : Symbol(getInterR, Decl(require.d.ts, 2, 43)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types index fc698ca4ed..8fe9ea5bac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types @@ -3,19 +3,30 @@ === /index.ts === // only an esm file can `import` both kinds of files import obj1 from "./sub1/uses.js" ->obj1 : any +>obj1 : ImportInterface import obj2 from "./sub2/uses.js" ->obj2 : RequireInterface +>obj2 : typeof obj2 export default [obj1, obj2.default] as const; ->[obj1, obj2.default] as const : readonly [any, any] ->[obj1, obj2.default] : readonly [any, any] ->obj1 : any ->obj2.default : any ->obj2 : RequireInterface ->default : any +>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] +>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] +>obj1 : ImportInterface +>obj2.default : RequireInterface +>obj2 : typeof obj2 +>default : RequireInterface + +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global + interface ImportInterface { _i: any; } +>_i : any + + function getInterI(): ImportInterface; +>getInterI : () => ImportInterface +} === /node_modules/pkg/require.d.ts === export {}; declare global { @@ -30,8 +41,8 @@ declare global { === /sub1/uses.ts === /// export default getInterI(); ->getInterI() : any ->getInterI : any +>getInterI() : ImportInterface +>getInterI : () => ImportInterface === /sub2/uses.ts === /// diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types.diff deleted file mode 100644 index 728747b8f1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types -@@= skipped -2, +2 lines =@@ - === /index.ts === - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" -->obj1 : ImportInterface -+>obj1 : any - - import obj2 from "./sub2/uses.js" -->obj2 : typeof obj2 -+>obj2 : RequireInterface - - export default [obj1, obj2.default] as const; -->[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] -->[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] -->obj1 : ImportInterface -->obj2.default : RequireInterface -->obj2 : typeof obj2 -->default : RequireInterface -- --=== /node_modules/pkg/import.d.ts === --export {}; --declare global { -->global : typeof global -- -- interface ImportInterface { _i: any; } -->_i : any -- -- function getInterI(): ImportInterface; -->getInterI : () => ImportInterface --} -+>[obj1, obj2.default] as const : readonly [any, any] -+>[obj1, obj2.default] : readonly [any, any] -+>obj1 : any -+>obj2.default : any -+>obj2 : RequireInterface -+>default : any -+ - === /node_modules/pkg/require.d.ts === - export {}; - declare global { -@@= skipped -38, +27 lines =@@ - === /sub1/uses.ts === - /// - export default getInterI(); -->getInterI() : ImportInterface -->getInterI : () => ImportInterface -+>getInterI() : any -+>getInterI : any - - === /sub2/uses.ts === - /// \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt deleted file mode 100644 index bb4c18976f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. - - -==== /index.ts (1 errors) ==== - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" - import obj2 from "./sub2/uses.js" - export default [obj1, obj2.default] as const; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface { _i: any; } - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface { _r: any; } - function getInterR(): RequireInterface; - } -==== /sub1/uses.ts (0 errors) ==== - /// - export default getInterI(); -==== /sub1/package.json (0 errors) ==== - { - "private": true, - "type": "module" - } -==== /sub2/uses.ts (0 errors) ==== - /// - export default getInterR(); -==== /sub2/package.json (0 errors) ==== - { - "private": true, - "type": "commonjs" - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt.diff deleted file mode 100644 index fd047af3e5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,56 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+ -+ -+==== /index.ts (1 errors) ==== -+ // only an esm file can `import` both kinds of files -+ import obj1 from "./sub1/uses.js" -+ import obj2 from "./sub2/uses.js" -+ export default [obj1, obj2.default] as const; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface { _i: any; } -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface { _r: any; } -+ function getInterR(): RequireInterface; -+ } -+==== /sub1/uses.ts (0 errors) ==== -+ /// -+ export default getInterI(); -+==== /sub1/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } -+==== /sub2/uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); -+==== /sub2/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "commonjs" -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js index a584c2db77..41e3b9ac02 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js @@ -70,5 +70,66 @@ export default _default; declare const _default: RequireInterface; export default _default; //// [index.d.ts] -declare const _default: readonly [ImportInterface, any]; +declare const _default: readonly [ImportInterface, RequireInterface]; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. +out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (2 errors) ==== + declare const _default: readonly [ImportInterface, RequireInterface]; + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface { _i: any; } + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface { _r: any; } + function getInterR(): RequireInterface; + } +==== out/sub1/uses.d.ts (0 errors) ==== + declare const _default: ImportInterface; + export default _default; + +==== /sub1/package.json (0 errors) ==== + { + "private": true, + "type": "module" + } +==== out/sub2/uses.d.ts (0 errors) ==== + declare const _default: RequireInterface; + export default _default; + +==== /sub2/package.json (0 errors) ==== + { + "private": true, + "type": "commonjs" + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js.diff index db50d153dc..f5c6eb4ddd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).js.diff @@ -12,69 +12,19 @@ declare const _default: RequireInterface; export default _default; //// [index.d.ts] --declare const _default: readonly [ImportInterface, RequireInterface]; -+declare const _default: readonly [ImportInterface, any]; - export default _default; -- -- --//// [DtsFileErrors] -- -- --out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. --out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. -- -- --==== out/index.d.ts (2 errors) ==== -- declare const _default: readonly [ImportInterface, RequireInterface]; -- ~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'ImportInterface'. -- ~~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'RequireInterface'. -- export default _default; -- --==== /node_modules/pkg/package.json (0 errors) ==== -- { -- "name": "pkg", -- "version": "0.0.1", -- "exports": { -- "import": "./import.js", -- "require": "./require.js" -- } -- } --==== /node_modules/pkg/import.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface ImportInterface { _i: any; } -- function getInterI(): ImportInterface; -- } --==== /node_modules/pkg/require.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface RequireInterface { _r: any; } -- function getInterR(): RequireInterface; -- } --==== out/sub1/uses.d.ts (0 errors) ==== +@@= skipped -49, +47 lines =@@ + function getInterR(): RequireInterface; + } + ==== out/sub1/uses.d.ts (0 errors) ==== - /// -- declare const _default: ImportInterface; -- export default _default; -- --==== /sub1/package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } --==== out/sub2/uses.d.ts (0 errors) ==== + declare const _default: ImportInterface; + export default _default; + +@@= skipped -10, +9 lines =@@ + "type": "module" + } + ==== out/sub2/uses.d.ts (0 errors) ==== - /// -- declare const _default: RequireInterface; -- export default _default; -- --==== /sub2/package.json (0 errors) ==== -- { -- "private": true, -- "type": "commonjs" -- } --==== /package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } \ No newline at end of file + declare const _default: RequireInterface; + export default _default; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols index 69f4886b16..d87554a0f4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols @@ -10,7 +10,9 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) +>obj2.default : Symbol(default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) +>default : Symbol(default, Decl(uses.ts, 0, 0)) >const : Symbol(const) === /node_modules/pkg/import.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols.diff index bfa5b5f78c..7b220ae6f2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).symbols.diff @@ -5,12 +5,14 @@ export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) ->obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) ++>obj2.default : Symbol(default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) ->default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) ++>default : Symbol(default, Decl(uses.ts, 0, 0)) >const : Symbol(const) === /node_modules/pkg/import.d.ts === -@@= skipped -12, +10 lines =@@ +@@= skipped -12, +12 lines =@@ interface ImportInterface { _i: any; } >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types index feec0c28a6..8fe9ea5bac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types @@ -6,15 +6,15 @@ import obj1 from "./sub1/uses.js" >obj1 : ImportInterface import obj2 from "./sub2/uses.js" ->obj2 : RequireInterface +>obj2 : typeof obj2 export default [obj1, obj2.default] as const; ->[obj1, obj2.default] as const : readonly [ImportInterface, any] ->[obj1, obj2.default] : readonly [ImportInterface, any] +>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] +>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] >obj1 : ImportInterface ->obj2.default : any ->obj2 : RequireInterface ->default : any +>obj2.default : RequireInterface +>obj2 : typeof obj2 +>default : RequireInterface === /node_modules/pkg/import.d.ts === export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types.diff deleted file mode 100644 index a26e6db209..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >obj1 : ImportInterface - - import obj2 from "./sub2/uses.js" -->obj2 : typeof obj2 -+>obj2 : RequireInterface - - export default [obj1, obj2.default] as const; -->[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] -->[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] -+>[obj1, obj2.default] as const : readonly [ImportInterface, any] -+>[obj1, obj2.default] : readonly [ImportInterface, any] - >obj1 : ImportInterface -->obj2.default : RequireInterface -->obj2 : typeof obj2 -->default : RequireInterface -+>obj2.default : any -+>obj2 : RequireInterface -+>default : any - - === /node_modules/pkg/import.d.ts === - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt index 0d440c1fd9..13991aa135 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt @@ -1,12 +1,12 @@ -/index.ts(2,1): error TS2304: Cannot find name 'foo'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. ==== /index.ts (1 errors) ==== /// foo; // foo should resolve while bar should not, since index.js is esm - ~~~ -!!! error TS2304: Cannot find name 'foo'. bar; + ~~~ +!!! error TS2304: Cannot find name 'bar'. export {}; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt.diff deleted file mode 100644 index 48ca6cbf16..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(3,1): error TS2304: Cannot find name 'bar'. -+/index.ts(2,1): error TS2304: Cannot find name 'foo'. - - - ==== /index.ts (1 errors) ==== - /// - foo; // foo should resolve while bar should not, since index.js is esm -- bar; - ~~~ --!!! error TS2304: Cannot find name 'bar'. -+!!! error TS2304: Cannot find name 'foo'. -+ bar; - export {}; - ==== /node_modules/pkg/package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols index 834fc88eb4..0f65d258dc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols @@ -3,15 +3,15 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm -bar; ->bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) +bar; export {}; -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { ->global : Symbol(global, Decl(require.d.ts, 0, 10)) +>global : Symbol(global, Decl(import.d.ts, 0, 10)) - var bar: number; ->bar : Symbol(bar, Decl(require.d.ts, 2, 7)) + var foo: number; +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols.diff deleted file mode 100644 index b1f658f4e7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols -@@= skipped -2, +2 lines =@@ - === /index.ts === - /// - foo; // foo should resolve while bar should not, since index.js is esm -->foo : Symbol(foo, Decl(import.d.ts, 2, 7)) -- - bar; -+>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) -+ - export {}; --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -+>global : Symbol(global, Decl(require.d.ts, 0, 10)) - -- var foo: number; -->foo : Symbol(foo, Decl(import.d.ts, 2, 7)) -+ var bar: number; -+>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types index 235394cd2c..3b7a7ec78e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types @@ -3,17 +3,17 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm ->foo : any +>foo : number bar; ->bar : number +>bar : any export {}; -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { >global : typeof global - var bar: number; ->bar : number + var foo: number; +>foo : number } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types.diff deleted file mode 100644 index 39e95d39ea..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node18).types -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node18).types -@@= skipped -2, +2 lines =@@ - === /index.ts === - /// - foo; // foo should resolve while bar should not, since index.js is esm -->foo : number -+>foo : any - - bar; -->bar : any -+>bar : number - - export {}; --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { - >global : typeof global - -- var foo: number; -->foo : number -+ var bar: number; -+>bar : number - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node18).errors.txt.diff deleted file mode 100644 index 84d5e991e2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node18).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodePackageSelfName(module=node18).errors.txt -+++ new.nodePackageSelfName(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.cts(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as self from "package"; -- self; --==== index.mts (0 errors) ==== -- // esm format file -- import * as self from "package"; -- self; --==== index.cts (1 errors) ==== -- // esm format file -- import * as self from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -- self; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- "exports": "./index.js" -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=nodenext).errors.txt.diff deleted file mode 100644 index 5bc13849b1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodePackageSelfName(module=nodenext).errors.txt -+++ new.nodePackageSelfName(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+ -+ -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== index.cts (1 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+ self; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node18).errors.txt.diff deleted file mode 100644 index bffa0f4e90..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node18).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodePackageSelfNameScoped(module=node18).errors.txt -+++ new.nodePackageSelfNameScoped(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.cts(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@scope/package")' call instead. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as self from "@scope/package"; -- self; --==== index.mts (0 errors) ==== -- // esm format file -- import * as self from "@scope/package"; -- self; --==== index.cts (1 errors) ==== -- // cjs format file -- import * as self from "@scope/package"; -- ~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@scope/package")' call instead. -- self; --==== package.json (0 errors) ==== -- { -- "name": "@scope/package", -- "private": true, -- "type": "module", -- "exports": "./index.js" -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=nodenext).errors.txt.diff deleted file mode 100644 index f45ed0adc5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodePackageSelfNameScoped(module=nodenext).errors.txt -+++ new.nodePackageSelfNameScoped(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@scope/package")' call instead. -+ -+ -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as self from "@scope/package"; -+ self; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as self from "@scope/package"; -+ self; -+==== index.cts (1 errors) ==== -+ // cjs format file -+ import * as self from "@scope/package"; -+ ~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@scope/package")' call instead. -+ self; -+==== package.json (0 errors) ==== -+ { -+ "name": "@scope/package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node18).errors.txt deleted file mode 100644 index 0b275310ad..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node18).errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -index.mts(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - -==== example.json (0 errors) ==== - {} - -==== styles.d.css.ts (0 errors) ==== - export {}; - -==== index.mts (1 errors) ==== - import {} from "./example.json" with { type: "json" }; // Ok - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node18).errors.txt.diff deleted file mode 100644 index e1f414c518..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node18).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nonTSExtensions(module=node18).errors.txt -+++ new.nonTSExtensions(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.mts(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+ -+ -+==== example.json (0 errors) ==== -+ {} -+ -+==== styles.d.css.ts (0 errors) ==== -+ export {}; -+ -+==== index.mts (1 errors) ==== -+ import {} from "./example.json" with { type: "json" }; // Ok -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+ import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=nodenext).errors.txt deleted file mode 100644 index cb7dbcab5e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=nodenext).errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -index.mts(1,33): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - -==== example.json (0 errors) ==== - {} - -==== styles.d.css.ts (0 errors) ==== - export {}; - -==== index.mts (1 errors) ==== - import {} from "./example.json" with { type: "json" }; // Ok - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=nodenext).errors.txt.diff deleted file mode 100644 index 9c37419e0b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nonTSExtensions(module=nodenext).errors.txt -+++ new.nonTSExtensions(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.mts(1,33): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+==== example.json (0 errors) ==== -+ {} -+ -+==== styles.d.css.ts (0 errors) ==== -+ export {}; -+ -+==== index.mts (1 errors) ==== -+ import {} from "./example.json" with { type: "json" }; // Ok -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).errors.txt similarity index 100% rename from testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=nodenext).errors.txt rename to testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).errors.txt diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).errors.txt.diff deleted file mode 100644 index 9d131b3cca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node18).errors.txt -+++ new.typeOnlyESMImportFromCJS(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --common.cts(1,21): error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. --common.cts(4,25): error TS1542: Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -- -- --==== module.mts (0 errors) ==== -- export {}; -- --==== common.cts (2 errors) ==== -- import type {} from "./module.mts"; -- ~~~~~~~~~~~~~~ --!!! error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -- import type {} from "./module.mts" with { "resolution-mode": "import" }; -- import type {} from "./module.mts" with { "resolution-mode": "require" }; -- type _1 = typeof import("./module.mts"); -- ~~~~~~~~~~~~~~ --!!! error TS1542: Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -- type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); -- type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types index 080e75d207..c4c89833c3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types @@ -9,11 +9,11 @@ import type {} from "./module.mts"; import type {} from "./module.mts" with { "resolution-mode": "import" }; import type {} from "./module.mts" with { "resolution-mode": "require" }; type _1 = typeof import("./module.mts"); ->_1 : typeof import("./module.mts") +>_1 : typeof import("./module.mts", { with: { "resolution-mode": "import" } }) type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); ->_2 : typeof import("./module.mts") +>_2 : typeof import("./module.mts", { with: { "resolution-mode": "import" } }) type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); ->_3 : typeof import("./module.mts") +>_3 : typeof import("./module.mts", { with: { "resolution-mode": "import" } }) diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types.diff index dba0136038..1dbc7e56f8 100644 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node18).types.diff @@ -5,12 +5,12 @@ import type {} from "./module.mts" with { "resolution-mode": "require" }; type _1 = typeof import("./module.mts"); ->_1 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_1 : typeof import("./module.mts") ++>_1 : typeof import("./module.mts", { with: { "resolution-mode": "import" } }) type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); ->_2 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_2 : typeof import("./module.mts") ++>_2 : typeof import("./module.mts", { with: { "resolution-mode": "import" } }) type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); ->_3 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_3 : typeof import("./module.mts") ++>_3 : typeof import("./module.mts", { with: { "resolution-mode": "import" } }) diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=nodenext).errors.txt.diff deleted file mode 100644 index 5125627318..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=nodenext).errors.txt -+++ new.typeOnlyESMImportFromCJS(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+common.cts(1,21): error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -+common.cts(4,25): error TS1542: Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -+ -+ -+==== module.mts (0 errors) ==== -+ export {}; -+ -+==== common.cts (2 errors) ==== -+ import type {} from "./module.mts"; -+ ~~~~~~~~~~~~~~ -+!!! error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -+ import type {} from "./module.mts" with { "resolution-mode": "import" }; -+ import type {} from "./module.mts" with { "resolution-mode": "require" }; -+ type _1 = typeof import("./module.mts"); -+ ~~~~~~~~~~~~~~ -+!!! error TS1542: Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -+ type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); -+ type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.errors.txt.diff index 63fa1700c0..46b5cf2be2 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.errors.txt.diff @@ -6,12 +6,12 @@ -/main1.ts(1,13): error TS2305: Module '"./a"' has no exported member 'y'. /main1.ts(3,12): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /main1.ts(19,4): error TS2339: Property 'default' does not exist on type '() => void'. --/main1.ts(23,8): error TS1192: Module '"/e"' has no default export. + /main1.ts(23,8): error TS1192: Module '"/e"' has no default export. -/main2.mts(1,13): error TS2305: Module '"./a"' has no exported member 'y'. +/main1.ts(30,4): error TS2339: Property 'default' does not exist on type '0'. /main2.mts(4,4): error TS2339: Property 'default' does not exist on type 'typeof import("/a")'. /main2.mts(5,12): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. --/main2.mts(14,8): error TS1192: Module '"/e"' has no default export. + /main2.mts(14,8): error TS1192: Module '"/e"' has no default export. -/main3.cjs(1,10): error TS1293: ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'. -/main3.cjs(1,13): error TS2305: Module '"./a"' has no exported member 'y'. -/main3.cjs(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -43,28 +43,16 @@ ==== /b.ts (0 errors) ==== export default 0; -@@= skipped -46, +40 lines =@@ - ==== /g.js (0 errors) ==== - exports.default = 0; +@@= skipped -48, +44 lines =@@ --==== /main1.ts (4 errors) ==== -+==== /main1.ts (3 errors) ==== + ==== /main1.ts (4 errors) ==== import { x, y } from "./a"; // No y - ~ -!!! error TS2305: Module '"./a"' has no exported member 'y'. import a1 = require("./a"); // { x: 0 } const a2 = require("./a"); // Error in TS ~~~~~~~ -@@= skipped -30, +28 lines =@@ - d3.default(); - - import e1 from "./e.mjs"; // 0 -- ~~ --!!! error TS1192: Module '"/e"' has no default export. - import e2 = require("./e.mjs"); // 0 - import f1 from "./f.cjs"; // 0 - import f2 = require("./f.cjs"); // { default: 0 } -@@= skipped -9, +7 lines =@@ +@@= skipped -37, +35 lines =@@ import g1 from "./g"; // { default: 0 } g1.default; @@ -74,23 +62,14 @@ g2.default; -==== /main2.mts (4 errors) ==== -+==== /main2.mts (2 errors) ==== ++==== /main2.mts (3 errors) ==== import { x, y } from "./a"; // No y - ~ -!!! error TS2305: Module '"./a"' has no exported member 'y'. import a1 = require("./a"); // { x: 0 } a1.x; a1.default.x; // Arguably should exist but doesn't -@@= skipped -24, +24 lines =@@ - import d1 from "./d"; // [Function: default] - import d2 = require("./d"); // [Function: default] - import e1 from "./e.mjs"; // 0 -- ~~ --!!! error TS1192: Module '"/e"' has no default export. - import e2 = require("./e.mjs"); // 0 - import f1 from "./f.cjs"; // 0 - import f2 = require("./f.cjs"); // { default: 0 } -@@= skipped -9, +7 lines =@@ +@@= skipped -33, +33 lines =@@ import g1 from "./g"; // { default: 0 } import g2 = require("./g"); // { default: 0 } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.types.diff index cfbf25171e..d7ae25f448 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/modulePreserve4.types.diff @@ -34,16 +34,7 @@ import a1 = require("./a"); // { x: 0 } >a1 : typeof a1 -@@= skipped -91, +91 lines =@@ - >default : () => void - - import e1 from "./e.mjs"; // 0 -->e1 : any -+>e1 : 0 - - import e2 = require("./e.mjs"); // 0 - >e2 : 0 -@@= skipped -17, +17 lines =@@ +@@= skipped -108, +108 lines =@@ >default : 0 import g1 from "./g"; // { default: 0 } @@ -76,16 +67,7 @@ import a1 = require("./a"); // { x: 0 } >a1 : typeof a1 -@@= skipped -60, +60 lines =@@ - >d2 : () => void - - import e1 from "./e.mjs"; // 0 -->e1 : any -+>e1 : 0 - - import e2 = require("./e.mjs"); // 0 - >e2 : 0 -@@= skipped -12, +12 lines =@@ +@@= skipped -72, +72 lines =@@ >f2 : typeof f2 import g1 from "./g"; // { default: 0 } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node18).errors.txt.diff index 0dd424a061..4c45ede330 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node18).errors.txt.diff @@ -2,29 +2,10 @@ +++ new.nodeAllowJsPackageSelfName(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -- -- + index.cjs(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + + -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as self from "package"; -- self; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as self from "package"; -- self; --==== index.cjs (1 errors) ==== -- // esm format file -- import * as self from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -- self; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- "exports": "./index.js" -- } -+ \ No newline at end of file + ==== index.js (0 errors) ==== + // esm format file + import * as self from "package"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=nodenext).errors.txt.diff index 89617e211f..ed0557e4a3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=nodenext).errors.txt.diff @@ -5,22 +5,23 @@ - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -+index.cjs(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+ -+ - ==== index.js (0 errors) ==== - // esm format file - import * as self from "package"; -@@= skipped -9, +8 lines =@@ - // esm format file - import * as self from "package"; - self; +-==== index.js (0 errors) ==== +- // esm format file +- import * as self from "package"; +- self; +-==== index.mjs (0 errors) ==== +- // esm format file +- import * as self from "package"; +- self; -==== index.cjs (0 errors) ==== -+==== index.cjs (1 errors) ==== - // esm format file - import * as self from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - self; - ==== package.json (0 errors) ==== - { \ No newline at end of file +- // esm format file +- import * as self from "package"; +- self; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- "exports": "./index.js" +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).errors.txt.diff index 8307ca21c8..aff003ddc2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).errors.txt.diff @@ -1,21 +1,13 @@ --- old.nodeModulesAllowJs1(module=node18).errors.txt +++ new.nodeModulesAllowJs1(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --index.cjs(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. --index.cjs(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. --index.cjs(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. --index.cjs(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. --index.cjs(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. --index.cjs(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. --index.cjs(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. --index.cjs(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. --index.cjs(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. --index.cjs(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. --index.cjs(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. +@@= skipped -8, +8 lines =@@ + index.cjs(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. + index.cjs(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. + index.cjs(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. -index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.cjs(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.cjs(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -23,37 +15,21 @@ -index.cjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. + index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +@@= skipped -38, +27 lines =@@ + index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.js(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -61,37 +37,21 @@ -index.js(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. + index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +@@= skipped -38, +27 lines =@@ + index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.mjs(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -99,125 +59,35 @@ -index.mjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. --index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -- -- -+error TS2468: Cannot find global value 'Promise'. -+index.cjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. - ==== subfolder/index.js (0 errors) ==== - // cjs format file - const x = 1; -@@= skipped -149, +70 lines =@@ + index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. + index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +@@= skipped -65, +54 lines =@@ // esm format file const x = 1; export {x}; -==== index.js (38 errors) ==== -+==== index.js (11 errors) ==== ++==== index.js (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; -@@= skipped -15, +15 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -58, +36 lines =@@ +@@= skipped -73, +73 lines =@@ // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~ --!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~ + !!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~ --!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~ + !!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -239,147 +109,41 @@ import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; - void m25; - void m26; -@@= skipped -56, +24 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +@@= skipped -91, +69 lines =@@ // esm format file const x = 1; export {x}; -==== index.cjs (38 errors) ==== -+==== index.cjs (11 errors) ==== ++==== index.cjs (27 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; -- ~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. - import * as m2 from "./index.mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. - import * as m3 from "./index.cjs"; - import * as m4 from "./subfolder/index.js"; - import * as m5 from "./subfolder/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. - import * as m6 from "./subfolder/index.cjs"; - import * as m7 from "./subfolder2/index.js"; - import * as m8 from "./subfolder2/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. - import * as m9 from "./subfolder2/index.cjs"; - import * as m10 from "./subfolder2/another/index.js"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. - import * as m11 from "./subfolder2/another/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) - import * as m13 from "./"; -- ~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. - import * as m15 from "./subfolder"; - import * as m16 from "./subfolder/"; - import * as m17 from "./subfolder/index"; -@@= skipped -75, +59 lines =@@ - import * as m19 from "./subfolder2/"; - import * as m20 from "./subfolder2/index"; - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. - void m1; - void m2; - void m3; -@@= skipped -34, +28 lines =@@ + ~~~~~~~~~~~~ +@@= skipped -74, +74 lines =@@ // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~ --!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~ + !!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~ --!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~ + !!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -401,139 +165,41 @@ import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; - void m25; - void m26; -@@= skipped -56, +24 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +@@= skipped -91, +69 lines =@@ // cjs format file const x = 1; export {x}; -==== index.mjs (38 errors) ==== -+==== index.mjs (11 errors) ==== ++==== index.mjs (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; -@@= skipped -50, +50 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -58, +36 lines =@@ +@@= skipped -73, +73 lines =@@ // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~ --!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~ + !!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~ --!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~ + !!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -555,79 +221,16 @@ import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - void m24; - void m25; - void m26; -@@= skipped -56, +24 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - // esm format file - const x = 1; \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff index 23b8c0f821..53da4828c6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff @@ -1,114 +1,6 @@ --- old.nodeModulesAllowJs1(module=node18).types +++ new.nodeModulesAllowJs1(module=node18).types -@@= skipped -119, +119 lines =@@ - - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ +@@= skipped -251, +251 lines =@@ >m25 : typeof m1 import m26 = require("./subfolder"); @@ -171,277 +63,7 @@ void m32; >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise -+>import("./") : Promise - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise -+>import("./index") : Promise - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise -+>import("./subfolder") : Promise - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise -+>import("./subfolder/") : Promise - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise -+>import("./subfolder/index") : Promise - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise -+>import("./subfolder2") : Promise - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise -+>import("./subfolder2/") : Promise - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise -+>import("./subfolder2/index") : Promise - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise -+>import("./subfolder2/another") : Promise - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise -+>import("./subfolder2/another/") : Promise - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise -+>import("./subfolder2/another/index") : Promise - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file -@@= skipped -306, +306 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise -+>import("./") : Promise - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise -+>import("./index") : Promise - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise -+>import("./subfolder") : Promise - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise -+>import("./subfolder/") : Promise - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise -+>import("./subfolder/index") : Promise - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise -+>import("./subfolder2") : Promise - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise -+>import("./subfolder2/") : Promise - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise -+>import("./subfolder2/index") : Promise - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise -+>import("./subfolder2/another") : Promise - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise -+>import("./subfolder2/another/") : Promise - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise -+>import("./subfolder2/another/index") : Promise - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // cjs format file -@@= skipped -101, +101 lines =@@ - - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ +@@= skipped -575, +575 lines =@@ >m25 : typeof m1 import m26 = require("./subfolder"); @@ -503,85 +125,4 @@ +>m31 : typeof m7 void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise -+>import("./") : Promise - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise -+>import("./index") : Promise - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise -+>import("./subfolder") : Promise - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise -+>import("./subfolder/") : Promise - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise -+>import("./subfolder/index") : Promise - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise -+>import("./subfolder2") : Promise - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise -+>import("./subfolder2/") : Promise - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise -+>import("./subfolder2/index") : Promise - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise -+>import("./subfolder2/another") : Promise - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise -+>import("./subfolder2/another/") : Promise - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise -+>import("./subfolder2/another/index") : Promise - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file \ No newline at end of file + >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt.diff index efb2caeef7..f3b05ae21c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).errors.txt.diff @@ -12,26 +12,10 @@ -index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. -+index.cjs(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. -+index.cjs(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. -+index.cjs(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. -+index.cjs(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. -+index.cjs(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. -+index.cjs(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. -+index.cjs(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. -+index.cjs(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. -+index.cjs(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. -+index.cjs(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. -+index.cjs(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. -+index.cjs(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cjs(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -@@= skipped -30, +35 lines =@@ +@@= skipped -30, +19 lines =@@ index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? @@ -46,15 +30,10 @@ -index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -+index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.js(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -@@= skipped -33, +27 lines =@@ +@@= skipped -33, +22 lines =@@ index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? @@ -69,20 +48,15 @@ -index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -+index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mjs(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -@@= skipped -60, +54 lines =@@ +@@= skipped -60, +49 lines =@@ // esm format file const x = 1; export {x}; -==== index.js (33 errors) ==== -+==== index.js (27 errors) ==== ++==== index.js (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -92,13 +66,9 @@ import m24 = require("./"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~ -+!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~ -+!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -120,90 +90,33 @@ import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; -@@= skipped -81, +69 lines =@@ +@@= skipped -81, +59 lines =@@ // esm format file const x = 1; export {x}; -==== index.cjs (22 errors) ==== -+==== index.cjs (27 errors) ==== ++==== index.cjs (11 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; -+ ~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. import * as m2 from "./index.mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. - import * as m3 from "./index.cjs"; - import * as m4 from "./subfolder/index.js"; - import * as m5 from "./subfolder/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. - import * as m6 from "./subfolder/index.cjs"; - import * as m7 from "./subfolder2/index.js"; - import * as m8 from "./subfolder2/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. - import * as m9 from "./subfolder2/index.cjs"; - import * as m10 from "./subfolder2/another/index.js"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. - import * as m11 from "./subfolder2/another/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) - import * as m13 from "./"; -+ ~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. - import * as m14 from "./index"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. - import * as m15 from "./subfolder"; - import * as m16 from "./subfolder/"; - import * as m17 from "./subfolder/index"; -@@= skipped -24, +40 lines =@@ - import * as m19 from "./subfolder2/"; - import * as m20 from "./subfolder2/index"; - import * as m21 from "./subfolder2/another"; -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. - import * as m22 from "./subfolder2/another/"; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. - import * as m23 from "./subfolder2/another/index"; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. - void m1; - void m2; - void m3; -@@= skipped -28, +34 lines =@@ +@@= skipped -52, +52 lines =@@ // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~ -+!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~ -+!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -225,27 +138,21 @@ import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; -@@= skipped -81, +69 lines =@@ +@@= skipped -81, +59 lines =@@ // cjs format file const x = 1; export {x}; -==== index.mjs (33 errors) ==== -+==== index.mjs (27 errors) ==== ++==== index.mjs (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -255,13 +162,9 @@ import m24 = require("./"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~ -+!!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~ -+!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -283,18 +186,12 @@ import m32 = require("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff index 5ae08b07c0..8af76bf7ad 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff @@ -2,8 +2,8 @@ +++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - @@ -112,16 +112,11 @@ + ~~~~~~~~~ +!!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. + ts.mjsSource; -+==== index.cjs (3 errors) ==== ++==== index.cjs (5 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - cjs; +@@= skipped -50, +82 lines =@@ mjs; type; import * as cjsi from "inner/a"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff index af1e590306..c79993d011 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff @@ -40,8 +40,6 @@ - typei.mjsSource; - ts.mjsSource; -==== index.cjs (0 errors) ==== -+index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. +index.cjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. +index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +index.cjs(11,21): error TS2307: Cannot find module 'inner/types' or its corresponding type declarations. @@ -112,16 +110,11 @@ + ~~~~~~~~~ +!!! error TS2339: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. + ts.mjsSource; -+==== index.cjs (5 errors) ==== ++==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - cjs; +@@= skipped -44, +76 lines =@@ mjs; type; import * as cjsi from "inner/a"; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node18).errors.txt.diff deleted file mode 100644 index 145dd4638e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node18).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsDynamicImport(module=node18).errors.txt -+++ new.nodeModulesAllowJsDynamicImport(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS2468: Cannot find global value 'Promise'. -+index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.js (1 errors) ==== -+ // cjs format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== index.js (1 errors) ==== -+ // esm format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt.diff index 61c27fbe76..b1a763b122 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node18).errors.txt.diff @@ -2,44 +2,43 @@ +++ new.nodeModulesAllowJsExportAssignment(module=node18).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`. --index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ++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. - - -==== subfolder/index.js (1 errors) ==== -- // cjs format file -- const a = {}; -- export = a; ++ ++ ++==== subfolder/index.js (0 errors) ==== + // cjs format file + const a = {}; + export = a; - ~~~~~~~~~~~ -!!! error TS8003: 'export =' can only be used in TypeScript files. --==== subfolder/file.js (0 errors) ==== -- // cjs format file -- const a = {}; -- module.exports = a; + ==== subfolder/file.js (0 errors) ==== + // cjs format file + const a = {}; + module.exports = a; -==== index.js (2 errors) ==== -- // esm format file -- const a = {}; -- export = a; -- ~~~~~~~~~~~ --!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ++==== index.js (1 errors) ==== + // esm format file + const a = {}; + export = a; + ~~~~~~~~~~~ + !!! 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) ==== -- // esm format file -- import "fs"; -- const a = {}; -- module.exports = a; + ==== 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`. --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== subfolder/package.json (0 errors) ==== -- { -- "type": "commonjs" -- } -+ \ No newline at end of file ++ ~~~~~~~~~~~~~~~~~~ ++!!! 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", \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt.diff index c64c211e58..96aa91a217 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt.diff @@ -1,9 +1,6 @@ --- old.nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt +++ new.nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -+index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -subfolder/index.js(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 with module Node18. @@ -15,7 +12,7 @@ // cjs format file function require() {} ~~~~~~~ -@@= skipped -12, +14 lines =@@ +@@= skipped -12, +11 lines =@@ ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} @@ -23,21 +20,4 @@ -!!! error TS2725: Class name cannot be 'Object' when targeting ES5 with module Node18. export const __esModule = false; ~~~~~~~~~~ - !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; --==== index.js (0 errors) ==== -+==== index.js (3 errors) ==== - // esm format file - function require() {} -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - const exports = {}; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - class Object {} - export const __esModule = false; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; - ==== package.json (0 errors) ==== - { \ No newline at end of file + !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node18).errors.txt.diff deleted file mode 100644 index b110f175d2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node18).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodeModulesAllowJsImportMeta(module=node18).errors.txt -+++ new.nodeModulesAllowJsImportMeta(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -- -- --==== subfolder/index.js (1 errors) ==== -- // cjs format file -- const x = import.meta.url; -- ~~~~~~~~~~~ --!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -- export {x}; --==== index.js (0 errors) ==== -- // esm format file -- const x = import.meta.url; -- export {x}; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== subfolder/package.json (0 errors) ==== -- { -- "type": "commonjs" -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff index b9d951ec55..d606aad7ef 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff @@ -2,112 +2,28 @@ +++ new.nodeModulesAllowJsPackageExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- -- + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + + -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -- // cjs format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -- import * as type from "package"; -- ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; + ==== index.js (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; +@@= skipped -55, +52 lines =@@ + cjsi; + mjsi; + typei; -==== node_modules/inner/index.d.ts (2 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs"; ++==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- import * as type from "inner"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs"; -- import * as mjs from "inner/mjs"; -- import * as type from "inner"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs"; -- import * as mjs from "inner/mjs"; -- ~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -- import * as type from "inner"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- "exports": { -- "./cjs": "./index.cjs", -- "./mjs": "./index.mjs", -- ".": "./index.js" -- } -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs": "./index.cjs", -- "./mjs": "./index.mjs", -- ".": "./index.js" -- } -- } -+ \ No newline at end of file + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff index 7d5ac4f7b2..440a91b5c4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff @@ -6,63 +6,93 @@ - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -+index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+ -+ - ==== index.js (0 errors) ==== - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -30, +32 lines =@@ - cjsi; - mjsi; - typei; +-==== index.js (0 errors) ==== +- // esm format file +- import * as cjs from "package/cjs"; +- import * as mjs from "package/mjs"; +- import * as type from "package"; +- cjs; +- mjs; +- type; +- import * as cjsi from "inner/cjs"; +- import * as mjsi from "inner/mjs"; +- import * as typei from "inner"; +- cjsi; +- mjsi; +- typei; +-==== index.mjs (0 errors) ==== +- // esm format file +- import * as cjs from "package/cjs"; +- import * as mjs from "package/mjs"; +- import * as type from "package"; +- cjs; +- mjs; +- type; +- import * as cjsi from "inner/cjs"; +- import * as mjsi from "inner/mjs"; +- import * as typei from "inner"; +- cjsi; +- mjsi; +- typei; -==== index.cjs (0 errors) ==== -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as typei from "inner"; - cjsi; - mjsi; -@@= skipped -17, +23 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; +- // cjs format file +- import * as cjs from "package/cjs"; +- import * as mjs from "package/mjs"; +- import * as type from "package"; +- cjs; +- mjs; +- type; +- import * as cjsi from "inner/cjs"; +- import * as mjsi from "inner/mjs"; +- import * as typei from "inner"; +- cjsi; +- mjsi; +- typei; +-==== node_modules/inner/index.d.ts (1 errors) ==== +- // cjs format file +- import * as cjs from "inner/cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ - export { cjs }; - export { mjs }; - export { type }; +- import * as mjs from "inner/mjs"; +- import * as type from "inner"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== node_modules/inner/index.d.mts (0 errors) ==== +- // esm format file +- import * as cjs from "inner/cjs"; +- import * as mjs from "inner/mjs"; +- import * as type from "inner"; +- export { cjs }; +- export { mjs }; +- export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; -+ ~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - import * as type from "inner"; - export { cjs }; - export { mjs }; \ No newline at end of file +- // cjs format file +- import * as cjs from "inner/cjs"; +- import * as mjs from "inner/mjs"; +- import * as type from "inner"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- "exports": { +- "./cjs": "./index.cjs", +- "./mjs": "./index.mjs", +- ".": "./index.js" +- } +- } +-==== node_modules/inner/package.json (0 errors) ==== +- { +- "name": "inner", +- "private": true, +- "exports": { +- "./cjs": "./index.cjs", +- "./mjs": "./index.mjs", +- ".": "./index.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node18).errors.txt.diff index dc72fe7726..110b3d4008 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node18).errors.txt.diff @@ -2,49 +2,11 @@ +++ new.nodeModulesAllowJsPackageImports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -- -- + index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. + index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. + + -!!! error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "#cjs"; -- import * as mjs from "#mjs"; -- import * as type from "#type"; -- cjs; -- mjs; -- type; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "#cjs"; -- import * as mjs from "#mjs"; -- import * as type from "#type"; -- cjs; -- mjs; -- type; --==== index.cjs (2 errors) ==== -- // esm format file -- import * as cjs from "#cjs"; -- import * as mjs from "#mjs"; -- ~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. -- import * as type from "#type"; -- ~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -- cjs; -- mjs; -- type; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- "exports": "./index.js", -- "imports": { -- "#cjs": "./index.cjs", -- "#mjs": "./index.mjs", -- "#type": "./index.js" -- } -- } -+ \ No newline at end of file + ==== index.js (0 errors) ==== + // esm format file + import * as cjs from "#cjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=nodenext).errors.txt.diff index 13f762e958..493bdc69ed 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=nodenext).errors.txt.diff @@ -5,27 +5,40 @@ - - -!!! error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -+index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. -+index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. -+ -+ - ==== index.js (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; -@@= skipped -17, +17 lines =@@ - cjs; - mjs; - type; +-==== index.js (0 errors) ==== +- // esm format file +- import * as cjs from "#cjs"; +- import * as mjs from "#mjs"; +- import * as type from "#type"; +- cjs; +- mjs; +- type; +-==== index.mjs (0 errors) ==== +- // esm format file +- import * as cjs from "#cjs"; +- import * as mjs from "#mjs"; +- import * as type from "#type"; +- cjs; +- mjs; +- type; -==== index.cjs (0 errors) ==== -+==== index.cjs (2 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; -+ ~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. - import * as type from "#type"; -+ ~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. - cjs; - mjs; - type; \ No newline at end of file +- // esm format file +- import * as cjs from "#cjs"; +- import * as mjs from "#mjs"; +- import * as type from "#type"; +- cjs; +- mjs; +- type; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- "exports": "./index.js", +- "imports": { +- "#cjs": "./index.cjs", +- "#mjs": "./index.mjs", +- "#type": "./index.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff index 86a3e97ce5..d3235546df 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff @@ -1,82 +1,22 @@ --- old.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt +++ new.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (1 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + + +@@= skipped -29, +28 lines =@@ + cjsi; + mjsi; + typei; -==== node_modules/inner/index.d.ts (2 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; ++==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- ~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -+ \ No newline at end of file + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff index 75d59df11d..f1f6eb1dab 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff @@ -2,49 +2,72 @@ +++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - - ==== index.js (0 errors) ==== -@@= skipped -16, +18 lines =@@ - cjsi; - mjsi; - typei; +- +- +-==== index.js (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index"; +- import * as mjsi from "inner/mjs/index"; +- import * as typei from "inner/js/index"; +- cjsi; +- mjsi; +- typei; +-==== index.mjs (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index"; +- import * as mjsi from "inner/mjs/index"; +- import * as typei from "inner/js/index"; +- cjsi; +- mjsi; +- typei; -==== index.cjs (0 errors) ==== -+==== index.cjs (1 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as typei from "inner/js/index"; - cjsi; - mjsi; -@@= skipped -11, +13 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; +- // cjs format file +- import * as cjsi from "inner/cjs/index"; +- import * as mjsi from "inner/mjs/index"; +- import * as typei from "inner/js/index"; +- cjsi; +- mjsi; +- typei; +-==== node_modules/inner/index.d.ts (1 errors) ==== +- // cjs format file +- import * as cjs from "inner/cjs/index"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ - export { cjs }; - export { mjs }; - export { type }; +- import * as mjs from "inner/mjs/index"; +- import * as type from "inner/js/index"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== node_modules/inner/index.d.mts (0 errors) ==== +- // esm format file +- import * as cjs from "inner/cjs/index"; +- import * as mjs from "inner/mjs/index"; +- import * as type from "inner/js/index"; +- export { cjs }; +- export { mjs }; +- export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; \ No newline at end of file +- // cjs format file +- import * as cjs from "inner/cjs/index"; +- import * as mjs from "inner/mjs/index"; +- import * as type from "inner/js/index"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- } +-==== node_modules/inner/package.json (0 errors) ==== +- { +- "name": "inner", +- "private": true, +- "exports": { +- "./cjs/*": "./*.cjs", +- "./mjs/*": "./*.mjs", +- "./js/*": "./*.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff index b8c6cdfa3f..6e005d3729 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff @@ -1,82 +1,22 @@ --- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt +++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@= skipped -0, +0 lines =@@ --index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (1 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; + node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + + +@@= skipped -29, +28 lines =@@ + cjsi; + mjsi; + typei; -==== node_modules/inner/index.d.ts (2 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; ++==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- ~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module", -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -+ \ No newline at end of file + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff index 7f3cae0184..f0575cf984 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff @@ -2,49 +2,72 @@ +++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -+node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -+node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - - ==== index.js (0 errors) ==== -@@= skipped -16, +18 lines =@@ - cjsi; - mjsi; - typei; +- +- +-==== index.js (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index.cjs"; +- import * as mjsi from "inner/mjs/index.mjs"; +- import * as typei from "inner/js/index.js"; +- cjsi; +- mjsi; +- typei; +-==== index.mjs (0 errors) ==== +- // esm format file +- import * as cjsi from "inner/cjs/index.cjs"; +- import * as mjsi from "inner/mjs/index.mjs"; +- import * as typei from "inner/js/index.js"; +- cjsi; +- mjsi; +- typei; -==== index.cjs (0 errors) ==== -+==== index.cjs (1 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; -@@= skipped -11, +13 lines =@@ - ==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; +- // cjs format file +- import * as cjsi from "inner/cjs/index.cjs"; +- import * as mjsi from "inner/mjs/index.mjs"; +- import * as typei from "inner/js/index.js"; +- cjsi; +- mjsi; +- typei; +-==== node_modules/inner/index.d.ts (1 errors) ==== +- // cjs format file +- import * as cjs from "inner/cjs/index.cjs"; - ~~~ -!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; -@@= skipped -15, +15 lines =@@ - export { cjs }; - export { mjs }; - export { type }; +- import * as mjs from "inner/mjs/index.mjs"; +- import * as type from "inner/js/index.js"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== node_modules/inner/index.d.mts (0 errors) ==== +- // esm format file +- import * as cjs from "inner/cjs/index.cjs"; +- import * as mjs from "inner/mjs/index.mjs"; +- import * as type from "inner/js/index.js"; +- export { cjs }; +- export { mjs }; +- export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; \ No newline at end of file +- // cjs format file +- import * as cjs from "inner/cjs/index.cjs"; +- import * as mjs from "inner/mjs/index.mjs"; +- import * as type from "inner/js/index.js"; +- export { cjs }; +- export { mjs }; +- export { type }; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module", +- } +-==== node_modules/inner/package.json (0 errors) ==== +- { +- "name": "inner", +- "private": true, +- "exports": { +- "./cjs/*.cjs": "./*.cjs", +- "./mjs/*.mjs": "./*.mjs", +- "./js/*.js": "./*.js" +- } +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types.diff deleted file mode 100644 index 3c34747767..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node16).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesAllowJsSynchronousCallErrors(module=node16).types -+++ new.nodeModulesAllowJsSynchronousCallErrors(module=node16).types -@@= skipped -24, +24 lines =@@ - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./index.js") : { f(): Promise; default: typeof mod2; } -->import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./index.js") : typeof mod2 -+>import ("./index.js") : Promise - >"./index.js" : "./index.js" - - h(); -@@= skipped -34, +34 lines =@@ - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } -->import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./subfolder/index.js") : typeof mod2 -+>import ("./subfolder/index.js") : Promise - >"./subfolder/index.js" : "./subfolder/index.js" - - f(); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt.diff index f6b7c7552e..8ab98c1b2e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt.diff @@ -2,73 +2,51 @@ +++ new.nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + index.js(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. --subfolder/index.js(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -- To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. + subfolder/index.js(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. + To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. -subfolder/index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. --subfolder/index.js(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + subfolder/index.js(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. - - -==== subfolder/index.js (4 errors) ==== -+error TS2468: Cannot find global value 'Promise'. -+index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + + -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.js (3 errors) ==== ++==== subfolder/index.js (2 errors) ==== // cjs format file import {h} from "../index.js"; -- ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. --!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. + ~~~~~~~~~~~~~ + !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. + !!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. import mod = require("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~~ --!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~~ + !!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import {f as _f} from "./index.js"; import mod2 = require("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. export async function f() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("../index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. h(); } - ==== index.js (3 errors) ==== +-==== index.js (3 errors) ==== ++==== index.js (1 errors) ==== // esm format file import {h as _h} from "./index.js"; import mod = require("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -- ~~~~~~~~~~~~ --!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + ~~~~~~~~~~~~ + !!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import {f} from "./subfolder/index.js"; import mod2 = require("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. export async function h() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./subfolder/index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - f(); - } - ==== package.json (0 errors) ==== \ No newline at end of file + const mod4 = await import ("./subfolder/index.js"); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt.diff index d93056aa3d..4c5b8ad1b8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).errors.txt.diff @@ -5,45 +5,46 @@ -index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -subfolder/index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. -subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -+index.js(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. -+subfolder/index.js(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -+ To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. -+subfolder/index.js(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - - - ==== subfolder/index.js (2 errors) ==== - // cjs format file - import {h} from "../index.js"; -+ ~~~~~~~~~~~~~ -+!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. -+!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mjs' or create a local package.json file with `{ "type": "module" }`. - import mod = require("../index.js"); +- +- +-==== subfolder/index.js (2 errors) ==== +- // cjs format file +- import {h} from "../index.js"; +- import mod = require("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~~ -+!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f as _f} from "./index.js"; - import mod2 = require("./index.js"); +- import {f as _f} from "./index.js"; +- import mod2 = require("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. - export async function f() { - const mod3 = await import ("../index.js"); - const mod4 = await import ("./index.js"); - h(); - } +- export async function f() { +- const mod3 = await import ("../index.js"); +- const mod4 = await import ("./index.js"); +- h(); +- } -==== index.js (2 errors) ==== -+==== index.js (1 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); +- // esm format file +- import {h as _h} from "./index.js"; +- import mod = require("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. -+ ~~~~~~~~~~~~ -+!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. - import {f} from "./subfolder/index.js"; - import mod2 = require("./subfolder/index.js"); +- import {f} from "./subfolder/index.js"; +- import mod2 = require("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS8002: 'import ... =' can only be used in TypeScript files. - export async function h() { - const mod3 = await import ("./index.js"); - const mod4 = await import ("./subfolder/index.js"); \ No newline at end of file +- export async function h() { +- const mod3 = await import ("./index.js"); +- const mod4 = await import ("./subfolder/index.js"); +- f(); +- } +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types.diff deleted file mode 100644 index 9bbfd2daa6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types -+++ new.nodeModulesAllowJsSynchronousCallErrors(module=nodenext).types -@@= skipped -24, +24 lines =@@ - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./index.js") : { f(): Promise; default: typeof mod2; } -->import ("./index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./index.js") : typeof mod2 -+>import ("./index.js") : Promise - >"./index.js" : "./index.js" - - h(); -@@= skipped -34, +34 lines =@@ - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); -->mod4 : { f(): Promise; default: typeof mod2; } -->await import ("./subfolder/index.js") : { f(): Promise; default: typeof mod2; } -->import ("./subfolder/index.js") : Promise<{ f(): Promise; default: typeof mod2; }> -+>mod4 : typeof mod2 -+>await import ("./subfolder/index.js") : typeof mod2 -+>import ("./subfolder/index.js") : Promise - >"./subfolder/index.js" : "./subfolder/index.js" - - f(); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt.diff deleted file mode 100644 index c425421972..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt -+++ new.nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - - - ==== subfolder/index.js (2 errors) ==== - // cjs format file - const x = await 1; - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --==== index.js (0 errors) ==== -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+==== index.js (2 errors) ==== - // esm format file - const x = await 1; -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} -+ ~~~~~ -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file