From 35b5e8207b1ef83b02ea7b2d15306381ff70a3c3 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 6 Dec 2024 15:41:24 -0800 Subject: [PATCH 1/7] Add option value and update diagnostics --- src/compiler/checker.ts | 16 ++++++++-------- src/compiler/commandLineParser.ts | 1 + src/compiler/diagnosticMessages.json | 16 ++++++++-------- src/compiler/types.ts | 1 + src/server/protocol.ts | 1 + .../codefixes/fixModuleAndTargetOptions.ts | 6 +++--- src/services/codefixes/importFixes.ts | 1 + 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b439b7fd9c579..43e08437a0cf2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -37633,7 +37633,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } else if (moduleKind < ModuleKind.ES2020 && moduleKind !== ModuleKind.System) { - error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext); + error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_or_nodenext); } const file = getSourceFileOfNode(node); Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag."); @@ -39228,8 +39228,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // fallthrough default: span ??= getSpanOfTokenAtPosition(sourceFile, node.pos); - const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : - Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher; + const message = isAwaitExpression(node) ? Diagnostics.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 : + Diagnostics.Top_level_await_using_statements_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; diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message)); hasError = true; break; @@ -48065,10 +48065,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const message = isImportAttributes ? moduleKind === ModuleKind.NodeNext ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls - : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve + : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve : moduleKind === ModuleKind.NodeNext ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls - : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve; + : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve; return grammarErrorOnNode(node, message); } @@ -52076,7 +52076,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // fallthrough default: diagnostics.add( - createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher), + createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.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), ); break; } @@ -52878,7 +52878,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } if (moduleKind === ModuleKind.ES2015) { - return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext); + return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_or_nodenext); } if (node.typeArguments) { @@ -52892,7 +52892,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (nodeArguments.length > 1) { const importAttributesArgument = nodeArguments[1]; - return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve); + return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_nodenext_or_preserve); } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index cbd8bfcbcebe6..ff95389e60974 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -600,6 +600,7 @@ export const moduleOptionDeclaration: CommandLineOptionOfCustomType = { es2022: ModuleKind.ES2022, esnext: ModuleKind.ESNext, node16: ModuleKind.Node16, + node18: ModuleKind.Node18, nodenext: ModuleKind.NodeNext, preserve: ModuleKind.Preserve, })), diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0b2951d8dee2d..d757b34d5c384 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1028,11 +1028,11 @@ "category": "Error", "code": 1322 }, - "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'.": { + "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'.": { "category": "Error", "code": 1323 }, - "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'.": { + "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'.": { "category": "Error", "code": 1324 }, @@ -1100,7 +1100,7 @@ "category": "Error", "code": 1341 }, - "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.": { + "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'.": { "category": "Error", "code": 1343 }, @@ -1220,7 +1220,7 @@ "category": "Message", "code": 1377 }, - "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher.": { + "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.": { "category": "Error", "code": 1378 }, @@ -1424,7 +1424,7 @@ "category": "Error", "code": 1431 }, - "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher.": { + "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.": { "category": "Error", "code": 1432 }, @@ -3788,7 +3788,7 @@ "category": "Error", "code": 2820 }, - "Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.": { + "Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'.": { "category": "Error", "code": 2821 }, @@ -3796,7 +3796,7 @@ "category": "Error", "code": 2822 }, - "Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.": { + "Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'.": { "category": "Error", "code": 2823 }, @@ -3876,7 +3876,7 @@ "category": "Error", "code": 2853 }, - "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher.": { + "Top-level 'await using' statements 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.": { "category": "Error", "code": 2854 }, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 46ff57009e7fa..49938f0fc8249 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7545,6 +7545,7 @@ export enum ModuleKind { // Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext Node16 = 100, + Node18 = 101, NodeNext = 199, // Emit as written diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 232b224786e43..4683a1f300662 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -3254,6 +3254,7 @@ export const enum ModuleKind { ES2022 = "es2022", ESNext = "esnext", Node16 = "node16", + Node18 = "node18", NodeNext = "nodenext", Preserve = "preserve", } diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 8f24304624a05..130797d5dafcb 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -19,9 +19,9 @@ import { registerCodeFix({ errorCodes: [ - Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code, - Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code, - Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code, + Diagnostics.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.code, + Diagnostics.Top_level_await_using_statements_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.code, + Diagnostics.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.code, ], getCodeActions: function getCodeActionsToFixModuleAndTarget(context) { const compilerOptions = context.program.getCompilerOptions(); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index a1537c8bde5b7..e2b83f0c5fe8b 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -1558,6 +1558,7 @@ function getUmdImportKind(importingFile: SourceFile | FutureSourceFile, program: // Fall back to the `import * as ns` style import. return ImportKind.Namespace; case ModuleKind.Node16: + case ModuleKind.Node18: case ModuleKind.NodeNext: return getImpliedNodeFormatForEmit(importingFile, program) === ModuleKind.ESNext ? ImportKind.Namespace : ImportKind.CommonJS; default: From ae11b63969d82c2e36b0cf84b4ac7e57cb3f1f35 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 9 Dec 2024 12:04:22 -0800 Subject: [PATCH 2/7] Add variant to tests, update all conditions checking for node16/nodenext specifically --- package-lock.json | 16 +- package.json | 2 +- src/compiler/checker.ts | 31 +- src/compiler/utilities.ts | 23 +- tests/baselines/reference/api/typescript.d.ts | 2 + ...entifiers_module(module=node18).errors.txt | 44 + ...espaceIdentifiers_module(module=node18).js | 71 + ...eIdentifiers_module(module=node18).symbols | 82 + ...aceIdentifiers_module(module=node18).types | 151 ++ .../awaitInNonAsyncFunction.errors.txt | 8 +- ...ngDeclarations.1(target=es2015).errors.txt | 60 +- ...UsingDeclarations.1(target=es5).errors.txt | 60 +- ...ngDeclarations.2(target=es2015).errors.txt | 4 +- ...UsingDeclarations.2(target=es5).errors.txt | 4 +- ...ngDeclarations.3(target=es2015).errors.txt | 4 +- ...UsingDeclarations.3(target=es5).errors.txt | 4 +- ...tionsInForAwaitOf.3(target=es5).errors.txt | 4 +- .../Parse empty options of --module.js | 2 +- ...odule to compiler-options with json api.js | 2 +- ...ompiler-options with jsonSourceFile api.js | 2 +- ...hLocalCollisions(module=node18).errors.txt | 12 + ...lpersWithLocalCollisions(module=node18).js | 29 + ...portAssertion1(module=commonjs).errors.txt | 48 +- ...importAssertion1(module=es2015).errors.txt | 56 +- ...portAssertion2(module=commonjs).errors.txt | 24 +- ...importAssertion2(module=es2015).errors.txt | 24 +- ...importAssertion3(module=es2015).errors.txt | 16 +- ...ortAttributes1(module=commonjs).errors.txt | 48 +- ...mportAttributes1(module=es2015).errors.txt | 56 +- ...ortAttributes2(module=commonjs).errors.txt | 24 +- ...mportAttributes2(module=es2015).errors.txt | 24 +- ...mportAttributes3(module=es2015).errors.txt | 16 +- ...portCallExpressionErrorInES2015.errors.txt | 12 +- ...mportCallExpressionGrammarError.errors.txt | 4 +- ...mportCallExpressionNestedES2015.errors.txt | 8 +- ...portCallExpressionNestedES20152.errors.txt | 8 +- ...eta(module=commonjs,target=es5).errors.txt | 52 +- ...(module=commonjs,target=esnext).errors.txt | 52 +- .../reference/importTag14.errors.txt | 4 +- .../importTag15(module=es2015).errors.txt | 8 +- ...deDefaultImports(module=node18).errors.txt | 66 + ...moduleNodeDefaultImports(module=node18).js | 70 + ...eNodeDefaultImports(module=node18).symbols | 116 ++ ...uleNodeDefaultImports(module=node18).types | 210 +++ ...veTopLevelAwait1(target=es2016).errors.txt | 8 +- ...(module=node18,moduleresolution=node16).js | 19 + ...le=node18,moduleresolution=node16).symbols | 15 + ...dule=node18,moduleresolution=node16).types | 22 + ...odule=node18,moduleresolution=nodenext).js | 19 + ...=node18,moduleresolution=nodenext).symbols | 15 + ...le=node18,moduleresolution=nodenext).types | 22 + ...sPackageSelfName(module=node18).errors.txt | 32 + ...deAllowJsPackageSelfName(module=node18).js | 48 + ...owJsPackageSelfName(module=node18).symbols | 26 + ...llowJsPackageSelfName(module=node18).types | 32 + .../nodeModules1(module=node18).errors.txt | 512 ++++++ .../reference/nodeModules1(module=node18).js | 691 ++++++++ .../nodeModules1(module=node18).symbols | 831 ++++++++++ .../nodeModules1(module=node18).types | 1440 +++++++++++++++++ ...eModulesAllowJs1(module=node18).errors.txt | 611 +++++++ .../nodeModulesAllowJs1(module=node18).js | 679 ++++++++ ...nodeModulesAllowJs1(module=node18).symbols | 831 ++++++++++ .../nodeModulesAllowJs1(module=node18).types | 1440 +++++++++++++++++ ...AllowJsCjsFromJs(module=node18).errors.txt | 12 + ...lesAllowJsCjsFromJs(module=node18).symbols | 15 + ...dulesAllowJsCjsFromJs(module=node18).types | 28 + ...alPackageExports(module=node18).errors.txt | 224 +++ ...onditionalPackageExports(module=node18).js | 186 +++ ...ionalPackageExports(module=node18).symbols | 221 +++ ...itionalPackageExports(module=node18).types | 344 ++++ ...wJsDynamicImport(module=node18).errors.txt | 26 + ...ulesAllowJsDynamicImport(module=node18).js | 47 + ...llowJsDynamicImport(module=node18).symbols | 24 + ...sAllowJsDynamicImport(module=node18).types | 39 + ...ExportAssignment(module=node18).errors.txt | 46 + ...sAllowJsExportAssignment(module=node18).js | 65 + ...wJsExportAssignment(module=node18).symbols | 38 + ...lowJsExportAssignment(module=node18).types | 67 + ...uleDetectionAuto(module=node18).errors.txt | 8 + ...essJsModuleDetectionAuto(module=node18).js | 13 + ...ModuleDetectionAuto(module=node18).symbols | 8 + ...JsModuleDetectionAuto(module=node18).types | 8 + ...edNameCollisions(module=node18).errors.txt | 28 + ...sGeneratedNameCollisions(module=node18).js | 67 + ...ratedNameCollisions(module=node18).symbols | 40 + ...neratedNameCollisions(module=node18).types | 62 + ...ImportAssignment(module=node18).errors.txt | 51 + ...sAllowJsImportAssignment(module=node18).js | 63 + ...wJsImportAssignment(module=node18).symbols | 45 + ...lowJsImportAssignment(module=node18).types | 69 + ...lpersCollisions1(module=node18).errors.txt | 32 + ...ImportHelpersCollisions1(module=node18).js | 53 + ...tHelpersCollisions1(module=node18).symbols | 42 + ...ortHelpersCollisions1(module=node18).types | 70 + ...lpersCollisions2(module=node18).errors.txt | 28 + ...ImportHelpersCollisions2(module=node18).js | 77 + ...tHelpersCollisions2(module=node18).symbols | 24 + ...ortHelpersCollisions2(module=node18).types | 28 + ...lpersCollisions3(module=node18).errors.txt | 30 + ...ImportHelpersCollisions3(module=node18).js | 57 + ...tHelpersCollisions3(module=node18).symbols | 38 + ...ortHelpersCollisions3(module=node18).types | 50 + ...llowJsImportMeta(module=node18).errors.txt | 28 + ...ModulesAllowJsImportMeta(module=node18).js | 41 + ...esAllowJsImportMeta(module=node18).symbols | 26 + ...ulesAllowJsImportMeta(module=node18).types | 38 + ...JsPackageExports(module=node18).errors.txt | 172 ++ ...lesAllowJsPackageExports(module=node18).js | 146 ++ ...lowJsPackageExports(module=node18).symbols | 176 ++ ...AllowJsPackageExports(module=node18).types | 230 +++ ...JsPackageImports(module=node18).errors.txt | 67 + ...lesAllowJsPackageImports(module=node18).js | 77 + ...lowJsPackageImports(module=node18).symbols | 62 + ...AllowJsPackageImports(module=node18).types | 80 + ...gePatternExports(module=node18).errors.txt | 122 ++ ...wJsPackagePatternExports(module=node18).js | 105 ++ ...ckagePatternExports(module=node18).symbols | 122 ++ ...PackagePatternExports(module=node18).types | 158 ++ ...rnExportsExclude(module=node18).errors.txt | 125 ++ ...agePatternExportsExclude(module=node18).js | 108 ++ ...tternExportsExclude(module=node18).symbols | 122 ++ ...PatternExportsExclude(module=node18).types | 158 ++ ...nExportsTrailers(module=node18).errors.txt | 122 ++ ...gePatternExportsTrailers(module=node18).js | 105 ++ ...ternExportsTrailers(module=node18).symbols | 122 ++ ...atternExportsTrailers(module=node18).types | 158 ++ ...ronousCallErrors(module=node18).errors.txt | 48 + ...wJsSynchronousCallErrors(module=node18).js | 69 + ...nchronousCallErrors(module=node18).symbols | 60 + ...SynchronousCallErrors(module=node18).types | 102 ++ ...wJsTopLevelAwait(module=node18).errors.txt | 36 + ...ulesAllowJsTopLevelAwait(module=node18).js | 45 + ...llowJsTopLevelAwait(module=node18).symbols | 24 + ...sAllowJsTopLevelAwait(module=node18).types | 42 + ...AlwaysHasDefault(module=node18).errors.txt | 24 + ...rmatFileAlwaysHasDefault(module=node18).js | 38 + ...ileAlwaysHasDefault(module=node18).symbols | 15 + ...tFileAlwaysHasDefault(module=node18).types | 20 + ...alPackageExports(module=node18).errors.txt | 224 +++ ...onditionalPackageExports(module=node18).js | 186 +++ ...ionalPackageExports(module=node18).symbols | 221 +++ ...itionalPackageExports(module=node18).types | 344 ++++ ...thPackageExports(module=node18).errors.txt | 184 +++ ...onEmitWithPackageExports(module=node18).js | 167 ++ ...tWithPackageExports(module=node18).symbols | 203 +++ ...mitWithPackageExports(module=node18).types | 284 ++++ ...lesDynamicImport(module=node18).errors.txt | 26 + ...nodeModulesDynamicImport(module=node18).js | 47 + ...odulesDynamicImport(module=node18).symbols | 24 + ...eModulesDynamicImport(module=node18).types | 39 + ...xportAssignments(module=node18).errors.txt | 28 + ...ModulesExportAssignments(module=node18).js | 39 + ...esExportAssignments(module=node18).symbols | 18 + ...ulesExportAssignments(module=node18).types | 26 + ...cifierResolution(module=node18).errors.txt | 38 + ...locksSpecifierResolution(module=node18).js | 37 + ...SpecifierResolution(module=node18).symbols | 24 + ...ksSpecifierResolution(module=node18).types | 39 + ...cksTypesVersions(module=node18).errors.txt | 108 ++ ...portsBlocksTypesVersions(module=node18).js | 71 + ...BlocksTypesVersions(module=node18).symbols | 28 + ...cksTypesVersions(module=node18).trace.json | 798 +++++++++ ...tsBlocksTypesVersions(module=node18).types | 28 + ...sExportsSourceTs(module=node18).errors.txt | 42 + ...deModulesExportsSourceTs(module=node18).js | 56 + ...ulesExportsSourceTs(module=node18).symbols | 27 + ...odulesExportsSourceTs(module=node18).types | 47 + ...rationConditions(module=node18).errors.txt | 45 + ...fierGenerationConditions(module=node18).js | 44 + ...enerationConditions(module=node18).symbols | 24 + ...rGenerationConditions(module=node18).types | 39 + ...erationDirectory(module=node18).errors.txt | 40 + ...ifierGenerationDirectory(module=node18).js | 39 + ...GenerationDirectory(module=node18).symbols | 24 + ...erGenerationDirectory(module=node18).types | 39 + ...enerationPattern(module=node18).errors.txt | 40 + ...ecifierGenerationPattern(module=node18).js | 39 + ...erGenerationPattern(module=node18).symbols | 24 + ...fierGenerationPattern(module=node18).types | 39 + ...esForbidenSyntax(module=node18).errors.txt | 141 ++ ...odeModulesForbidenSyntax(module=node18).js | 190 +++ ...dulesForbidenSyntax(module=node18).symbols | 122 ++ ...ModulesForbidenSyntax(module=node18).types | 266 +++ ...edNameCollisions(module=node18).errors.txt | 28 + ...sGeneratedNameCollisions(module=node18).js | 69 + ...ratedNameCollisions(module=node18).symbols | 40 + ...neratedNameCollisions(module=node18).types | 62 + ...ImportAssertions(module=node16).errors.txt | 8 +- ...ImportAssertions(module=node18).errors.txt | 28 + ...eModulesImportAssertions(module=node18).js | 21 + ...lesImportAssertions(module=node18).symbols | 27 + ...dulesImportAssertions(module=node18).types | 57 + ...mportAssignments(module=node18).errors.txt | 33 + ...ModulesImportAssignments(module=node18).js | 63 + ...esImportAssignments(module=node18).symbols | 45 + ...ulesImportAssignments(module=node18).types | 69 + ...ImportAttributes(module=node16).errors.txt | 8 +- ...ImportAttributes(module=node18).errors.txt | 29 + ...eModulesImportAttributes(module=node18).js | 22 + ...lesImportAttributes(module=node18).symbols | 28 + ...dulesImportAttributes(module=node18).types | 58 + ...DeclarationEmit1(module=node16).errors.txt | 8 +- ...DeclarationEmit1(module=node18).errors.txt | 54 + ...utesModeDeclarationEmit1(module=node18).js | 45 + ...odeDeclarationEmit1(module=node18).symbols | 31 + ...sModeDeclarationEmit1(module=node18).types | 35 + ...DeclarationEmit2(module=node16).errors.txt | 8 +- ...DeclarationEmit2(module=node18).errors.txt | 59 + ...utesModeDeclarationEmit2(module=node18).js | 50 + ...odeDeclarationEmit2(module=node18).symbols | 31 + ...sModeDeclarationEmit2(module=node18).types | 35 + ...rationEmitErrors(module=node16).errors.txt | 12 +- ...rationEmitErrors(module=node18).errors.txt | 51 + ...odeDeclarationEmitErrors(module=node18).js | 39 + ...clarationEmitErrors(module=node18).symbols | 24 + ...DeclarationEmitErrors(module=node18).types | 29 + ...eDeclarationEmit(module=node18).errors.txt | 37 + ...sTypeModeDeclarationEmit(module=node18).js | 36 + ...ModeDeclarationEmit(module=node18).symbols | 15 + ...peModeDeclarationEmit(module=node18).types | 30 + ...rationEmitErrors(module=node18).errors.txt | 343 ++++ ...odeDeclarationEmitErrors(module=node18).js | 153 ++ ...clarationEmitErrors(module=node18).symbols | 116 ++ ...DeclarationEmitErrors(module=node18).types | 293 ++++ ...elpersCollisions(module=node18).errors.txt | 32 + ...sImportHelpersCollisions(module=node18).js | 53 + ...rtHelpersCollisions(module=node18).symbols | 42 + ...portHelpersCollisions(module=node18).types | 70 + ...lpersCollisions2(module=node18).errors.txt | 28 + ...ImportHelpersCollisions2(module=node18).js | 77 + ...tHelpersCollisions2(module=node18).symbols | 24 + ...ortHelpersCollisions2(module=node18).types | 28 + ...lpersCollisions3(module=node18).errors.txt | 26 + ...ImportHelpersCollisions3(module=node18).js | 45 + ...tHelpersCollisions3(module=node18).symbols | 22 + ...ortHelpersCollisions3(module=node18).types | 26 + ...odulesImportMeta(module=node18).errors.txt | 28 + .../nodeModulesImportMeta(module=node18).js | 43 + ...deModulesImportMeta(module=node18).symbols | 26 + ...nodeModulesImportMeta(module=node18).types | 38 + ...DeclarationEmit1(module=node16).errors.txt | 8 +- ...DeclarationEmit1(module=node18).errors.txt | 54 + ...portModeDeclarationEmit1(module=node18).js | 45 + ...odeDeclarationEmit1(module=node18).symbols | 31 + ...tModeDeclarationEmit1(module=node18).types | 35 + ...DeclarationEmit2(module=node16).errors.txt | 8 +- ...DeclarationEmit2(module=node18).errors.txt | 59 + ...portModeDeclarationEmit2(module=node18).js | 50 + ...odeDeclarationEmit2(module=node18).symbols | 31 + ...tModeDeclarationEmit2(module=node18).types | 35 + ...ationEmitErrors1(module=node16).errors.txt | 12 +- ...ationEmitErrors1(module=node18).errors.txt | 51 + ...deDeclarationEmitErrors1(module=node18).js | 39 + ...larationEmitErrors1(module=node18).symbols | 24 + ...eclarationEmitErrors1(module=node18).types | 29 + ...lutionIntoExport(module=node18).errors.txt | 35 + ...portResolutionIntoExport(module=node18).js | 51 + ...esolutionIntoExport(module=node18).symbols | 26 + ...tResolutionIntoExport(module=node18).types | 32 + ...esolutionNoCycle(module=node18).errors.txt | 35 + ...sImportResolutionNoCycle(module=node18).js | 51 + ...rtResolutionNoCycle(module=node18).symbols | 26 + ...portResolutionNoCycle(module=node18).types | 32 + ...DeclarationEmit1(module=node18).errors.txt | 37 + ...TypeModeDeclarationEmit1(module=node18).js | 36 + ...odeDeclarationEmit1(module=node18).symbols | 15 + ...eModeDeclarationEmit1(module=node18).types | 30 + ...ationEmitErrors1(module=node18).errors.txt | 337 ++++ ...deDeclarationEmitErrors1(module=node18).js | 147 ++ ...larationEmitErrors1(module=node18).symbols | 116 ++ ...eclarationEmitErrors1(module=node18).types | 291 ++++ .../nodeModulesJson(module=node16).errors.txt | 20 +- .../nodeModulesJson(module=node18).errors.txt | 93 ++ .../nodeModulesJson(module=node18).symbols | 75 + .../nodeModulesJson(module=node18).types | 124 ++ ...esPackageExports(module=node18).errors.txt | 172 ++ ...odeModulesPackageExports(module=node18).js | 146 ++ ...dulesPackageExports(module=node18).symbols | 176 ++ ...ModulesPackageExports(module=node18).types | 230 +++ ...esPackageImports(module=node18).errors.txt | 67 + ...odeModulesPackageImports(module=node18).js | 77 + ...dulesPackageImports(module=node18).symbols | 62 + ...esPackageImports(module=node18).trace.json | 874 ++++++++++ ...ModulesPackageImports(module=node18).types | 80 + ...gePatternExports(module=node18).errors.txt | 122 ++ ...lesPackagePatternExports(module=node18).js | 105 ++ ...ckagePatternExports(module=node18).symbols | 122 ++ ...PackagePatternExports(module=node18).types | 158 ++ ...rnExportsExclude(module=node18).errors.txt | 221 +++ ...agePatternExportsExclude(module=node18).js | 168 ++ ...tternExportsExclude(module=node18).symbols | 236 +++ ...PatternExportsExclude(module=node18).types | 308 ++++ ...nExportsTrailers(module=node18).errors.txt | 122 ++ ...gePatternExportsTrailers(module=node18).js | 105 ++ ...ternExportsTrailers(module=node18).symbols | 122 ++ ...nExportsTrailers(module=node18).trace.json | 837 ++++++++++ ...atternExportsTrailers(module=node18).types | 158 ++ ...esolveJsonModule(module=node16).errors.txt | 16 +- ...esolveJsonModule(module=node18).errors.txt | 43 + ...ModulesResolveJsonModule(module=node18).js | 93 ++ ...esResolveJsonModule(module=node18).symbols | 83 + ...ulesResolveJsonModule(module=node18).types | 156 ++ ...ronousCallErrors(module=node18).errors.txt | 36 + ...lesSynchronousCallErrors(module=node18).js | 62 + ...nchronousCallErrors(module=node18).symbols | 60 + ...SynchronousCallErrors(module=node18).types | 102 ++ ...lesTopLevelAwait(module=node18).errors.txt | 36 + ...nodeModulesTopLevelAwait(module=node18).js | 47 + ...odulesTopLevelAwait(module=node18).symbols | 24 + ...eModulesTopLevelAwait(module=node18).types | 42 + ...DeclarationEmit1(module=node18).errors.txt | 32 + ...enceModeDeclarationEmit1(module=node18).js | 35 + ...odeDeclarationEmit1(module=node18).symbols | 7 + ...eModeDeclarationEmit1(module=node18).types | 6 + ...DeclarationEmit2(module=node18).errors.txt | 37 + ...enceModeDeclarationEmit2(module=node18).js | 40 + ...odeDeclarationEmit2(module=node18).symbols | 7 + ...eModeDeclarationEmit2(module=node18).types | 6 + ...DeclarationEmit3(module=node18).errors.txt | 31 + ...enceModeDeclarationEmit3(module=node18).js | 40 + ...odeDeclarationEmit3(module=node18).symbols | 16 + ...eModeDeclarationEmit3(module=node18).types | 14 + ...DeclarationEmit4(module=node18).errors.txt | 26 + ...enceModeDeclarationEmit4(module=node18).js | 35 + ...odeDeclarationEmit4(module=node18).symbols | 16 + ...eModeDeclarationEmit4(module=node18).types | 14 + ...DeclarationEmit5(module=node18).errors.txt | 27 + ...enceModeDeclarationEmit5(module=node18).js | 38 + ...odeDeclarationEmit5(module=node18).symbols | 26 + ...eModeDeclarationEmit5(module=node18).types | 23 + ...DeclarationEmit6(module=node18).errors.txt | 37 + ...enceModeDeclarationEmit6(module=node18).js | 50 + ...odeDeclarationEmit6(module=node18).symbols | 14 + ...eModeDeclarationEmit6(module=node18).types | 25 + ...DeclarationEmit7(module=node18).errors.txt | 63 + ...enceModeDeclarationEmit7(module=node18).js | 80 + ...odeDeclarationEmit7(module=node18).symbols | 23 + ...eModeDeclarationEmit7(module=node18).types | 42 + ...nceModeOverride1(module=node18).errors.txt | 37 + ...shReferenceModeOverride1(module=node18).js | 33 + ...erenceModeOverride1(module=node18).symbols | 8 + ...eferenceModeOverride1(module=node18).types | 13 + ...nceModeOverride2(module=node18).errors.txt | 42 + ...shReferenceModeOverride2(module=node18).js | 38 + ...erenceModeOverride2(module=node18).symbols | 8 + ...eferenceModeOverride2(module=node18).types | 13 + ...nceModeOverride3(module=node18).errors.txt | 36 + ...shReferenceModeOverride3(module=node18).js | 38 + ...erenceModeOverride3(module=node18).symbols | 17 + ...eferenceModeOverride3(module=node18).types | 23 + ...nceModeOverride4(module=node18).errors.txt | 31 + ...shReferenceModeOverride4(module=node18).js | 33 + ...erenceModeOverride4(module=node18).symbols | 17 + ...eferenceModeOverride4(module=node18).types | 23 + ...nceModeOverride5(module=node18).errors.txt | 31 + ...shReferenceModeOverride5(module=node18).js | 39 + ...erenceModeOverride5(module=node18).symbols | 30 + ...eferenceModeOverride5(module=node18).types | 36 + ...verrideModeError(module=node18).errors.txt | 40 + ...nceModeOverrideModeError(module=node18).js | 33 + ...deOverrideModeError(module=node18).symbols | 8 + ...ModeOverrideModeError(module=node18).types | 13 + ...onPackageExports(module=node18).errors.txt | 63 + ...pesVersionPackageExports(module=node18).js | 79 + ...rsionPackageExports(module=node18).symbols | 53 + ...VersionPackageExports(module=node18).types | 89 + ...ePackageSelfName(module=node18).errors.txt | 32 + .../nodePackageSelfName(module=node18).js | 48 + ...nodePackageSelfName(module=node18).symbols | 26 + .../nodePackageSelfName(module=node18).types | 32 + ...geSelfNameScoped(module=node18).errors.txt | 32 + ...odePackageSelfNameScoped(module=node18).js | 48 + ...ckageSelfNameScoped(module=node18).symbols | 26 + ...PackageSelfNameScoped(module=node18).types | 32 + .../parser.forAwait.es2018.errors.txt | 8 +- ....1(module=es2022,target=es2015).errors.txt | 12 +- ....1(module=esnext,target=es2015).errors.txt | 12 +- ....1(module=system,target=es2015).errors.txt | 12 +- ...ons module-kind is out-of-range.errors.txt | 4 +- ...ler-options module-kind is out-of-range.js | 2 + ...nd is out-of-range.oldTranspile.errors.txt | 4 +- ...odule-kind is out-of-range.oldTranspile.js | 2 + ...s target-script is out-of-range.errors.txt | 4 +- ...r-options target-script is out-of-range.js | 2 + ...pt is out-of-range.oldTranspile.errors.txt | 4 +- ...get-script is out-of-range.oldTranspile.js | 2 + ...thMissingExports(module=node18).errors.txt | 16 + ...erenceWithMissingExports(module=node18).js | 20 + ...eWithMissingExports(module=node18).symbols | 15 + ...nceWithMissingExports(module=node18).types | 20 + ...does-not-add-color-when-NO_COLOR-is-set.js | 2 +- .../reference/tsc/commandLine/help-all.js | 2 +- .../reference/tsc/commandLine/help.js | 2 +- ...-when-host-can't-provide-terminal-width.js | 2 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- .../compiler/moduleNodeDefaultImports.ts | 2 +- .../compiler/moduleResolutionWithModule.ts | 4 +- ...leSlashTypesReferenceWithMissingExports.ts | 2 +- .../allowImportingTsExtensions.ts | 2 +- .../allowImportingTypesDtsExtension.ts | 2 +- .../conditionalExportsResolutionFallback.ts | 2 +- .../extensionLoadingPriority.ts | 2 +- .../nestedPackageJsonRedirect.ts | 2 +- .../packageJsonImportsExportsOptionCompat.ts | 2 +- .../allowJs/nodeAllowJsPackageSelfName.ts | 2 +- .../node/allowJs/nodeModulesAllowJs1.ts | 2 +- .../allowJs/nodeModulesAllowJsCjsFromJs.ts | 2 +- ...ModulesAllowJsConditionalPackageExports.ts | 2 +- .../nodeModulesAllowJsDynamicImport.ts | 2 +- .../nodeModulesAllowJsExportAssignment.ts | 2 +- ...sAllowJsExportlessJsModuleDetectionAuto.ts | 2 +- ...deModulesAllowJsGeneratedNameCollisions.ts | 2 +- .../nodeModulesAllowJsImportAssignment.ts | 2 +- ...eModulesAllowJsImportHelpersCollisions1.ts | 2 +- ...eModulesAllowJsImportHelpersCollisions2.ts | 2 +- ...eModulesAllowJsImportHelpersCollisions3.ts | 2 +- .../allowJs/nodeModulesAllowJsImportMeta.ts | 2 +- .../nodeModulesAllowJsPackageExports.ts | 2 +- .../nodeModulesAllowJsPackageImports.ts | 2 +- ...nodeModulesAllowJsPackagePatternExports.ts | 2 +- ...ulesAllowJsPackagePatternExportsExclude.ts | 2 +- ...lesAllowJsPackagePatternExportsTrailers.ts | 2 +- ...nodeModulesAllowJsSynchronousCallErrors.ts | 2 +- .../nodeModulesAllowJsTopLevelAwait.ts | 2 +- tests/cases/conformance/node/nodeModules1.ts | 2 +- ...odeModulesCjsFormatFileAlwaysHasDefault.ts | 2 +- .../nodeModulesConditionalPackageExports.ts | 2 +- ...odulesDeclarationEmitWithPackageExports.ts | 2 +- .../node/nodeModulesDynamicImport.ts | 2 +- .../node/nodeModulesExportAssignments.ts | 2 +- ...ModulesExportsBlocksSpecifierResolution.ts | 2 +- .../nodeModulesExportsBlocksTypesVersions.ts | 2 +- .../node/nodeModulesExportsSourceTs.ts | 2 +- ...lesExportsSpecifierGenerationConditions.ts | 2 +- ...ulesExportsSpecifierGenerationDirectory.ts | 2 +- ...odulesExportsSpecifierGenerationPattern.ts | 2 +- .../node/nodeModulesForbidenSyntax.ts | 2 +- .../nodeModulesGeneratedNameCollisions.ts | 2 +- .../node/nodeModulesImportAssertions.ts | 2 +- .../node/nodeModulesImportAssignments.ts | 2 +- .../node/nodeModulesImportAttributes.ts | 2 +- ...lesImportAttributesModeDeclarationEmit1.ts | 2 +- ...lesImportAttributesModeDeclarationEmit2.ts | 2 +- ...portAttributesModeDeclarationEmitErrors.ts | 2 +- ...ImportAttributesTypeModeDeclarationEmit.ts | 2 +- ...AttributesTypeModeDeclarationEmitErrors.ts | 2 +- .../nodeModulesImportHelpersCollisions.ts | 2 +- .../nodeModulesImportHelpersCollisions2.ts | 2 +- .../nodeModulesImportHelpersCollisions3.ts | 2 +- .../conformance/node/nodeModulesImportMeta.ts | 2 +- .../nodeModulesImportModeDeclarationEmit1.ts | 2 +- .../nodeModulesImportModeDeclarationEmit2.ts | 2 +- ...ModulesImportModeDeclarationEmitErrors1.ts | 2 +- .../nodeModulesImportResolutionIntoExport.ts | 2 +- .../nodeModulesImportResolutionNoCycle.ts | 2 +- ...deModulesImportTypeModeDeclarationEmit1.ts | 2 +- ...lesImportTypeModeDeclarationEmitErrors1.ts | 2 +- .../cases/conformance/node/nodeModulesJson.ts | 2 +- .../node/nodeModulesPackageExports.ts | 2 +- .../node/nodeModulesPackageImports.ts | 2 +- .../node/nodeModulesPackagePatternExports.ts | 2 +- ...nodeModulesPackagePatternExportsExclude.ts | 2 +- ...odeModulesPackagePatternExportsTrailers.ts | 2 +- .../node/nodeModulesResolveJsonModule.ts | 2 +- .../node/nodeModulesSynchronousCallErrors.ts | 2 +- .../node/nodeModulesTopLevelAwait.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit1.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit2.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit3.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit4.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit5.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit6.ts | 2 +- ...ripleSlashReferenceModeDeclarationEmit7.ts | 2 +- ...odulesTripleSlashReferenceModeOverride1.ts | 2 +- ...odulesTripleSlashReferenceModeOverride2.ts | 2 +- ...odulesTripleSlashReferenceModeOverride3.ts | 2 +- ...odulesTripleSlashReferenceModeOverride4.ts | 2 +- ...odulesTripleSlashReferenceModeOverride5.ts | 2 +- ...ipleSlashReferenceModeOverrideModeError.ts | 2 +- .../nodeModulesTypesVersionPackageExports.ts | 2 +- .../conformance/node/nodePackageSelfName.ts | 2 +- .../node/nodePackageSelfNameScoped.ts | 2 +- 482 files changed, 31216 insertions(+), 524 deletions(-) create mode 100644 tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).errors.txt create mode 100644 tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).js create mode 100644 tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).symbols create mode 100644 tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).types create mode 100644 tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt create mode 100644 tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js create mode 100644 tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt create mode 100644 tests/baselines/reference/moduleNodeDefaultImports(module=node18).js create mode 100644 tests/baselines/reference/moduleNodeDefaultImports(module=node18).symbols create mode 100644 tests/baselines/reference/moduleNodeDefaultImports(module=node18).types create mode 100644 tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js create mode 100644 tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).symbols create mode 100644 tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).types create mode 100644 tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js create mode 100644 tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).symbols create mode 100644 tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).types create mode 100644 tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js create mode 100644 tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).symbols create mode 100644 tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types create mode 100644 tests/baselines/reference/nodeModules1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModules1(module=node18).js create mode 100644 tests/baselines/reference/nodeModules1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModules1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJs1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJs1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesDynamicImport(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesDynamicImport(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesDynamicImport(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportAssignments(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportAssignments(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportAssignments(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json create mode 100644 tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAssertions(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAssertions(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAssignments(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAssignments(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAssignments(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportMeta(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportMeta(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportMeta(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesJson(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesJson(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesJson(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesPackageExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesPackageExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesPackageImports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesPackageImports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json create mode 100644 tests/baselines/reference/nodeModulesPackageImports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json create mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types create mode 100644 tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js create mode 100644 tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols create mode 100644 tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types create mode 100644 tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodePackageSelfName(module=node18).js create mode 100644 tests/baselines/reference/nodePackageSelfName(module=node18).symbols create mode 100644 tests/baselines/reference/nodePackageSelfName(module=node18).types create mode 100644 tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt create mode 100644 tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js create mode 100644 tests/baselines/reference/nodePackageSelfNameScoped(module=node18).symbols create mode 100644 tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types create mode 100644 tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt create mode 100644 tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).js create mode 100644 tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).symbols create mode 100644 tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).types diff --git a/package-lock.json b/package-lock.json index b089dc3b035a7..263435ebf9c74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "playwright": "^1.47.2", "source-map-support": "^0.5.21", "tslib": "^2.7.0", - "typescript": "^5.6.2", + "typescript": "npm:@typescript-deploys/pr-build@5.8.0-pr-60039-24", "typescript-eslint": "^8.8.0", "which": "^3.0.1" }, @@ -4369,10 +4369,12 @@ } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "name": "@typescript-deploys/pr-build", + "version": "5.8.0-pr-60039-24", + "resolved": "https://registry.npmjs.org/@typescript-deploys/pr-build/-/pr-build-5.8.0-pr-60039-24.tgz", + "integrity": "sha512-GqEecrr0K3+4mkNnkh/l7I1sBaDGmVRrHiKP/+YgcPbB0c6K8gFt31sK4hfcq6Oai5y0vmc9wMwfR0NYFbi23g==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -7672,9 +7674,9 @@ } }, "typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "version": "npm:@typescript-deploys/pr-build@5.8.0-pr-60039-24", + "resolved": "https://registry.npmjs.org/@typescript-deploys/pr-build/-/pr-build-5.8.0-pr-60039-24.tgz", + "integrity": "sha512-GqEecrr0K3+4mkNnkh/l7I1sBaDGmVRrHiKP/+YgcPbB0c6K8gFt31sK4hfcq6Oai5y0vmc9wMwfR0NYFbi23g==", "dev": true }, "typescript-eslint": { diff --git a/package.json b/package.json index 4ddb7a53a7146..e272fa7c04915 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "playwright": "^1.47.2", "source-map-support": "^0.5.21", "tslib": "^2.7.0", - "typescript": "^5.6.2", + "typescript": "npm:@typescript-deploys/pr-build@5.8.0-pr-60039-24", "typescript-eslint": "^8.8.0", "which": "^3.0.1" }, diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 43e08437a0cf2..179860bd80ed5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -882,6 +882,7 @@ import { ModuleKind, ModuleResolutionKind, ModuleSpecifierResolutionHost, + moduleSupportsImportAttributes, Mutable, MutableNodeArray, NamedDeclaration, @@ -37627,7 +37628,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkImportMetaProperty(node: MetaProperty) { - if (moduleKind === ModuleKind.Node16 || moduleKind === ModuleKind.NodeNext) { + if (ModuleKind.Node16 <= moduleKind && moduleKind <= ModuleKind.NodeNext) { if (getSourceFileOfNode(node).impliedNodeFormat !== ModuleKind.ESNext) { error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output); } @@ -48060,16 +48061,22 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return; // Other grammar checks do not apply to type-only imports with resolution mode assertions } - const mode = (moduleKind === ModuleKind.NodeNext) && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier); - if (mode !== ModuleKind.ESNext && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.Preserve) { - const message = isImportAttributes - ? moduleKind === ModuleKind.NodeNext + if (!moduleSupportsImportAttributes(moduleKind)) { + return grammarErrorOnNode( + node, + isImportAttributes + ? Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve + : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve, + ); + } + + if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === ModuleKind.CommonJS) { + return grammarErrorOnNode( + node, + isImportAttributes ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls - : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve - : moduleKind === ModuleKind.NodeNext - ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls - : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve; - return grammarErrorOnNode(node, message); + : Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls, + ); } const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? declaration.importClause?.isTypeOnly : declaration.isTypeOnly); @@ -48118,7 +48125,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - if (moduleKind === ModuleKind.NodeNext && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) { + if (ModuleKind.Node18 <= moduleKind && moduleKind <= ModuleKind.NodeNext && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) { // Import attributes/assertions are not allowed in --module node16, so don't suggest adding one error(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]); } @@ -52886,7 +52893,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } const nodeArguments = node.arguments; - if (moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.NodeNext && moduleKind !== ModuleKind.Node16 && moduleKind !== ModuleKind.Preserve) { + if (!(ModuleKind.Node16 <= moduleKind && moduleKind <= ModuleKind.NodeNext) && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.Preserve) { // We are allowed trailing comma after proposal-import-assertions. checkGrammarForDisallowedTrailingComma(nodeArguments); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index debbf655c9947..7a636941d2a03 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2074,7 +2074,7 @@ export function getNonAugmentationDeclaration(symbol: Symbol): Declaration | und } function isCommonJSContainingModuleKind(kind: ModuleKind) { - return kind === ModuleKind.CommonJS || kind === ModuleKind.Node16 || kind === ModuleKind.NodeNext; + return kind === ModuleKind.CommonJS || ModuleKind.Node16 <= kind && kind <= ModuleKind.NodeNext; } /** @internal */ @@ -8940,6 +8940,7 @@ const _computedOptions = createComputedCompilerOptions({ const target = compilerOptions.target === ScriptTarget.ES3 ? undefined : compilerOptions.target; return target ?? ((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) || + (compilerOptions.module === ModuleKind.Node18 && ScriptTarget.ES2022) || (compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) || ScriptTarget.ES5); }, @@ -8981,9 +8982,13 @@ const _computedOptions = createComputedCompilerOptions({ moduleDetection: { dependencies: ["module", "target"], computeValue: (compilerOptions): ModuleDetectionKind => { - return compilerOptions.moduleDetection || - (_computedOptions.module.computeValue(compilerOptions) === ModuleKind.Node16 || - _computedOptions.module.computeValue(compilerOptions) === ModuleKind.NodeNext ? ModuleDetectionKind.Force : ModuleDetectionKind.Auto); + if (compilerOptions.moduleDetection !== undefined) { + return compilerOptions.moduleDetection; + } + const moduleKind = _computedOptions.module.computeValue(compilerOptions); + return ModuleKind.Node16 <= moduleKind && moduleKind <= ModuleKind.NodeNext + ? ModuleDetectionKind.Force + : ModuleDetectionKind.Auto; }, }, isolatedModules: { @@ -9229,6 +9234,16 @@ export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResol || moduleResolution === ModuleResolutionKind.Bundler; } +/** + * @internal + * The same set of options also support import assertions. + */ +export function moduleSupportsImportAttributes(moduleKind: ModuleKind): boolean { + return ModuleKind.Node18 <= moduleKind && moduleKind <= ModuleKind.NodeNext + || moduleKind === ModuleKind.Preserve + || moduleKind === ModuleKind.ESNext; +} + /** @internal */ export type StrictOptionName = | "noImplicitAny" diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 11a12e97d4b2e..4b4404634fdaa 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2516,6 +2516,7 @@ declare namespace ts { ES2022 = "es2022", ESNext = "esnext", Node16 = "node16", + Node18 = "node18", NodeNext = "nodenext", Preserve = "preserve", } @@ -7131,6 +7132,7 @@ declare namespace ts { ES2022 = 7, ESNext = 99, Node16 = 100, + Node18 = 101, NodeNext = 199, Preserve = 200, } diff --git a/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).errors.txt b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).errors.txt new file mode 100644 index 0000000000000..c06cf7caac972 --- /dev/null +++ b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).errors.txt @@ -0,0 +1,44 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +arbitraryModuleNamespaceIdentifiers_module.ts(20,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. +arbitraryModuleNamespaceIdentifiers_module.ts(24,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. +arbitraryModuleNamespaceIdentifiers_module.ts(29,7): error TS2322: Type '"expect error about otherType"' is not assignable to type '"otherType"'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== arbitraryModuleNamespaceIdentifiers_module.ts (3 errors) ==== + const someValue = "someValue"; + type someType = "someType"; + + export { someValue as "" }; + import { "" as valueX } from "./arbitraryModuleNamespaceIdentifiers_module"; + if (valueX !== "someValue") throw "should be someValue"; + + export { "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; + import { "" as valueY } from "./arbitraryModuleNamespaceIdentifiers_module"; + if (valueY !== "someValue") throw "should be someValue"; + + export * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; + import { "" as valueZ } from "./arbitraryModuleNamespaceIdentifiers_module"; + if (valueZ[""] !== "someValue") throw "should be someValue"; + if (valueZ[""] !== "someValue") throw "should be someValue"; + if (valueZ[""] !== valueZ) throw "should be export namespace"; + + export { type someType as "" }; + import { type "" as typeA } from "./arbitraryModuleNamespaceIdentifiers_module"; + const importTest: typeA = "expect error about someType"; + ~~~~~~~~~~ +!!! error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. + + export { type "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; + import { type "" as typeB } from "./arbitraryModuleNamespaceIdentifiers_module"; + const reimportTest: typeB = "expect error about someType"; + ~~~~~~~~~~~~ +!!! error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. + + export type * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; + import { type "" as typeC } from "./arbitraryModuleNamespaceIdentifiers_module"; + export type otherType = "otherType"; + const importStarTestA: typeC.otherType = "expect error about otherType"; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type '"expect error about otherType"' is not assignable to type '"otherType"'. + \ No newline at end of file diff --git a/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).js b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).js new file mode 100644 index 0000000000000..43f95451590dc --- /dev/null +++ b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).js @@ -0,0 +1,71 @@ +//// [tests/cases/conformance/es2022/arbitraryModuleNamespaceIdentifiers/arbitraryModuleNamespaceIdentifiers_module.ts] //// + +//// [arbitraryModuleNamespaceIdentifiers_module.ts] +const someValue = "someValue"; +type someType = "someType"; + +export { someValue as "" }; +import { "" as valueX } from "./arbitraryModuleNamespaceIdentifiers_module"; +if (valueX !== "someValue") throw "should be someValue"; + +export { "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +import { "" as valueY } from "./arbitraryModuleNamespaceIdentifiers_module"; +if (valueY !== "someValue") throw "should be someValue"; + +export * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +import { "" as valueZ } from "./arbitraryModuleNamespaceIdentifiers_module"; +if (valueZ[""] !== "someValue") throw "should be someValue"; +if (valueZ[""] !== "someValue") throw "should be someValue"; +if (valueZ[""] !== valueZ) throw "should be export namespace"; + +export { type someType as "" }; +import { type "" as typeA } from "./arbitraryModuleNamespaceIdentifiers_module"; +const importTest: typeA = "expect error about someType"; + +export { type "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +import { type "" as typeB } from "./arbitraryModuleNamespaceIdentifiers_module"; +const reimportTest: typeB = "expect error about someType"; + +export type * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +import { type "" as typeC } from "./arbitraryModuleNamespaceIdentifiers_module"; +export type otherType = "otherType"; +const importStarTestA: typeC.otherType = "expect error about otherType"; + + +//// [arbitraryModuleNamespaceIdentifiers_module.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports[""] = exports[""] = exports[""] = void 0; +const someValue = "someValue"; +exports[""] = someValue; +const arbitraryModuleNamespaceIdentifiers_module_1 = require("./arbitraryModuleNamespaceIdentifiers_module"); +if (arbitraryModuleNamespaceIdentifiers_module_1[""] !== "someValue") + throw "should be someValue"; +var arbitraryModuleNamespaceIdentifiers_module_2 = require("./arbitraryModuleNamespaceIdentifiers_module"); +Object.defineProperty(exports, "", { enumerable: true, get: function () { return arbitraryModuleNamespaceIdentifiers_module_2[""]; } }); +const arbitraryModuleNamespaceIdentifiers_module_3 = require("./arbitraryModuleNamespaceIdentifiers_module"); +if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") + throw "should be someValue"; +exports[""] = require("./arbitraryModuleNamespaceIdentifiers_module"); +const arbitraryModuleNamespaceIdentifiers_module_4 = require("./arbitraryModuleNamespaceIdentifiers_module"); +if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") + throw "should be someValue"; +if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") + throw "should be someValue"; +if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== arbitraryModuleNamespaceIdentifiers_module_4[""]) + throw "should be export namespace"; +const importTest = "expect error about someType"; +const reimportTest = "expect error about someType"; +const importStarTestA = "expect error about otherType"; + + +//// [arbitraryModuleNamespaceIdentifiers_module.d.ts] +declare const someValue = "someValue"; +type someType = "someType"; +export { someValue as "" }; +export { "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +export * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +export { type someType as "" }; +export { type "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +export type * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +export type otherType = "otherType"; diff --git a/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).symbols b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).symbols new file mode 100644 index 0000000000000..a792b7d3f5280 --- /dev/null +++ b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).symbols @@ -0,0 +1,82 @@ +//// [tests/cases/conformance/es2022/arbitraryModuleNamespaceIdentifiers/arbitraryModuleNamespaceIdentifiers_module.ts] //// + +=== arbitraryModuleNamespaceIdentifiers_module.ts === +const someValue = "someValue"; +>someValue : Symbol(someValue, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 0, 5)) + +type someType = "someType"; +>someType : Symbol(someType, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 0, 30)) + +export { someValue as "" }; +>someValue : Symbol(someValue, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 0, 5)) +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 3, 8)) + +import { "" as valueX } from "./arbitraryModuleNamespaceIdentifiers_module"; +>valueX : Symbol(valueX, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 4, 8)) + +if (valueX !== "someValue") throw "should be someValue"; +>valueX : Symbol(valueX, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 4, 8)) + +export { "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 7, 8)) + +import { "" as valueY } from "./arbitraryModuleNamespaceIdentifiers_module"; +>valueY : Symbol(valueY, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 8, 8)) + +if (valueY !== "someValue") throw "should be someValue"; +>valueY : Symbol(valueY, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 8, 8)) + +export * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 11, 6)) + +import { "" as valueZ } from "./arbitraryModuleNamespaceIdentifiers_module"; +>valueZ : Symbol(valueZ, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 12, 8)) + +if (valueZ[""] !== "someValue") throw "should be someValue"; +>valueZ : Symbol(valueZ, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 12, 8)) +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 3, 8)) + +if (valueZ[""] !== "someValue") throw "should be someValue"; +>valueZ : Symbol(valueZ, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 12, 8)) +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 7, 8)) + +if (valueZ[""] !== valueZ) throw "should be export namespace"; +>valueZ : Symbol(valueZ, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 12, 8)) +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 11, 6)) +>valueZ : Symbol(valueZ, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 12, 8)) + +export { type someType as "" }; +>someType : Symbol(someType, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 0, 30)) +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 17, 8)) + +import { type "" as typeA } from "./arbitraryModuleNamespaceIdentifiers_module"; +>typeA : Symbol(typeA, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 18, 8)) + +const importTest: typeA = "expect error about someType"; +>importTest : Symbol(importTest, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 19, 5)) +>typeA : Symbol(typeA, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 18, 8)) + +export { type "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 21, 8)) + +import { type "" as typeB } from "./arbitraryModuleNamespaceIdentifiers_module"; +>typeB : Symbol(typeB, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 22, 8)) + +const reimportTest: typeB = "expect error about someType"; +>reimportTest : Symbol(reimportTest, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 23, 5)) +>typeB : Symbol(typeB, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 22, 8)) + +export type * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : Symbol(valueZ[""], Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 25, 11)) + +import { type "" as typeC } from "./arbitraryModuleNamespaceIdentifiers_module"; +>typeC : Symbol(typeC, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 26, 8)) + +export type otherType = "otherType"; +>otherType : Symbol(valueZ.otherType, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 26, 83)) + +const importStarTestA: typeC.otherType = "expect error about otherType"; +>importStarTestA : Symbol(importStarTestA, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 28, 5)) +>typeC : Symbol(typeC, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 26, 8)) +>otherType : Symbol(valueZ.otherType, Decl(arbitraryModuleNamespaceIdentifiers_module.ts, 26, 83)) + diff --git a/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).types b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).types new file mode 100644 index 0000000000000..4574f9754d0b4 --- /dev/null +++ b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).types @@ -0,0 +1,151 @@ +//// [tests/cases/conformance/es2022/arbitraryModuleNamespaceIdentifiers/arbitraryModuleNamespaceIdentifiers_module.ts] //// + +=== arbitraryModuleNamespaceIdentifiers_module.ts === +const someValue = "someValue"; +>someValue : "someValue" +> : ^^^^^^^^^^^ +>"someValue" : "someValue" +> : ^^^^^^^^^^^ + +type someType = "someType"; +>someType : "someType" +> : ^^^^^^^^^^ + +export { someValue as "" }; +>someValue : "someValue" +> : ^^^^^^^^^^^ +>"" : "someValue" +> : ^^^^^^^^^^^ + +import { "" as valueX } from "./arbitraryModuleNamespaceIdentifiers_module"; +>valueX : "someValue" +> : ^^^^^^^^^^^ + +if (valueX !== "someValue") throw "should be someValue"; +>valueX !== "someValue" : boolean +> : ^^^^^^^ +>valueX : "someValue" +> : ^^^^^^^^^^^ +>"someValue" : "someValue" +> : ^^^^^^^^^^^ +>"should be someValue" : "should be someValue" +> : ^^^^^^^^^^^^^^^^^^^^^ + +export { "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : "someValue" +> : ^^^^^^^^^^^ + +import { "" as valueY } from "./arbitraryModuleNamespaceIdentifiers_module"; +>valueY : "someValue" +> : ^^^^^^^^^^^ + +if (valueY !== "someValue") throw "should be someValue"; +>valueY !== "someValue" : boolean +> : ^^^^^^^ +>valueY : "someValue" +> : ^^^^^^^^^^^ +>"someValue" : "someValue" +> : ^^^^^^^^^^^ +>"should be someValue" : "should be someValue" +> : ^^^^^^^^^^^^^^^^^^^^^ + +export * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : typeof valueZ +> : ^^^^^^^^^^^^^ + +import { "" as valueZ } from "./arbitraryModuleNamespaceIdentifiers_module"; +>valueZ : typeof valueZ +> : ^^^^^^^^^^^^^ + +if (valueZ[""] !== "someValue") throw "should be someValue"; +>valueZ[""] !== "someValue" : boolean +> : ^^^^^^^ +>valueZ[""] : "someValue" +> : ^^^^^^^^^^^ +>valueZ : typeof valueZ +> : ^^^^^^^^^^^^^ +>"" : "" +> : ^^^^^ +>"someValue" : "someValue" +> : ^^^^^^^^^^^ +>"should be someValue" : "should be someValue" +> : ^^^^^^^^^^^^^^^^^^^^^ + +if (valueZ[""] !== "someValue") throw "should be someValue"; +>valueZ[""] !== "someValue" : boolean +> : ^^^^^^^ +>valueZ[""] : "someValue" +> : ^^^^^^^^^^^ +>valueZ : typeof valueZ +> : ^^^^^^^^^^^^^ +>"" : "" +> : ^^^^^ +>"someValue" : "someValue" +> : ^^^^^^^^^^^ +>"should be someValue" : "should be someValue" +> : ^^^^^^^^^^^^^^^^^^^^^ + +if (valueZ[""] !== valueZ) throw "should be export namespace"; +>valueZ[""] !== valueZ : boolean +> : ^^^^^^^ +>valueZ[""] : typeof valueZ +> : ^^^^^^^^^^^^^ +>valueZ : typeof valueZ +> : ^^^^^^^^^^^^^ +>"" : "" +> : ^^^^^ +>valueZ : typeof valueZ +> : ^^^^^^^^^^^^^ +>"should be export namespace" : "should be export namespace" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +export { type someType as "" }; +>someType : any +> : ^^^ +>"" : any +> : ^^^ + +import { type "" as typeA } from "./arbitraryModuleNamespaceIdentifiers_module"; +>typeA : any +> : ^^^ + +const importTest: typeA = "expect error about someType"; +>importTest : "someType" +> : ^^^^^^^^^^ +>"expect error about someType" : "expect error about someType" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +export { type "" as "" } from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : any +> : ^^^ + +import { type "" as typeB } from "./arbitraryModuleNamespaceIdentifiers_module"; +>typeB : any +> : ^^^ + +const reimportTest: typeB = "expect error about someType"; +>reimportTest : "someType" +> : ^^^^^^^^^^ +>"expect error about someType" : "expect error about someType" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +export type * as "" from "./arbitraryModuleNamespaceIdentifiers_module"; +>"" : typeof valueZ +> : ^^^^^^^^^^^^^ + +import { type "" as typeC } from "./arbitraryModuleNamespaceIdentifiers_module"; +>typeC : typeof valueZ +> : ^^^^^^^^^^^^^ + +export type otherType = "otherType"; +>otherType : "otherType" +> : ^^^^^^^^^^^ + +const importStarTestA: typeC.otherType = "expect error about otherType"; +>importStarTestA : "otherType" +> : ^^^^^^^^^^^ +>typeC : any +> : ^^^ +>"expect error about otherType" : "expect error about otherType" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt index 03d2b46a32010..4251652ef5f45 100644 --- a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt +++ b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt @@ -12,8 +12,8 @@ awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await' loops are only allow awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules. awaitInNonAsyncFunction.ts(34,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules. awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules. -awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitInNonAsyncFunction.ts(39,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. +awaitInNonAsyncFunction.ts(40,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. ==== awaitInNonAsyncFunction.ts (16 errors) ==== @@ -97,7 +97,7 @@ awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions ar for await (const _ of []); ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. await null; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. \ No newline at end of file +!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/awaitUsingDeclarations.1(target=es2015).errors.txt b/tests/baselines/reference/awaitUsingDeclarations.1(target=es2015).errors.txt index 0ff7a8868b0a8..a6f82cf69ebdf 100644 --- a/tests/baselines/reference/awaitUsingDeclarations.1(target=es2015).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarations.1(target=es2015).errors.txt @@ -1,24 +1,24 @@ -awaitUsingDeclarations.1.ts(1,1): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(36,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(41,9): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(45,9): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(52,13): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(57,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(60,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(63,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(67,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(70,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(74,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(79,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(85,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(90,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarations.1.ts(1,1): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(36,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(41,9): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(45,9): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(52,13): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(57,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(60,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(63,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(67,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(70,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(74,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(79,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(85,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(90,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' statements 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. ==== awaitUsingDeclarations.1.ts (15 errors) ==== await using d1 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. async function af() { await using d3 = { async [Symbol.asyncDispose]() {} }; @@ -55,20 +55,20 @@ awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' stateme { await using d19 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } switch (Math.random()) { case 0: await using d20 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; case 1: await using d21 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } @@ -77,48 +77,48 @@ awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' stateme case 0: await using d22 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } try { await using d23 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } catch { await using d24 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } finally { await using d25 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } if (true) { await using d26 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } else { await using d27 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } while (true) { await using d28 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } do { await using d29 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } while (true); @@ -126,20 +126,20 @@ awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' stateme for (;;) { await using d30 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } for (const x in {}) { await using d31 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } for (const x of []) { await using d32 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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 {}; \ No newline at end of file diff --git a/tests/baselines/reference/awaitUsingDeclarations.1(target=es5).errors.txt b/tests/baselines/reference/awaitUsingDeclarations.1(target=es5).errors.txt index 0ff7a8868b0a8..a6f82cf69ebdf 100644 --- a/tests/baselines/reference/awaitUsingDeclarations.1(target=es5).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarations.1(target=es5).errors.txt @@ -1,24 +1,24 @@ -awaitUsingDeclarations.1.ts(1,1): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(36,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(41,9): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(45,9): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(52,13): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(57,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(60,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(63,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(67,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(70,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(74,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(79,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(85,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(90,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarations.1.ts(1,1): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(36,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(41,9): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(45,9): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(52,13): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(57,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(60,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(63,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(67,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(70,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(74,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(79,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(85,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(90,5): error TS2854: Top-level 'await using' statements 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. +awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' statements 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. ==== awaitUsingDeclarations.1.ts (15 errors) ==== await using d1 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. async function af() { await using d3 = { async [Symbol.asyncDispose]() {} }; @@ -55,20 +55,20 @@ awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' stateme { await using d19 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } switch (Math.random()) { case 0: await using d20 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; case 1: await using d21 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } @@ -77,48 +77,48 @@ awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' stateme case 0: await using d22 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } try { await using d23 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } catch { await using d24 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } finally { await using d25 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } if (true) { await using d26 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } else { await using d27 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } while (true) { await using d28 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } do { await using d29 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } while (true); @@ -126,20 +126,20 @@ awaitUsingDeclarations.1.ts(94,5): error TS2854: Top-level 'await using' stateme for (;;) { await using d30 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. break; } for (const x in {}) { await using d31 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. } for (const x of []) { await using d32 = { async [Symbol.asyncDispose]() {} }; ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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 {}; \ No newline at end of file diff --git a/tests/baselines/reference/awaitUsingDeclarations.2(target=es2015).errors.txt b/tests/baselines/reference/awaitUsingDeclarations.2(target=es2015).errors.txt index b04ba9319bdd8..4eccfeffa6114 100644 --- a/tests/baselines/reference/awaitUsingDeclarations.2(target=es2015).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarations.2(target=es2015).errors.txt @@ -1,11 +1,11 @@ -awaitUsingDeclarations.2.ts(2,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarations.2.ts(2,5): error TS2854: Top-level 'await using' statements 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. ==== awaitUsingDeclarations.2.ts (1 errors) ==== { await using d1 = { async [Symbol.asyncDispose]() {} }, ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. d2 = { async [Symbol.asyncDispose]() {} }; } diff --git a/tests/baselines/reference/awaitUsingDeclarations.2(target=es5).errors.txt b/tests/baselines/reference/awaitUsingDeclarations.2(target=es5).errors.txt index b04ba9319bdd8..4eccfeffa6114 100644 --- a/tests/baselines/reference/awaitUsingDeclarations.2(target=es5).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarations.2(target=es5).errors.txt @@ -1,11 +1,11 @@ -awaitUsingDeclarations.2.ts(2,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarations.2.ts(2,5): error TS2854: Top-level 'await using' statements 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. ==== awaitUsingDeclarations.2.ts (1 errors) ==== { await using d1 = { async [Symbol.asyncDispose]() {} }, ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. d2 = { async [Symbol.asyncDispose]() {} }; } diff --git a/tests/baselines/reference/awaitUsingDeclarations.3(target=es2015).errors.txt b/tests/baselines/reference/awaitUsingDeclarations.3(target=es2015).errors.txt index 812d27fbe1adb..905017a52154a 100644 --- a/tests/baselines/reference/awaitUsingDeclarations.3(target=es2015).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarations.3(target=es2015).errors.txt @@ -1,11 +1,11 @@ -awaitUsingDeclarations.3.ts(2,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarations.3.ts(2,5): error TS2854: Top-level 'await using' statements 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. ==== awaitUsingDeclarations.3.ts (1 errors) ==== { await using d1 = { async [Symbol.asyncDispose]() {} }, ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. d2 = null, d3 = undefined, d4 = { [Symbol.dispose]() {} }; diff --git a/tests/baselines/reference/awaitUsingDeclarations.3(target=es5).errors.txt b/tests/baselines/reference/awaitUsingDeclarations.3(target=es5).errors.txt index 812d27fbe1adb..905017a52154a 100644 --- a/tests/baselines/reference/awaitUsingDeclarations.3(target=es5).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarations.3(target=es5).errors.txt @@ -1,11 +1,11 @@ -awaitUsingDeclarations.3.ts(2,5): error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarations.3.ts(2,5): error TS2854: Top-level 'await using' statements 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. ==== awaitUsingDeclarations.3.ts (1 errors) ==== { await using d1 = { async [Symbol.asyncDispose]() {} }, ~~~~~ -!!! error TS2854: Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS2854: Top-level 'await using' statements 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. d2 = null, d3 = undefined, d4 = { [Symbol.dispose]() {} }; diff --git a/tests/baselines/reference/awaitUsingDeclarationsInForAwaitOf.3(target=es5).errors.txt b/tests/baselines/reference/awaitUsingDeclarationsInForAwaitOf.3(target=es5).errors.txt index 72a09855d0899..8a3ba085e5d13 100644 --- a/tests/baselines/reference/awaitUsingDeclarationsInForAwaitOf.3(target=es5).errors.txt +++ b/tests/baselines/reference/awaitUsingDeclarationsInForAwaitOf.3(target=es5).errors.txt @@ -1,4 +1,4 @@ -awaitUsingDeclarationsInForAwaitOf.3.ts(5,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +awaitUsingDeclarationsInForAwaitOf.3.ts(5,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. awaitUsingDeclarationsInForAwaitOf.3.ts(5,23): error TS1123: Variable declaration list cannot be empty. awaitUsingDeclarationsInForAwaitOf.3.ts(8,25): error TS1123: Variable declaration list cannot be empty. @@ -10,7 +10,7 @@ awaitUsingDeclarationsInForAwaitOf.3.ts(8,25): error TS1123: Variable declaratio for await (await using of x); ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. !!! error TS1123: Variable declaration list cannot be empty. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --module.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --module.js index 1b39c0ab91dd9..a17a607373765 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --module.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --module.js @@ -7,4 +7,4 @@ FileNames:: 0.ts Errors:: error TS6044: Compiler option 'module' expects an argument. -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with json api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with json api.js index 13680f74379e6..1bb683ffbb17b 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with json api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with json api.js @@ -25,5 +25,5 @@ CompilerOptions:: "configFilePath": "/apath/tsconfig.json" } Errors:: -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. diff --git a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with jsonSourceFile api.js b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with jsonSourceFile api.js index e687f319a7b13..bcf6c6562370a 100644 --- a/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/convertCompilerOptionsFromJson/Convert incorrect option of module to compiler-options with jsonSourceFile api.js @@ -25,7 +25,7 @@ CompilerOptions:: "configFilePath": "/apath/tsconfig.json" } Errors:: -tsconfig.json:3:15 - error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +tsconfig.json:3:15 - error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. 3 "module": "",    ~~ diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt new file mode 100644 index 0000000000000..386cac3eec940 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt @@ -0,0 +1,12 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== a.ts (0 errors) ==== + declare var dec: any, __decorate: any; + @dec export class A { + } + + const o = { a: 1 }; + const y = { ...o }; + \ No newline at end of file diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js new file mode 100644 index 0000000000000..2bf5641f43b50 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/emitHelpersWithLocalCollisions.ts] //// + +//// [a.ts] +declare var dec: any, __decorate: any; +@dec export class A { +} + +const o = { a: 1 }; +const y = { ...o }; + + +//// [a.js] +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +let A = class A { +}; +exports.A = A; +exports.A = A = __decorate([ + dec +], A); +const o = { a: 1 }; +const y = Object.assign({}, o); diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index 60c1ebb002d2b..f68327654fdf1 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -1,16 +1,16 @@ -1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. 3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments -3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. 3.ts(10,52): error TS1009: Trailing comma not allowed. @@ -21,13 +21,13 @@ ==== 1.ts (3 errors) ==== import './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a, b } from './0' assert { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import * as foo from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; foo.a; @@ -36,10 +36,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' assert {} ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; c; @@ -49,29 +49,29 @@ const a = import('./0') const b = import('./0', { assert: { type: "json" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const c = import('./0', { assert: { type: "json", ttype: "typo" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const d = import('./0', { assert: {} }) ~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const dd = import('./0', {}) ~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. declare function foo(): any; const e = import('./0', foo()) ~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const f = import() ~~~~~~~~ !!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const g = import('./0', {}, {}) ~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const h = import('./0', { assert: { type: "json" }},) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ~ !!! error TS1009: Trailing comma not allowed. diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index 90dc6fb333c80..12ad1bcdf3f19 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -1,17 +1,17 @@ -1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ==== 0.ts (0 errors) ==== @@ -21,13 +21,13 @@ ==== 1.ts (3 errors) ==== import './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a, b } from './0' assert { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import * as foo from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; foo.a; @@ -36,10 +36,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' assert {} ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; c; @@ -48,31 +48,31 @@ ==== 3.ts (9 errors) ==== const a = import('./0') ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const b = import('./0', { assert: { type: "json" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const c = import('./0', { assert: { type: "json", ttype: "typo" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const d = import('./0', { assert: {} }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const dd = import('./0', {}) ~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. declare function foo(): any; const e = import('./0', foo()) ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const f = import() ~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const g = import('./0', {}, {}) ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const h = import('./0', { assert: { type: "json" }},) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt index beba23ce610d7..a83609d1f2b89 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a, b } from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * as ns from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== export { a, b } from './0' assert {} ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt index beba23ce610d7..a83609d1f2b89 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a, b } from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * as ns from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== export { a, b } from './0' assert {} ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt index dfd16488102fc..5b353cb0b4be4 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt @@ -1,7 +1,7 @@ -1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -10,17 +10,17 @@ ==== 1.ts (2 errors) ==== export type {} from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export type { I } from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== import type { I } from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import type * as foo from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt index 8a9be458977f4..78849639e48e7 100644 --- a/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt @@ -1,16 +1,16 @@ -1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. 3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments -3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. -3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. +3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. 3.ts(10,50): error TS1009: Trailing comma not allowed. @@ -21,13 +21,13 @@ ==== 1.ts (3 errors) ==== import './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a, b } from './0' with { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import * as foo from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; foo.a; @@ -35,10 +35,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' with {} ~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; c; @@ -47,29 +47,29 @@ const a = import('./0') const b = import('./0', { with: { type: "json" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const c = import('./0', { with: { type: "json", ttype: "typo" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const d = import('./0', { with: {} }) ~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const dd = import('./0', {}) ~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. declare function foo(): any; const e = import('./0', foo()) ~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const f = import() ~~~~~~~~ !!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const g = import('./0', {}, {}) ~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. const h = import('./0', { with: { type: "json" }},) ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ~ !!! error TS1009: Trailing comma not allowed. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt index 960f52554339b..31ef819879c67 100644 --- a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt @@ -1,17 +1,17 @@ -1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ==== 0.ts (0 errors) ==== @@ -21,13 +21,13 @@ ==== 1.ts (3 errors) ==== import './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a, b } from './0' with { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import * as foo from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; foo.a; @@ -35,10 +35,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' with {} ~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. a; b; c; @@ -46,30 +46,30 @@ ==== 3.ts (9 errors) ==== const a = import('./0') ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const b = import('./0', { with: { type: "json" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const c = import('./0', { with: { type: "json", ttype: "typo" } }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const d = import('./0', { with: {} }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const dd = import('./0', {}) ~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. declare function foo(): any; const e = import('./0', foo()) ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const f = import() ~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const g = import('./0', {}, {}) ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. const h = import('./0', { with: { type: "json" }},) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt index 144a6f2779301..fea6b67dc1ec4 100644 --- a/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a, b } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * as ns from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== export { a, b } from './0' with {} ~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes2(module=es2015).errors.txt b/tests/baselines/reference/importAttributes2(module=es2015).errors.txt index 144a6f2779301..fea6b67dc1ec4 100644 --- a/tests/baselines/reference/importAttributes2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes2(module=es2015).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a, b } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export * as ns from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== export { a, b } from './0' with {} ~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes3(module=es2015).errors.txt b/tests/baselines/reference/importAttributes3(module=es2015).errors.txt index 23d166416e0d0..8e0a253a65778 100644 --- a/tests/baselines/reference/importAttributes3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes3(module=es2015).errors.txt @@ -1,7 +1,7 @@ -1.ts(1,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.ts(2,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(1,31): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -2.ts(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.ts(1,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.ts(2,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(1,31): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +2.ts(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -10,16 +10,16 @@ ==== 1.ts (2 errors) ==== export type {} from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export type { I } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== import type { I } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import type * as foo from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt b/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt index e0d7de71867c0..fd15d2d1dbd06 100644 --- a/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt +++ b/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt @@ -1,6 +1,6 @@ -1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ==== 0.ts (0 errors) ==== @@ -9,10 +9,10 @@ ==== 1.ts (3 errors) ==== import("./0"); ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. var p1 = import("./0"); ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. p1.then(zero => { return zero.foo(); }) @@ -20,5 +20,5 @@ function foo() { const p2 = import("./0"); ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. } \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionGrammarError.errors.txt b/tests/baselines/reference/importCallExpressionGrammarError.errors.txt index d8424c5423e0f..c055c26a5f610 100644 --- a/tests/baselines/reference/importCallExpressionGrammarError.errors.txt +++ b/tests/baselines/reference/importCallExpressionGrammarError.errors.txt @@ -2,7 +2,7 @@ importCallExpressionGrammarError.ts(5,8): error TS1325: Argument of dynamic impo importCallExpressionGrammarError.ts(7,17): error TS1325: Argument of dynamic import cannot be spread element. importCallExpressionGrammarError.ts(8,12): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments importCallExpressionGrammarError.ts(9,19): error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations. -importCallExpressionGrammarError.ts(9,35): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +importCallExpressionGrammarError.ts(9,35): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. importCallExpressionGrammarError.ts(9,35): error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'. @@ -25,6 +25,6 @@ importCallExpressionGrammarError.ts(9,35): error TS2559: Type '"secondModule"' h ~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations. ~~~~~~~~~~~~~~ -!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'. +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'. ~~~~~~~~~~~~~~ !!! error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'. \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt b/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt index 458e709578df5..8e2c1556da376 100644 --- a/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt +++ b/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt @@ -1,5 +1,5 @@ -index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ==== foo.ts (0 errors) ==== @@ -9,7 +9,7 @@ index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--mod async function foo() { return await import((await import("./foo")).default); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. } \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt b/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt index 458e709578df5..8e2c1556da376 100644 --- a/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt +++ b/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt @@ -1,5 +1,5 @@ -index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. -index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. +index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ==== foo.ts (0 errors) ==== @@ -9,7 +9,7 @@ index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--mod async function foo() { return await import((await import("./foo")).default); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. ~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'. } \ No newline at end of file diff --git a/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt b/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt index 4be6e8a4823e8..360e04abf29ab 100644 --- a/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt +++ b/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt @@ -1,25 +1,25 @@ error TS2468: Cannot find global value 'Promise'. -assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'. -assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'. -assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. example.ts(2,2): 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. -example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. -moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? @@ -31,12 +31,12 @@ scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-proper !!! 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 response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~~~~~~~~ !!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. @@ -50,48 +50,48 @@ scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-proper ==== moduleLookingFile01.ts (5 errors) ==== export let x = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. export let y = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? export let z = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== scriptLookingFile01.ts (5 errors) ==== let globalA = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. let globalB = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? let globalC = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== assignmentTargets.ts (8 errors) ==== export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. import.meta = foo; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -104,4 +104,4 @@ scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-proper const { a, b, c } = import.meta.wellKnownProperty; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. \ No newline at end of file +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt b/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt index 4be6e8a4823e8..360e04abf29ab 100644 --- a/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt +++ b/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt @@ -1,25 +1,25 @@ error TS2468: Cannot find global value 'Promise'. -assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'. -assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'. -assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. example.ts(2,2): 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. -example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. -moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. -scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. +scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? @@ -31,12 +31,12 @@ scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-proper !!! 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 response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~~~~~~~~ !!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. @@ -50,48 +50,48 @@ scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-proper ==== moduleLookingFile01.ts (5 errors) ==== export let x = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. export let y = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? export let z = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== scriptLookingFile01.ts (5 errors) ==== let globalA = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. let globalB = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? let globalC = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== assignmentTargets.ts (8 errors) ==== export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. import.meta = foo; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. ~~~~~~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -104,4 +104,4 @@ scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-proper const { a, b, c } = import.meta.wellKnownProperty; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'. \ No newline at end of file +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importTag14.errors.txt b/tests/baselines/reference/importTag14.errors.txt index 20360234a4bfb..9969d70670899 100644 --- a/tests/baselines/reference/importTag14.errors.txt +++ b/tests/baselines/reference/importTag14.errors.txt @@ -1,5 +1,5 @@ /foo.js(1,33): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. -/foo.js(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/foo.js(1,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /foo.js(1,38): error TS1005: '{' expected. @@ -8,7 +8,7 @@ ~~~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. !!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/importTag15(module=es2015).errors.txt b/tests/baselines/reference/importTag15(module=es2015).errors.txt index e3dba21b47669..45e47c28ad649 100644 --- a/tests/baselines/reference/importTag15(module=es2015).errors.txt +++ b/tests/baselines/reference/importTag15(module=es2015).errors.txt @@ -1,5 +1,5 @@ -1.js(1,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -1.js(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +1.js(1,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +1.js(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -8,10 +8,10 @@ ==== 1.js (2 errors) ==== /** @import { I } from './0' with { type: "json" } */ ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /** @import * as foo from './0' with { type: "json" } */ ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /** @param {I} a */ function f(a) {} diff --git a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt new file mode 100644 index 0000000000000..5be321ec2b3a1 --- /dev/null +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt @@ -0,0 +1,66 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== mod.cts (0 errors) ==== + declare function fun(): void; + export default fun; +==== b.mts (6 errors) ==== + import a from "./mod.cjs"; + import { default as b } from "./mod.cjs"; + import c, { default as d } from "./mod.cjs"; + import * as self from "./b.mjs"; + export { default } from "./mod.cjs"; + export { default as def } from "./mod.cjs"; + + a === b; + b === c; + c === d; + d === self.default; + self.default === self.def; + + // 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(); + b.default(); + c.default(); + d.default(); + self.default.default(); + self.def.default(); \ No newline at end of file diff --git a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js new file mode 100644 index 0000000000000..c3a488cf11aee --- /dev/null +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js @@ -0,0 +1,70 @@ +//// [tests/cases/compiler/moduleNodeDefaultImports.ts] //// + +//// [mod.cts] +declare function fun(): void; +export default fun; +//// [b.mts] +import a from "./mod.cjs"; +import { default as b } from "./mod.cjs"; +import c, { default as d } from "./mod.cjs"; +import * as self from "./b.mjs"; +export { default } from "./mod.cjs"; +export { default as def } from "./mod.cjs"; + +a === b; +b === c; +c === d; +d === self.default; +self.default === self.def; + +// should all fail +a(); +b(); +c(); +d(); +self.default(); +self.def(); + +// should all work +a.default(); +b.default(); +c.default(); +d.default(); +self.default.default(); +self.def.default(); + +//// [mod.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = fun; +//// [b.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.def = exports.default = void 0; +const mod_cjs_1 = require("./mod.cjs"); +const mod_cjs_2 = require("./mod.cjs"); +const mod_cjs_3 = require("./mod.cjs"); +const self = require("./b.mjs"); +var mod_cjs_4 = require("./mod.cjs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mod_cjs_4.default; } }); +var mod_cjs_5 = require("./mod.cjs"); +Object.defineProperty(exports, "def", { enumerable: true, get: function () { return mod_cjs_5.default; } }); +mod_cjs_1.default === mod_cjs_2.default; +mod_cjs_2.default === mod_cjs_3.default; +mod_cjs_3.default === mod_cjs_3.default; +mod_cjs_3.default === self.default; +self.default === self.def; +// should all fail +(0, mod_cjs_1.default)(); +(0, mod_cjs_2.default)(); +(0, mod_cjs_3.default)(); +(0, mod_cjs_3.default)(); +self.default(); +self.def(); +// should all work +mod_cjs_1.default.default(); +mod_cjs_2.default.default(); +mod_cjs_3.default.default(); +mod_cjs_3.default.default(); +self.default.default(); +self.def.default(); diff --git a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).symbols b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).symbols new file mode 100644 index 0000000000000..8c292112c561f --- /dev/null +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).symbols @@ -0,0 +1,116 @@ +//// [tests/cases/compiler/moduleNodeDefaultImports.ts] //// + +=== mod.cts === +declare function fun(): void; +>fun : Symbol(fun, Decl(mod.cts, 0, 0)) + +export default fun; +>fun : Symbol(fun, Decl(mod.cts, 0, 0)) + +=== b.mts === +import a from "./mod.cjs"; +>a : Symbol(a, Decl(b.mts, 0, 6)) + +import { default as b } from "./mod.cjs"; +>default : Symbol(a, 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)) +>d : Symbol(d, Decl(b.mts, 2, 11)) + +import * as self from "./b.mjs"; +>self : Symbol(self, Decl(b.mts, 3, 6)) + +export { default } from "./mod.cjs"; +>default : Symbol(self.default, Decl(b.mts, 4, 8)) + +export { default as def } from "./mod.cjs"; +>default : Symbol(a, Decl(mod.cts, 0, 0)) +>def : Symbol(self.def, Decl(b.mts, 5, 8)) + +a === b; +>a : Symbol(a, Decl(b.mts, 0, 6)) +>b : Symbol(b, Decl(b.mts, 1, 8)) + +b === c; +>b : Symbol(b, Decl(b.mts, 1, 8)) +>c : Symbol(c, Decl(b.mts, 2, 6)) + +c === d; +>c : Symbol(c, Decl(b.mts, 2, 6)) +>d : Symbol(d, Decl(b.mts, 2, 11)) + +d === self.default; +>d : Symbol(d, Decl(b.mts, 2, 11)) +>self.default : Symbol(self.default, Decl(b.mts, 4, 8)) +>self : Symbol(self, Decl(b.mts, 3, 6)) +>default : Symbol(self.default, Decl(b.mts, 4, 8)) + +self.default === self.def; +>self.default : Symbol(self.default, Decl(b.mts, 4, 8)) +>self : Symbol(self, Decl(b.mts, 3, 6)) +>default : Symbol(self.default, Decl(b.mts, 4, 8)) +>self.def : Symbol(self.def, Decl(b.mts, 5, 8)) +>self : Symbol(self, Decl(b.mts, 3, 6)) +>def : Symbol(self.def, Decl(b.mts, 5, 8)) + +// should all fail +a(); +>a : Symbol(a, Decl(b.mts, 0, 6)) + +b(); +>b : Symbol(b, Decl(b.mts, 1, 8)) + +c(); +>c : Symbol(c, Decl(b.mts, 2, 6)) + +d(); +>d : Symbol(d, Decl(b.mts, 2, 11)) + +self.default(); +>self.default : Symbol(self.default, Decl(b.mts, 4, 8)) +>self : Symbol(self, Decl(b.mts, 3, 6)) +>default : Symbol(self.default, Decl(b.mts, 4, 8)) + +self.def(); +>self.def : Symbol(self.def, Decl(b.mts, 5, 8)) +>self : Symbol(self, Decl(b.mts, 3, 6)) +>def : Symbol(self.def, Decl(b.mts, 5, 8)) + +// should all work +a.default(); +>a.default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>a : Symbol(a, Decl(b.mts, 0, 6)) +>default : Symbol(a.default, Decl(mod.cts, 0, 29)) + +b.default(); +>b.default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>b : Symbol(b, Decl(b.mts, 1, 8)) +>default : Symbol(a.default, Decl(mod.cts, 0, 29)) + +c.default(); +>c.default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>c : Symbol(c, Decl(b.mts, 2, 6)) +>default : Symbol(a.default, Decl(mod.cts, 0, 29)) + +d.default(); +>d.default : Symbol(a.default, Decl(mod.cts, 0, 29)) +>d : Symbol(d, Decl(b.mts, 2, 11)) +>default : Symbol(a.default, 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 : 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)) + +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 : 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)) + diff --git a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).types b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).types new file mode 100644 index 0000000000000..84b8ccc87d275 --- /dev/null +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).types @@ -0,0 +1,210 @@ +//// [tests/cases/compiler/moduleNodeDefaultImports.ts] //// + +=== mod.cts === +declare function fun(): void; +>fun : () => void +> : ^^^^^^ + +export default fun; +>fun : () => void +> : ^^^^^^ + +=== b.mts === +import a from "./mod.cjs"; +>a : typeof a +> : ^^^^^^^^ + +import { default as b } from "./mod.cjs"; +>default : typeof a +> : ^^^^^^^^ +>b : typeof a +> : ^^^^^^^^ + +import c, { default as d } from "./mod.cjs"; +>c : typeof a +> : ^^^^^^^^ +>default : typeof a +> : ^^^^^^^^ +>d : typeof a +> : ^^^^^^^^ + +import * as self from "./b.mjs"; +>self : typeof self +> : ^^^^^^^^^^^ + +export { default } from "./mod.cjs"; +>default : typeof a +> : ^^^^^^^^ + +export { default as def } from "./mod.cjs"; +>default : typeof a +> : ^^^^^^^^ +>def : typeof a +> : ^^^^^^^^ + +a === b; +>a === b : boolean +> : ^^^^^^^ +>a : typeof a +> : ^^^^^^^^ +>b : typeof a +> : ^^^^^^^^ + +b === c; +>b === c : boolean +> : ^^^^^^^ +>b : typeof a +> : ^^^^^^^^ +>c : typeof a +> : ^^^^^^^^ + +c === d; +>c === d : boolean +> : ^^^^^^^ +>c : typeof a +> : ^^^^^^^^ +>d : typeof a +> : ^^^^^^^^ + +d === self.default; +>d === self.default : boolean +> : ^^^^^^^ +>d : typeof a +> : ^^^^^^^^ +>self.default : typeof a +> : ^^^^^^^^ +>self : typeof self +> : ^^^^^^^^^^^ +>default : typeof a +> : ^^^^^^^^ + +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 +> : ^^^^^^^^ + +// should all fail +a(); +>a() : any +> : ^^^ +>a : typeof a +> : ^^^^^^^^ + +b(); +>b() : any +> : ^^^ +>b : typeof a +> : ^^^^^^^^ + +c(); +>c() : any +> : ^^^ +>c : typeof a +> : ^^^^^^^^ + +d(); +>d() : any +> : ^^^ +>d : typeof a +> : ^^^^^^^^ + +self.default(); +>self.default() : any +> : ^^^ +>self.default : typeof a +> : ^^^^^^^^ +>self : typeof self +> : ^^^^^^^^^^^ +>default : typeof a +> : ^^^^^^^^ + +self.def(); +>self.def() : any +> : ^^^ +>self.def : typeof a +> : ^^^^^^^^ +>self : typeof self +> : ^^^^^^^^^^^ +>def : typeof a +> : ^^^^^^^^ + +// should all work +a.default(); +>a.default() : void +> : ^^^^ +>a.default : () => void +> : ^^^^^^ +>a : typeof a +> : ^^^^^^^^ +>default : () => void +> : ^^^^^^ + +b.default(); +>b.default() : void +> : ^^^^ +>b.default : () => void +> : ^^^^^^ +>b : typeof a +> : ^^^^^^^^ +>default : () => void +> : ^^^^^^ + +c.default(); +>c.default() : void +> : ^^^^ +>c.default : () => void +> : ^^^^^^ +>c : typeof a +> : ^^^^^^^^ +>default : () => void +> : ^^^^^^ + +d.default(); +>d.default() : void +> : ^^^^ +>d.default : () => void +> : ^^^^^^ +>d : typeof a +> : ^^^^^^^^ +>default : () => void +> : ^^^^^^ + +self.default.default(); +>self.default.default() : void +> : ^^^^ +>self.default.default : () => void +> : ^^^^^^ +>self.default : typeof a +> : ^^^^^^^^ +>self : typeof self +> : ^^^^^^^^^^^ +>default : typeof a +> : ^^^^^^^^ +>default : () => void +> : ^^^^^^ + +self.def.default(); +>self.def.default() : void +> : ^^^^ +>self.def.default : () => void +> : ^^^^^^ +>self.def : typeof a +> : ^^^^^^^^ +>self : typeof self +> : ^^^^^^^^^^^ +>def : typeof a +> : ^^^^^^^^ +>default : () => void +> : ^^^^^^ + diff --git a/tests/baselines/reference/modulePreserveTopLevelAwait1(target=es2016).errors.txt b/tests/baselines/reference/modulePreserveTopLevelAwait1(target=es2016).errors.txt index 2e1dbfa53b9c9..8aa6718972b94 100644 --- a/tests/baselines/reference/modulePreserveTopLevelAwait1(target=es2016).errors.txt +++ b/tests/baselines/reference/modulePreserveTopLevelAwait1(target=es2016).errors.txt @@ -1,14 +1,14 @@ -modulePreserveTopLevelAwait1.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -modulePreserveTopLevelAwait1.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +modulePreserveTopLevelAwait1.ts(1,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. +modulePreserveTopLevelAwait1.ts(2,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. ==== modulePreserveTopLevelAwait1.ts (2 errors) ==== for await (const x of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. await Promise.resolve(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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 {}; \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js new file mode 100644 index 0000000000000..92b7e88696b42 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/moduleResolutionWithModule.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": "./entrypoint.js" +} +//// [entrypoint.d.ts] +export declare function thing(): void; +//// [index.ts] +import * as p from "pkg"; +p.thing(); + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const p = require("pkg"); +p.thing(); diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).symbols b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).symbols new file mode 100644 index 0000000000000..7233a43c05fff --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/moduleResolutionWithModule.ts] //// + +=== node_modules/pkg/entrypoint.d.ts === +export declare function thing(): void; +>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0)) + +=== index.ts === +import * as p from "pkg"; +>p : Symbol(p, Decl(index.ts, 0, 6)) + +p.thing(); +>p.thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0)) +>p : Symbol(p, Decl(index.ts, 0, 6)) +>thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).types b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).types new file mode 100644 index 0000000000000..b65e67d7fe713 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/moduleResolutionWithModule.ts] //// + +=== node_modules/pkg/entrypoint.d.ts === +export declare function thing(): void; +>thing : () => void +> : ^^^^^^ + +=== index.ts === +import * as p from "pkg"; +>p : typeof p +> : ^^^^^^^^ + +p.thing(); +>p.thing() : void +> : ^^^^ +>p.thing : () => void +> : ^^^^^^ +>p : typeof p +> : ^^^^^^^^ +>thing : () => void +> : ^^^^^^ + diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js new file mode 100644 index 0000000000000..92b7e88696b42 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/moduleResolutionWithModule.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": "./entrypoint.js" +} +//// [entrypoint.d.ts] +export declare function thing(): void; +//// [index.ts] +import * as p from "pkg"; +p.thing(); + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const p = require("pkg"); +p.thing(); diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).symbols b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).symbols new file mode 100644 index 0000000000000..7233a43c05fff --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/moduleResolutionWithModule.ts] //// + +=== node_modules/pkg/entrypoint.d.ts === +export declare function thing(): void; +>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0)) + +=== index.ts === +import * as p from "pkg"; +>p : Symbol(p, Decl(index.ts, 0, 6)) + +p.thing(); +>p.thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0)) +>p : Symbol(p, Decl(index.ts, 0, 6)) +>thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).types b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).types new file mode 100644 index 0000000000000..b65e67d7fe713 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/moduleResolutionWithModule.ts] //// + +=== node_modules/pkg/entrypoint.d.ts === +export declare function thing(): void; +>thing : () => void +> : ^^^^^^ + +=== index.ts === +import * as p from "pkg"; +>p : typeof p +> : ^^^^^^^^ + +p.thing(); +>p.thing() : void +> : ^^^^ +>p.thing : () => void +> : ^^^^^^ +>p : typeof p +> : ^^^^^^^^ +>thing : () => void +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt new file mode 100644 index 0000000000000..714e82005ef23 --- /dev/null +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt @@ -0,0 +1,32 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== index.mjs (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== index.cjs (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js new file mode 100644 index 0000000000000..b7f552a39e545 --- /dev/null +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts] //// + +//// [index.js] +// esm format file +import * as self from "package"; +self; +//// [index.mjs] +// esm format file +import * as self from "package"; +self; +//// [index.cjs] +// esm format file +import * as self from "package"; +self; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("package"); +self; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("package"); +self; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("package"); +self; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).symbols b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).symbols new file mode 100644 index 0000000000000..5d67f58f34b98 --- /dev/null +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts] //// + +=== index.js === +// esm format file +import * as self from "package"; +>self : Symbol(self, Decl(index.js, 1, 6)) + +self; +>self : Symbol(self, Decl(index.js, 1, 6)) + +=== index.mjs === +// esm format file +import * as self from "package"; +>self : Symbol(self, Decl(index.mjs, 1, 6)) + +self; +>self : Symbol(self, Decl(index.mjs, 1, 6)) + +=== index.cjs === +// esm format file +import * as self from "package"; +>self : Symbol(self, Decl(index.cjs, 1, 6)) + +self; +>self : Symbol(self, Decl(index.cjs, 1, 6)) + diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types new file mode 100644 index 0000000000000..435e86a52159a --- /dev/null +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts] //// + +=== index.js === +// esm format file +import * as self from "package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as self from "package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + +=== index.cjs === +// esm format file +import * as self from "package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModules1(module=node18).errors.txt b/tests/baselines/reference/nodeModules1(module=node18).errors.txt new file mode 100644 index 0000000000000..29851dcc9eb75 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).errors.txt @@ -0,0 +1,512 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(15,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(17,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(18,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(20,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(21,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(23,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(24,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(51,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(53,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(54,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(56,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(57,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(59,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(60,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(75,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(77,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(78,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(80,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(81,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(83,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(84,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(58,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(59,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(58,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(59,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder/index.cts (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder/index.mts (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/index.ts (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder2/index.cts (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder2/index.mts (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/another/index.ts (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/another/index.mts (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/another/index.cts (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== index.mts (21 errors) ==== + import * as m1 from "./index.js"; + import * as m2 from "./index.mjs"; + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + import * as m11 from "./subfolder2/another/index.mjs"; + 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m14 from "./index"; + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m23 from "./subfolder2/another/index"; + void m1; + void m2; + void m3; + void m4; + void m5; + void m6; + void m7; + void m8; + void m9; + void m10; + void m11; + void m12; + void m13; + void m14; + void m15; + void m16; + void m17; + void m18; + void m19; + void m20; + void m21; + void m22; + void m23; + + // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m25 = require("./index"); + import m26 = require("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m28 = require("./subfolder/index"); + import m29 = require("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m31 = require("./subfolder2/index"); + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m34 = require("./subfolder2/another/index"); + void m24; + void m25; + void m26; + void m27; + void m28; + void m29; + void m30; + void m31; + void m32; + void m33; + void m34; + + // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution + const _m35 = import("./"); + ~~~~ +!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m36 = import("./index"); + const _m37 = import("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m38 = import("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m39 = import("./subfolder/index"); + const _m40 = import("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m41 = import("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m42 = import("./subfolder2/index"); + const _m43 = import("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m44 = import("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m45 = import("./subfolder2/another/index"); + + // esm format file + const x = 1; + export {x}; +==== index.cts (21 errors) ==== + // ESM-format imports below should issue errors + import * as m1 from "./index.js"; + import * as m2 from "./index.mjs"; + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + import * as m11 from "./subfolder2/another/index.mjs"; + 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m14 from "./index"; + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m23 from "./subfolder2/another/index"; + void m1; + void m2; + void m3; + void m4; + void m5; + void m6; + void m7; + void m8; + void m9; + void m10; + void m11; + void m12; + void m13; + void m14; + void m15; + void m16; + void m17; + void m18; + void m19; + void m20; + void m21; + void m22; + void m23; + + // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m25 = require("./index"); + import m26 = require("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m28 = require("./subfolder/index"); + import m29 = require("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m31 = require("./subfolder2/index"); + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m34 = require("./subfolder2/another/index"); + void m24; + void m25; + void m26; + void m27; + void m28; + void m29; + void m30; + void m31; + void m32; + void m33; + void m34; + + // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution + const _m35 = import("./"); + ~~~~ +!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m36 = import("./index"); + const _m37 = import("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m38 = import("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m39 = import("./subfolder/index"); + const _m40 = import("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m41 = import("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m42 = import("./subfolder2/index"); + const _m43 = import("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m44 = import("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m45 = import("./subfolder2/another/index"); + // cjs format file + const x = 1; + export {x}; +==== index.ts (21 errors) ==== + import * as m1 from "./index.js"; + import * as m2 from "./index.mjs"; + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + import * as m11 from "./subfolder2/another/index.mjs"; + 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m14 from "./index"; + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m23 from "./subfolder2/another/index"; + void m1; + void m2; + void m3; + void m4; + void m5; + void m6; + void m7; + void m8; + void m9; + void m10; + void m11; + void m12; + void m13; + void m14; + void m15; + void m16; + void m17; + void m18; + void m19; + void m20; + void m21; + void m22; + void m23; + + // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m25 = require("./index"); + import m26 = require("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m28 = require("./subfolder/index"); + import m29 = require("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m31 = require("./subfolder2/index"); + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m34 = require("./subfolder2/another/index"); + void m24; + void m25; + void m26; + void m27; + void m28; + void m29; + void m30; + void m31; + void m32; + void m33; + void m34; + + // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution + const _m35 = import("./"); + ~~~~ +!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m36 = import("./index"); + const _m37 = import("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m38 = import("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m39 = import("./subfolder/index"); + const _m40 = import("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m41 = import("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m42 = import("./subfolder2/index"); + const _m43 = import("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m44 = import("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m45 = import("./subfolder2/another/index"); + // esm format file + const x = 1; + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== subfolder2/package.json (0 errors) ==== + { + } +==== subfolder2/another/package.json (0 errors) ==== + { + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModules1(module=node18).js b/tests/baselines/reference/nodeModules1(module=node18).js new file mode 100644 index 0000000000000..c4d68e41d7081 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).js @@ -0,0 +1,691 @@ +//// [tests/cases/conformance/node/nodeModules1.ts] //// + +//// [index.ts] +// cjs format file +const x = 1; +export {x}; +//// [index.cts] +// cjs format file +const x = 1; +export {x}; +//// [index.mts] +// esm format file +const x = 1; +export {x}; +//// [index.ts] +// cjs format file +const x = 1; +export {x}; +//// [index.cts] +// cjs format file +const x = 1; +export {x}; +//// [index.mts] +// esm format file +const x = 1; +export {x}; +//// [index.ts] +// esm format file +const x = 1; +export {x}; +//// [index.mts] +// esm format file +const x = 1; +export {x}; +//// [index.cts] +// cjs format file +const x = 1; +export {x}; +//// [index.mts] +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; + +// 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("./"); +import m25 = require("./index"); +import m26 = require("./subfolder"); +import m27 = require("./subfolder/"); +import m28 = require("./subfolder/index"); +import m29 = require("./subfolder2"); +import m30 = require("./subfolder2/"); +import m31 = require("./subfolder2/index"); +import m32 = require("./subfolder2/another"); +import m33 = require("./subfolder2/another/"); +import m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); + +// esm format file +const x = 1; +export {x}; +//// [index.cts] +// ESM-format imports below should issue errors +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; + +// 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("./"); +import m25 = require("./index"); +import m26 = require("./subfolder"); +import m27 = require("./subfolder/"); +import m28 = require("./subfolder/index"); +import m29 = require("./subfolder2"); +import m30 = require("./subfolder2/"); +import m31 = require("./subfolder2/index"); +import m32 = require("./subfolder2/another"); +import m33 = require("./subfolder2/another/"); +import m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// cjs format file +const x = 1; +export {x}; +//// [index.ts] +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; + +// 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("./"); +import m25 = require("./index"); +import m26 = require("./subfolder"); +import m27 = require("./subfolder/"); +import m28 = require("./subfolder/index"); +import m29 = require("./subfolder2"); +import m30 = require("./subfolder2/"); +import m31 = require("./subfolder2/index"); +import m32 = require("./subfolder2/another"); +import m33 = require("./subfolder2/another/"); +import m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// esm format file +const x = 1; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [package.json] +{ +} +//// [package.json] +{ + "type": "module" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// ESM-format imports below should issue errors +const m1 = require("./index.js"); +const m2 = require("./index.mjs"); +const m3 = require("./index.cjs"); +const m4 = require("./subfolder/index.js"); +const m5 = require("./subfolder/index.mjs"); +const m6 = require("./subfolder/index.cjs"); +const m7 = require("./subfolder2/index.js"); +const m8 = require("./subfolder2/index.mjs"); +const m9 = require("./subfolder2/index.cjs"); +const m10 = require("./subfolder2/another/index.js"); +const m11 = require("./subfolder2/another/index.mjs"); +const m12 = require("./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) +const m13 = require("./"); +const m14 = require("./index"); +const m15 = require("./subfolder"); +const m16 = require("./subfolder/"); +const m17 = require("./subfolder/index"); +const m18 = require("./subfolder2"); +const m19 = require("./subfolder2/"); +const m20 = require("./subfolder2/index"); +const m21 = require("./subfolder2/another"); +const m22 = require("./subfolder2/another/"); +const m23 = require("./subfolder2/another/index"); +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; +// 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!) +const m24 = require("./"); +const m25 = require("./index"); +const m26 = require("./subfolder"); +const m27 = require("./subfolder/"); +const m28 = require("./subfolder/index"); +const m29 = require("./subfolder2"); +const m30 = require("./subfolder2/"); +const m31 = require("./subfolder2/index"); +const m32 = require("./subfolder2/another"); +const m33 = require("./subfolder2/another/"); +const m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// cjs format file +const x = 1; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +const m1 = require("./index.js"); +const m2 = require("./index.mjs"); +const m3 = require("./index.cjs"); +const m4 = require("./subfolder/index.js"); +const m5 = require("./subfolder/index.mjs"); +const m6 = require("./subfolder/index.cjs"); +const m7 = require("./subfolder2/index.js"); +const m8 = require("./subfolder2/index.mjs"); +const m9 = require("./subfolder2/index.cjs"); +const m10 = require("./subfolder2/another/index.js"); +const m11 = require("./subfolder2/another/index.mjs"); +const m12 = require("./subfolder2/another/index.cjs"); +// The next ones shouldn't all work - esm format files have no index resolution or extension resolution +const m13 = require("./"); +const m14 = require("./index"); +const m15 = require("./subfolder"); +const m16 = require("./subfolder/"); +const m17 = require("./subfolder/index"); +const m18 = require("./subfolder2"); +const m19 = require("./subfolder2/"); +const m20 = require("./subfolder2/index"); +const m21 = require("./subfolder2/another"); +const m22 = require("./subfolder2/another/"); +const m23 = require("./subfolder2/another/index"); +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; +// 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!) +const m24 = require("./"); +const m25 = require("./index"); +const m26 = require("./subfolder"); +const m27 = require("./subfolder/"); +const m28 = require("./subfolder/index"); +const m29 = require("./subfolder2"); +const m30 = require("./subfolder2/"); +const m31 = require("./subfolder2/index"); +const m32 = require("./subfolder2/another"); +const m33 = require("./subfolder2/another/"); +const m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// esm format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +const m1 = require("./index.js"); +const m2 = require("./index.mjs"); +const m3 = require("./index.cjs"); +const m4 = require("./subfolder/index.js"); +const m5 = require("./subfolder/index.mjs"); +const m6 = require("./subfolder/index.cjs"); +const m7 = require("./subfolder2/index.js"); +const m8 = require("./subfolder2/index.mjs"); +const m9 = require("./subfolder2/index.cjs"); +const m10 = require("./subfolder2/another/index.js"); +const m11 = require("./subfolder2/another/index.mjs"); +const m12 = require("./subfolder2/another/index.cjs"); +// The next ones should all fail - esm format files have no index resolution or extension resolution +const m13 = require("./"); +const m14 = require("./index"); +const m15 = require("./subfolder"); +const m16 = require("./subfolder/"); +const m17 = require("./subfolder/index"); +const m18 = require("./subfolder2"); +const m19 = require("./subfolder2/"); +const m20 = require("./subfolder2/index"); +const m21 = require("./subfolder2/another"); +const m22 = require("./subfolder2/another/"); +const m23 = require("./subfolder2/another/index"); +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; +// 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!) +const m24 = require("./"); +const m25 = require("./index"); +const m26 = require("./subfolder"); +const m27 = require("./subfolder/"); +const m28 = require("./subfolder/index"); +const m29 = require("./subfolder2"); +const m30 = require("./subfolder2/"); +const m31 = require("./subfolder2/index"); +const m32 = require("./subfolder2/another"); +const m33 = require("./subfolder2/another/"); +const m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// esm format file +const x = 1; +exports.x = x; + + +//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.cts] +declare const x = 1; +export { x }; +//// [index.d.mts] +declare const x = 1; +export { x }; +//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.cts] +declare const x = 1; +export { x }; +//// [index.d.mts] +declare const x = 1; +export { x }; +//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.mts] +declare const x = 1; +export { x }; +//// [index.d.cts] +declare const x = 1; +export { x }; +//// [index.d.cts] +declare const x = 1; +export { x }; +//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.mts] +declare const x = 1; +export { x }; diff --git a/tests/baselines/reference/nodeModules1(module=node18).symbols b/tests/baselines/reference/nodeModules1(module=node18).symbols new file mode 100644 index 0000000000000..5a37ad42d71a0 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).symbols @@ -0,0 +1,831 @@ +//// [tests/cases/conformance/node/nodeModules1.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== subfolder/index.cts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== subfolder/index.mts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== subfolder2/index.ts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== subfolder2/index.cts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== subfolder2/index.mts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== subfolder2/another/index.ts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== subfolder2/another/index.mts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== subfolder2/another/index.cts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== index.mts === +import * as m1 from "./index.js"; +>m1 : Symbol(m1, Decl(index.mts, 0, 6)) + +import * as m2 from "./index.mjs"; +>m2 : Symbol(m2, Decl(index.mts, 1, 6)) + +import * as m3 from "./index.cjs"; +>m3 : Symbol(m3, Decl(index.mts, 2, 6)) + +import * as m4 from "./subfolder/index.js"; +>m4 : Symbol(m4, Decl(index.mts, 3, 6)) + +import * as m5 from "./subfolder/index.mjs"; +>m5 : Symbol(m5, Decl(index.mts, 4, 6)) + +import * as m6 from "./subfolder/index.cjs"; +>m6 : Symbol(m6, Decl(index.mts, 5, 6)) + +import * as m7 from "./subfolder2/index.js"; +>m7 : Symbol(m7, Decl(index.mts, 6, 6)) + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : Symbol(m8, Decl(index.mts, 7, 6)) + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : Symbol(m9, Decl(index.mts, 8, 6)) + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : Symbol(m10, Decl(index.mts, 9, 6)) + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : Symbol(m11, Decl(index.mts, 10, 6)) + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : Symbol(m12, Decl(index.mts, 11, 6)) + +// The next ones should all fail - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : Symbol(m13, Decl(index.mts, 13, 6)) + +import * as m14 from "./index"; +>m14 : Symbol(m14, Decl(index.mts, 14, 6)) + +import * as m15 from "./subfolder"; +>m15 : Symbol(m15, Decl(index.mts, 15, 6)) + +import * as m16 from "./subfolder/"; +>m16 : Symbol(m16, Decl(index.mts, 16, 6)) + +import * as m17 from "./subfolder/index"; +>m17 : Symbol(m17, Decl(index.mts, 17, 6)) + +import * as m18 from "./subfolder2"; +>m18 : Symbol(m18, Decl(index.mts, 18, 6)) + +import * as m19 from "./subfolder2/"; +>m19 : Symbol(m19, Decl(index.mts, 19, 6)) + +import * as m20 from "./subfolder2/index"; +>m20 : Symbol(m20, Decl(index.mts, 20, 6)) + +import * as m21 from "./subfolder2/another"; +>m21 : Symbol(m21, Decl(index.mts, 21, 6)) + +import * as m22 from "./subfolder2/another/"; +>m22 : Symbol(m22, Decl(index.mts, 22, 6)) + +import * as m23 from "./subfolder2/another/index"; +>m23 : Symbol(m23, Decl(index.mts, 23, 6)) + +void m1; +>m1 : Symbol(m1, Decl(index.mts, 0, 6)) + +void m2; +>m2 : Symbol(m2, Decl(index.mts, 1, 6)) + +void m3; +>m3 : Symbol(m3, Decl(index.mts, 2, 6)) + +void m4; +>m4 : Symbol(m4, Decl(index.mts, 3, 6)) + +void m5; +>m5 : Symbol(m5, Decl(index.mts, 4, 6)) + +void m6; +>m6 : Symbol(m6, Decl(index.mts, 5, 6)) + +void m7; +>m7 : Symbol(m7, Decl(index.mts, 6, 6)) + +void m8; +>m8 : Symbol(m8, Decl(index.mts, 7, 6)) + +void m9; +>m9 : Symbol(m9, Decl(index.mts, 8, 6)) + +void m10; +>m10 : Symbol(m10, Decl(index.mts, 9, 6)) + +void m11; +>m11 : Symbol(m11, Decl(index.mts, 10, 6)) + +void m12; +>m12 : Symbol(m12, Decl(index.mts, 11, 6)) + +void m13; +>m13 : Symbol(m13, Decl(index.mts, 13, 6)) + +void m14; +>m14 : Symbol(m14, Decl(index.mts, 14, 6)) + +void m15; +>m15 : Symbol(m15, Decl(index.mts, 15, 6)) + +void m16; +>m16 : Symbol(m16, Decl(index.mts, 16, 6)) + +void m17; +>m17 : Symbol(m17, Decl(index.mts, 17, 6)) + +void m18; +>m18 : Symbol(m18, Decl(index.mts, 18, 6)) + +void m19; +>m19 : Symbol(m19, Decl(index.mts, 19, 6)) + +void m20; +>m20 : Symbol(m20, Decl(index.mts, 20, 6)) + +void m21; +>m21 : Symbol(m21, Decl(index.mts, 21, 6)) + +void m22; +>m22 : Symbol(m22, Decl(index.mts, 22, 6)) + +void m23; +>m23 : Symbol(m23, Decl(index.mts, 23, 6)) + +// 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("./"); +>m24 : Symbol(m24, Decl(index.mts, 46, 9)) + +import m25 = require("./index"); +>m25 : Symbol(m25, Decl(index.mts, 49, 27)) + +import m26 = require("./subfolder"); +>m26 : Symbol(m26, Decl(index.mts, 50, 32)) + +import m27 = require("./subfolder/"); +>m27 : Symbol(m27, Decl(index.mts, 51, 36)) + +import m28 = require("./subfolder/index"); +>m28 : Symbol(m28, Decl(index.mts, 52, 37)) + +import m29 = require("./subfolder2"); +>m29 : Symbol(m29, Decl(index.mts, 53, 42)) + +import m30 = require("./subfolder2/"); +>m30 : Symbol(m30, Decl(index.mts, 54, 37)) + +import m31 = require("./subfolder2/index"); +>m31 : Symbol(m31, Decl(index.mts, 55, 38)) + +import m32 = require("./subfolder2/another"); +>m32 : Symbol(m32, Decl(index.mts, 56, 43)) + +import m33 = require("./subfolder2/another/"); +>m33 : Symbol(m33, Decl(index.mts, 57, 45)) + +import m34 = require("./subfolder2/another/index"); +>m34 : Symbol(m34, Decl(index.mts, 58, 46)) + +void m24; +>m24 : Symbol(m24, Decl(index.mts, 46, 9)) + +void m25; +>m25 : Symbol(m25, Decl(index.mts, 49, 27)) + +void m26; +>m26 : Symbol(m26, Decl(index.mts, 50, 32)) + +void m27; +>m27 : Symbol(m27, Decl(index.mts, 51, 36)) + +void m28; +>m28 : Symbol(m28, Decl(index.mts, 52, 37)) + +void m29; +>m29 : Symbol(m29, Decl(index.mts, 53, 42)) + +void m30; +>m30 : Symbol(m30, Decl(index.mts, 54, 37)) + +void m31; +>m31 : Symbol(m31, Decl(index.mts, 55, 38)) + +void m32; +>m32 : Symbol(m32, Decl(index.mts, 56, 43)) + +void m33; +>m33 : Symbol(m33, Decl(index.mts, 57, 45)) + +void m34; +>m34 : Symbol(m34, Decl(index.mts, 58, 46)) + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Symbol(_m35, Decl(index.mts, 73, 5)) + +const _m36 = import("./index"); +>_m36 : Symbol(_m36, Decl(index.mts, 74, 5)) +>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) + +const _m37 = import("./subfolder"); +>_m37 : Symbol(_m37, Decl(index.mts, 75, 5)) + +const _m38 = import("./subfolder/"); +>_m38 : Symbol(_m38, Decl(index.mts, 76, 5)) + +const _m39 = import("./subfolder/index"); +>_m39 : Symbol(_m39, Decl(index.mts, 77, 5)) +>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) + +const _m40 = import("./subfolder2"); +>_m40 : Symbol(_m40, Decl(index.mts, 78, 5)) + +const _m41 = import("./subfolder2/"); +>_m41 : Symbol(_m41, Decl(index.mts, 79, 5)) + +const _m42 = import("./subfolder2/index"); +>_m42 : Symbol(_m42, Decl(index.mts, 80, 5)) +>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) + +const _m43 = import("./subfolder2/another"); +>_m43 : Symbol(_m43, Decl(index.mts, 81, 5)) + +const _m44 = import("./subfolder2/another/"); +>_m44 : Symbol(_m44, Decl(index.mts, 82, 5)) + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Symbol(_m45, Decl(index.mts, 83, 5)) +>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) + +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mts, 86, 5)) + +export {x}; +>x : Symbol(m2.x, Decl(index.mts, 87, 8)) + +=== index.cts === +// ESM-format imports below should issue errors +import * as m1 from "./index.js"; +>m1 : Symbol(m1, Decl(index.cts, 1, 6)) + +import * as m2 from "./index.mjs"; +>m2 : Symbol(m2, Decl(index.cts, 2, 6)) + +import * as m3 from "./index.cjs"; +>m3 : Symbol(m3, Decl(index.cts, 3, 6)) + +import * as m4 from "./subfolder/index.js"; +>m4 : Symbol(m4, Decl(index.cts, 4, 6)) + +import * as m5 from "./subfolder/index.mjs"; +>m5 : Symbol(m5, Decl(index.cts, 5, 6)) + +import * as m6 from "./subfolder/index.cjs"; +>m6 : Symbol(m6, Decl(index.cts, 6, 6)) + +import * as m7 from "./subfolder2/index.js"; +>m7 : Symbol(m7, Decl(index.cts, 7, 6)) + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : Symbol(m8, Decl(index.cts, 8, 6)) + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : Symbol(m9, Decl(index.cts, 9, 6)) + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : Symbol(m10, Decl(index.cts, 10, 6)) + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : Symbol(m11, Decl(index.cts, 11, 6)) + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : Symbol(m12, Decl(index.cts, 12, 6)) + +// 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 "./"; +>m13 : Symbol(m13, Decl(index.cts, 14, 6)) + +import * as m14 from "./index"; +>m14 : Symbol(m14, Decl(index.cts, 15, 6)) + +import * as m15 from "./subfolder"; +>m15 : Symbol(m15, Decl(index.cts, 16, 6)) + +import * as m16 from "./subfolder/"; +>m16 : Symbol(m16, Decl(index.cts, 17, 6)) + +import * as m17 from "./subfolder/index"; +>m17 : Symbol(m17, Decl(index.cts, 18, 6)) + +import * as m18 from "./subfolder2"; +>m18 : Symbol(m18, Decl(index.cts, 19, 6)) + +import * as m19 from "./subfolder2/"; +>m19 : Symbol(m19, Decl(index.cts, 20, 6)) + +import * as m20 from "./subfolder2/index"; +>m20 : Symbol(m20, Decl(index.cts, 21, 6)) + +import * as m21 from "./subfolder2/another"; +>m21 : Symbol(m21, Decl(index.cts, 22, 6)) + +import * as m22 from "./subfolder2/another/"; +>m22 : Symbol(m22, Decl(index.cts, 23, 6)) + +import * as m23 from "./subfolder2/another/index"; +>m23 : Symbol(m23, Decl(index.cts, 24, 6)) + +void m1; +>m1 : Symbol(m1, Decl(index.cts, 1, 6)) + +void m2; +>m2 : Symbol(m2, Decl(index.cts, 2, 6)) + +void m3; +>m3 : Symbol(m3, Decl(index.cts, 3, 6)) + +void m4; +>m4 : Symbol(m4, Decl(index.cts, 4, 6)) + +void m5; +>m5 : Symbol(m5, Decl(index.cts, 5, 6)) + +void m6; +>m6 : Symbol(m6, Decl(index.cts, 6, 6)) + +void m7; +>m7 : Symbol(m7, Decl(index.cts, 7, 6)) + +void m8; +>m8 : Symbol(m8, Decl(index.cts, 8, 6)) + +void m9; +>m9 : Symbol(m9, Decl(index.cts, 9, 6)) + +void m10; +>m10 : Symbol(m10, Decl(index.cts, 10, 6)) + +void m11; +>m11 : Symbol(m11, Decl(index.cts, 11, 6)) + +void m12; +>m12 : Symbol(m12, Decl(index.cts, 12, 6)) + +void m13; +>m13 : Symbol(m13, Decl(index.cts, 14, 6)) + +void m14; +>m14 : Symbol(m14, Decl(index.cts, 15, 6)) + +void m15; +>m15 : Symbol(m15, Decl(index.cts, 16, 6)) + +void m16; +>m16 : Symbol(m16, Decl(index.cts, 17, 6)) + +void m17; +>m17 : Symbol(m17, Decl(index.cts, 18, 6)) + +void m18; +>m18 : Symbol(m18, Decl(index.cts, 19, 6)) + +void m19; +>m19 : Symbol(m19, Decl(index.cts, 20, 6)) + +void m20; +>m20 : Symbol(m20, Decl(index.cts, 21, 6)) + +void m21; +>m21 : Symbol(m21, Decl(index.cts, 22, 6)) + +void m22; +>m22 : Symbol(m22, Decl(index.cts, 23, 6)) + +void m23; +>m23 : Symbol(m23, Decl(index.cts, 24, 6)) + +// 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("./"); +>m24 : Symbol(m24, Decl(index.cts, 47, 9)) + +import m25 = require("./index"); +>m25 : Symbol(m25, Decl(index.cts, 50, 27)) + +import m26 = require("./subfolder"); +>m26 : Symbol(m26, Decl(index.cts, 51, 32)) + +import m27 = require("./subfolder/"); +>m27 : Symbol(m27, Decl(index.cts, 52, 36)) + +import m28 = require("./subfolder/index"); +>m28 : Symbol(m28, Decl(index.cts, 53, 37)) + +import m29 = require("./subfolder2"); +>m29 : Symbol(m29, Decl(index.cts, 54, 42)) + +import m30 = require("./subfolder2/"); +>m30 : Symbol(m30, Decl(index.cts, 55, 37)) + +import m31 = require("./subfolder2/index"); +>m31 : Symbol(m31, Decl(index.cts, 56, 38)) + +import m32 = require("./subfolder2/another"); +>m32 : Symbol(m32, Decl(index.cts, 57, 43)) + +import m33 = require("./subfolder2/another/"); +>m33 : Symbol(m33, Decl(index.cts, 58, 45)) + +import m34 = require("./subfolder2/another/index"); +>m34 : Symbol(m34, Decl(index.cts, 59, 46)) + +void m24; +>m24 : Symbol(m24, Decl(index.cts, 47, 9)) + +void m25; +>m25 : Symbol(m25, Decl(index.cts, 50, 27)) + +void m26; +>m26 : Symbol(m26, Decl(index.cts, 51, 32)) + +void m27; +>m27 : Symbol(m27, Decl(index.cts, 52, 36)) + +void m28; +>m28 : Symbol(m28, Decl(index.cts, 53, 37)) + +void m29; +>m29 : Symbol(m29, Decl(index.cts, 54, 42)) + +void m30; +>m30 : Symbol(m30, Decl(index.cts, 55, 37)) + +void m31; +>m31 : Symbol(m31, Decl(index.cts, 56, 38)) + +void m32; +>m32 : Symbol(m32, Decl(index.cts, 57, 43)) + +void m33; +>m33 : Symbol(m33, Decl(index.cts, 58, 45)) + +void m34; +>m34 : Symbol(m34, Decl(index.cts, 59, 46)) + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Symbol(_m35, Decl(index.cts, 74, 5)) + +const _m36 = import("./index"); +>_m36 : Symbol(_m36, Decl(index.cts, 75, 5)) +>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) + +const _m37 = import("./subfolder"); +>_m37 : Symbol(_m37, Decl(index.cts, 76, 5)) + +const _m38 = import("./subfolder/"); +>_m38 : Symbol(_m38, Decl(index.cts, 77, 5)) + +const _m39 = import("./subfolder/index"); +>_m39 : Symbol(_m39, Decl(index.cts, 78, 5)) +>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) + +const _m40 = import("./subfolder2"); +>_m40 : Symbol(_m40, Decl(index.cts, 79, 5)) + +const _m41 = import("./subfolder2/"); +>_m41 : Symbol(_m41, Decl(index.cts, 80, 5)) + +const _m42 = import("./subfolder2/index"); +>_m42 : Symbol(_m42, Decl(index.cts, 81, 5)) +>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) + +const _m43 = import("./subfolder2/another"); +>_m43 : Symbol(_m43, Decl(index.cts, 82, 5)) + +const _m44 = import("./subfolder2/another/"); +>_m44 : Symbol(_m44, Decl(index.cts, 83, 5)) + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Symbol(_m45, Decl(index.cts, 84, 5)) +>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) + +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cts, 86, 5)) + +export {x}; +>x : Symbol(m3.x, Decl(index.cts, 87, 8)) + +=== index.ts === +import * as m1 from "./index.js"; +>m1 : Symbol(m1, Decl(index.ts, 0, 6)) + +import * as m2 from "./index.mjs"; +>m2 : Symbol(m2, Decl(index.ts, 1, 6)) + +import * as m3 from "./index.cjs"; +>m3 : Symbol(m3, Decl(index.ts, 2, 6)) + +import * as m4 from "./subfolder/index.js"; +>m4 : Symbol(m4, Decl(index.ts, 3, 6)) + +import * as m5 from "./subfolder/index.mjs"; +>m5 : Symbol(m5, Decl(index.ts, 4, 6)) + +import * as m6 from "./subfolder/index.cjs"; +>m6 : Symbol(m6, Decl(index.ts, 5, 6)) + +import * as m7 from "./subfolder2/index.js"; +>m7 : Symbol(m7, Decl(index.ts, 6, 6)) + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : Symbol(m8, Decl(index.ts, 7, 6)) + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : Symbol(m9, Decl(index.ts, 8, 6)) + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : Symbol(m10, Decl(index.ts, 9, 6)) + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : Symbol(m11, Decl(index.ts, 10, 6)) + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : Symbol(m12, Decl(index.ts, 11, 6)) + +// The next ones shouldn't all work - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : Symbol(m13, Decl(index.ts, 13, 6)) + +import * as m14 from "./index"; +>m14 : Symbol(m14, Decl(index.ts, 14, 6)) + +import * as m15 from "./subfolder"; +>m15 : Symbol(m15, Decl(index.ts, 15, 6)) + +import * as m16 from "./subfolder/"; +>m16 : Symbol(m16, Decl(index.ts, 16, 6)) + +import * as m17 from "./subfolder/index"; +>m17 : Symbol(m17, Decl(index.ts, 17, 6)) + +import * as m18 from "./subfolder2"; +>m18 : Symbol(m18, Decl(index.ts, 18, 6)) + +import * as m19 from "./subfolder2/"; +>m19 : Symbol(m19, Decl(index.ts, 19, 6)) + +import * as m20 from "./subfolder2/index"; +>m20 : Symbol(m20, Decl(index.ts, 20, 6)) + +import * as m21 from "./subfolder2/another"; +>m21 : Symbol(m21, Decl(index.ts, 21, 6)) + +import * as m22 from "./subfolder2/another/"; +>m22 : Symbol(m22, Decl(index.ts, 22, 6)) + +import * as m23 from "./subfolder2/another/index"; +>m23 : Symbol(m23, Decl(index.ts, 23, 6)) + +void m1; +>m1 : Symbol(m1, Decl(index.ts, 0, 6)) + +void m2; +>m2 : Symbol(m2, Decl(index.ts, 1, 6)) + +void m3; +>m3 : Symbol(m3, Decl(index.ts, 2, 6)) + +void m4; +>m4 : Symbol(m4, Decl(index.ts, 3, 6)) + +void m5; +>m5 : Symbol(m5, Decl(index.ts, 4, 6)) + +void m6; +>m6 : Symbol(m6, Decl(index.ts, 5, 6)) + +void m7; +>m7 : Symbol(m7, Decl(index.ts, 6, 6)) + +void m8; +>m8 : Symbol(m8, Decl(index.ts, 7, 6)) + +void m9; +>m9 : Symbol(m9, Decl(index.ts, 8, 6)) + +void m10; +>m10 : Symbol(m10, Decl(index.ts, 9, 6)) + +void m11; +>m11 : Symbol(m11, Decl(index.ts, 10, 6)) + +void m12; +>m12 : Symbol(m12, Decl(index.ts, 11, 6)) + +void m13; +>m13 : Symbol(m13, Decl(index.ts, 13, 6)) + +void m14; +>m14 : Symbol(m14, Decl(index.ts, 14, 6)) + +void m15; +>m15 : Symbol(m15, Decl(index.ts, 15, 6)) + +void m16; +>m16 : Symbol(m16, Decl(index.ts, 16, 6)) + +void m17; +>m17 : Symbol(m17, Decl(index.ts, 17, 6)) + +void m18; +>m18 : Symbol(m18, Decl(index.ts, 18, 6)) + +void m19; +>m19 : Symbol(m19, Decl(index.ts, 19, 6)) + +void m20; +>m20 : Symbol(m20, Decl(index.ts, 20, 6)) + +void m21; +>m21 : Symbol(m21, Decl(index.ts, 21, 6)) + +void m22; +>m22 : Symbol(m22, Decl(index.ts, 22, 6)) + +void m23; +>m23 : Symbol(m23, Decl(index.ts, 23, 6)) + +// 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("./"); +>m24 : Symbol(m24, Decl(index.ts, 46, 9)) + +import m25 = require("./index"); +>m25 : Symbol(m25, Decl(index.ts, 49, 27)) + +import m26 = require("./subfolder"); +>m26 : Symbol(m26, Decl(index.ts, 50, 32)) + +import m27 = require("./subfolder/"); +>m27 : Symbol(m27, Decl(index.ts, 51, 36)) + +import m28 = require("./subfolder/index"); +>m28 : Symbol(m28, Decl(index.ts, 52, 37)) + +import m29 = require("./subfolder2"); +>m29 : Symbol(m29, Decl(index.ts, 53, 42)) + +import m30 = require("./subfolder2/"); +>m30 : Symbol(m30, Decl(index.ts, 54, 37)) + +import m31 = require("./subfolder2/index"); +>m31 : Symbol(m31, Decl(index.ts, 55, 38)) + +import m32 = require("./subfolder2/another"); +>m32 : Symbol(m32, Decl(index.ts, 56, 43)) + +import m33 = require("./subfolder2/another/"); +>m33 : Symbol(m33, Decl(index.ts, 57, 45)) + +import m34 = require("./subfolder2/another/index"); +>m34 : Symbol(m34, Decl(index.ts, 58, 46)) + +void m24; +>m24 : Symbol(m24, Decl(index.ts, 46, 9)) + +void m25; +>m25 : Symbol(m25, Decl(index.ts, 49, 27)) + +void m26; +>m26 : Symbol(m26, Decl(index.ts, 50, 32)) + +void m27; +>m27 : Symbol(m27, Decl(index.ts, 51, 36)) + +void m28; +>m28 : Symbol(m28, Decl(index.ts, 52, 37)) + +void m29; +>m29 : Symbol(m29, Decl(index.ts, 53, 42)) + +void m30; +>m30 : Symbol(m30, Decl(index.ts, 54, 37)) + +void m31; +>m31 : Symbol(m31, Decl(index.ts, 55, 38)) + +void m32; +>m32 : Symbol(m32, Decl(index.ts, 56, 43)) + +void m33; +>m33 : Symbol(m33, Decl(index.ts, 57, 45)) + +void m34; +>m34 : Symbol(m34, Decl(index.ts, 58, 46)) + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Symbol(_m35, Decl(index.ts, 73, 5)) + +const _m36 = import("./index"); +>_m36 : Symbol(_m36, Decl(index.ts, 74, 5)) +>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) + +const _m37 = import("./subfolder"); +>_m37 : Symbol(_m37, Decl(index.ts, 75, 5)) + +const _m38 = import("./subfolder/"); +>_m38 : Symbol(_m38, Decl(index.ts, 76, 5)) + +const _m39 = import("./subfolder/index"); +>_m39 : Symbol(_m39, Decl(index.ts, 77, 5)) +>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) + +const _m40 = import("./subfolder2"); +>_m40 : Symbol(_m40, Decl(index.ts, 78, 5)) + +const _m41 = import("./subfolder2/"); +>_m41 : Symbol(_m41, Decl(index.ts, 79, 5)) + +const _m42 = import("./subfolder2/index"); +>_m42 : Symbol(_m42, Decl(index.ts, 80, 5)) +>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) + +const _m43 = import("./subfolder2/another"); +>_m43 : Symbol(_m43, Decl(index.ts, 81, 5)) + +const _m44 = import("./subfolder2/another/"); +>_m44 : Symbol(_m44, Decl(index.ts, 82, 5)) + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Symbol(_m45, Decl(index.ts, 83, 5)) +>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) + +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 85, 5)) + +export {x}; +>x : Symbol(m1.x, Decl(index.ts, 86, 8)) + diff --git a/tests/baselines/reference/nodeModules1(module=node18).types b/tests/baselines/reference/nodeModules1(module=node18).types new file mode 100644 index 0000000000000..5c08ff59e38b1 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).types @@ -0,0 +1,1440 @@ +//// [tests/cases/conformance/node/nodeModules1.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder/index.cts === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder/index.mts === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/index.ts === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/index.cts === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/index.mts === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/another/index.ts === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/another/index.mts === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/another/index.cts === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== index.mts === +import * as m1 from "./index.js"; +>m1 : typeof m1 +> : ^^^^^^^^^ + +import * as m2 from "./index.mjs"; +>m2 : typeof m2 +> : ^^^^^^^^^ + +import * as m3 from "./index.cjs"; +>m3 : typeof m3 +> : ^^^^^^^^^ + +import * as m4 from "./subfolder/index.js"; +>m4 : typeof m4 +> : ^^^^^^^^^ + +import * as m5 from "./subfolder/index.mjs"; +>m5 : typeof m5 +> : ^^^^^^^^^ + +import * as m6 from "./subfolder/index.cjs"; +>m6 : typeof m6 +> : ^^^^^^^^^ + +import * as m7 from "./subfolder2/index.js"; +>m7 : typeof m7 +> : ^^^^^^^^^ + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : typeof m8 +> : ^^^^^^^^^ + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : typeof m9 +> : ^^^^^^^^^ + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : typeof m10 +> : ^^^^^^^^^^ + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : typeof m11 +> : ^^^^^^^^^^ + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : typeof m12 +> : ^^^^^^^^^^ + +// The next ones should all fail - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : any +> : ^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : typeof m10 +> : ^^^^^^^^^^ + +void m1; +>void m1 : undefined +> : ^^^^^^^^^ +>m1 : typeof m1 +> : ^^^^^^^^^ + +void m2; +>void m2 : undefined +> : ^^^^^^^^^ +>m2 : typeof m2 +> : ^^^^^^^^^ + +void m3; +>void m3 : undefined +> : ^^^^^^^^^ +>m3 : typeof m3 +> : ^^^^^^^^^ + +void m4; +>void m4 : undefined +> : ^^^^^^^^^ +>m4 : typeof m4 +> : ^^^^^^^^^ + +void m5; +>void m5 : undefined +> : ^^^^^^^^^ +>m5 : typeof m5 +> : ^^^^^^^^^ + +void m6; +>void m6 : undefined +> : ^^^^^^^^^ +>m6 : typeof m6 +> : ^^^^^^^^^ + +void m7; +>void m7 : undefined +> : ^^^^^^^^^ +>m7 : typeof m7 +> : ^^^^^^^^^ + +void m8; +>void m8 : undefined +> : ^^^^^^^^^ +>m8 : typeof m8 +> : ^^^^^^^^^ + +void m9; +>void m9 : undefined +> : ^^^^^^^^^ +>m9 : typeof m9 +> : ^^^^^^^^^ + +void m10; +>void m10 : undefined +> : ^^^^^^^^^ +>m10 : typeof m10 +> : ^^^^^^^^^^ + +void m11; +>void m11 : undefined +> : ^^^^^^^^^ +>m11 : typeof m11 +> : ^^^^^^^^^^ + +void m12; +>void m12 : undefined +> : ^^^^^^^^^ +>m12 : typeof m12 +> : ^^^^^^^^^^ + +void m13; +>void m13 : undefined +> : ^^^^^^^^^ +>m13 : any +> : ^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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("./"); +>m24 : any +> : ^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : any +> : ^^^ + +import m27 = require("./subfolder/"); +>m27 : any +> : ^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : any +> : ^^^ + +import m30 = require("./subfolder2/"); +>m30 : any +> : ^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : any +> : ^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : any +> : ^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : any +> : ^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : any +> : ^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : any +> : ^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : any +> : ^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : any +> : ^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : any +> : ^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : any +> : ^^^ + +void m34; +>void m34 : undefined +> : ^^^^^^^^^ +>m34 : typeof m10 +> : ^^^^^^^^^^ + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Promise +> : ^^^^^^^^^^^^ +>import("./") : Promise +> : ^^^^^^^^^^^^ +>"./" : "./" +> : ^^^^ + +const _m36 = import("./index"); +>_m36 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./index" : "./index" +> : ^^^^^^^^^ + +const _m37 = import("./subfolder"); +>_m37 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder" : "./subfolder" +> : ^^^^^^^^^^^^^ + +const _m38 = import("./subfolder/"); +>_m38 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder/" : "./subfolder/" +> : ^^^^^^^^^^^^^^ + +const _m39 = import("./subfolder/index"); +>_m39 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder/index" : "./subfolder/index" +> : ^^^^^^^^^^^^^^^^^^^ + +const _m40 = import("./subfolder2"); +>_m40 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2" : "./subfolder2" +> : ^^^^^^^^^^^^^^ + +const _m41 = import("./subfolder2/"); +>_m41 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/" : "./subfolder2/" +> : ^^^^^^^^^^^^^^^ + +const _m42 = import("./subfolder2/index"); +>_m42 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder2/index" : "./subfolder2/index" +> : ^^^^^^^^^^^^^^^^^^^^ + +const _m43 = import("./subfolder2/another"); +>_m43 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another" : "./subfolder2/another" +> : ^^^^^^^^^^^^^^^^^^^^^^ + +const _m44 = import("./subfolder2/another/"); +>_m44 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another/" : "./subfolder2/another/" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/another/index") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./subfolder2/another/index" : "./subfolder2/another/index" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== index.cts === +// ESM-format imports below should issue errors +import * as m1 from "./index.js"; +>m1 : typeof m1 +> : ^^^^^^^^^ + +import * as m2 from "./index.mjs"; +>m2 : typeof m2 +> : ^^^^^^^^^ + +import * as m3 from "./index.cjs"; +>m3 : typeof m3 +> : ^^^^^^^^^ + +import * as m4 from "./subfolder/index.js"; +>m4 : typeof m4 +> : ^^^^^^^^^ + +import * as m5 from "./subfolder/index.mjs"; +>m5 : typeof m5 +> : ^^^^^^^^^ + +import * as m6 from "./subfolder/index.cjs"; +>m6 : typeof m6 +> : ^^^^^^^^^ + +import * as m7 from "./subfolder2/index.js"; +>m7 : typeof m7 +> : ^^^^^^^^^ + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : typeof m8 +> : ^^^^^^^^^ + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : typeof m9 +> : ^^^^^^^^^ + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : typeof m10 +> : ^^^^^^^^^^ + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : typeof m11 +> : ^^^^^^^^^^ + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : typeof m12 +> : ^^^^^^^^^^ + +// 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 "./"; +>m13 : any +> : ^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : typeof m10 +> : ^^^^^^^^^^ + +void m1; +>void m1 : undefined +> : ^^^^^^^^^ +>m1 : typeof m1 +> : ^^^^^^^^^ + +void m2; +>void m2 : undefined +> : ^^^^^^^^^ +>m2 : typeof m2 +> : ^^^^^^^^^ + +void m3; +>void m3 : undefined +> : ^^^^^^^^^ +>m3 : typeof m3 +> : ^^^^^^^^^ + +void m4; +>void m4 : undefined +> : ^^^^^^^^^ +>m4 : typeof m4 +> : ^^^^^^^^^ + +void m5; +>void m5 : undefined +> : ^^^^^^^^^ +>m5 : typeof m5 +> : ^^^^^^^^^ + +void m6; +>void m6 : undefined +> : ^^^^^^^^^ +>m6 : typeof m6 +> : ^^^^^^^^^ + +void m7; +>void m7 : undefined +> : ^^^^^^^^^ +>m7 : typeof m7 +> : ^^^^^^^^^ + +void m8; +>void m8 : undefined +> : ^^^^^^^^^ +>m8 : typeof m8 +> : ^^^^^^^^^ + +void m9; +>void m9 : undefined +> : ^^^^^^^^^ +>m9 : typeof m9 +> : ^^^^^^^^^ + +void m10; +>void m10 : undefined +> : ^^^^^^^^^ +>m10 : typeof m10 +> : ^^^^^^^^^^ + +void m11; +>void m11 : undefined +> : ^^^^^^^^^ +>m11 : typeof m11 +> : ^^^^^^^^^^ + +void m12; +>void m12 : undefined +> : ^^^^^^^^^ +>m12 : typeof m12 +> : ^^^^^^^^^^ + +void m13; +>void m13 : undefined +> : ^^^^^^^^^ +>m13 : any +> : ^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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("./"); +>m24 : any +> : ^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : any +> : ^^^ + +import m27 = require("./subfolder/"); +>m27 : any +> : ^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : any +> : ^^^ + +import m30 = require("./subfolder2/"); +>m30 : any +> : ^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : any +> : ^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : any +> : ^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : any +> : ^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : any +> : ^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : any +> : ^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : any +> : ^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : any +> : ^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : any +> : ^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : any +> : ^^^ + +void m34; +>void m34 : undefined +> : ^^^^^^^^^ +>m34 : typeof m10 +> : ^^^^^^^^^^ + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Promise +> : ^^^^^^^^^^^^ +>import("./") : Promise +> : ^^^^^^^^^^^^ +>"./" : "./" +> : ^^^^ + +const _m36 = import("./index"); +>_m36 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./index" : "./index" +> : ^^^^^^^^^ + +const _m37 = import("./subfolder"); +>_m37 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder" : "./subfolder" +> : ^^^^^^^^^^^^^ + +const _m38 = import("./subfolder/"); +>_m38 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder/" : "./subfolder/" +> : ^^^^^^^^^^^^^^ + +const _m39 = import("./subfolder/index"); +>_m39 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder/index" : "./subfolder/index" +> : ^^^^^^^^^^^^^^^^^^^ + +const _m40 = import("./subfolder2"); +>_m40 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2" : "./subfolder2" +> : ^^^^^^^^^^^^^^ + +const _m41 = import("./subfolder2/"); +>_m41 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/" : "./subfolder2/" +> : ^^^^^^^^^^^^^^^ + +const _m42 = import("./subfolder2/index"); +>_m42 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder2/index" : "./subfolder2/index" +> : ^^^^^^^^^^^^^^^^^^^^ + +const _m43 = import("./subfolder2/another"); +>_m43 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another" : "./subfolder2/another" +> : ^^^^^^^^^^^^^^^^^^^^^^ + +const _m44 = import("./subfolder2/another/"); +>_m44 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another/" : "./subfolder2/another/" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/another/index") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./subfolder2/another/index" : "./subfolder2/another/index" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== index.ts === +import * as m1 from "./index.js"; +>m1 : typeof m1 +> : ^^^^^^^^^ + +import * as m2 from "./index.mjs"; +>m2 : typeof m2 +> : ^^^^^^^^^ + +import * as m3 from "./index.cjs"; +>m3 : typeof m3 +> : ^^^^^^^^^ + +import * as m4 from "./subfolder/index.js"; +>m4 : typeof m4 +> : ^^^^^^^^^ + +import * as m5 from "./subfolder/index.mjs"; +>m5 : typeof m5 +> : ^^^^^^^^^ + +import * as m6 from "./subfolder/index.cjs"; +>m6 : typeof m6 +> : ^^^^^^^^^ + +import * as m7 from "./subfolder2/index.js"; +>m7 : typeof m7 +> : ^^^^^^^^^ + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : typeof m8 +> : ^^^^^^^^^ + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : typeof m9 +> : ^^^^^^^^^ + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : typeof m10 +> : ^^^^^^^^^^ + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : typeof m11 +> : ^^^^^^^^^^ + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : typeof m12 +> : ^^^^^^^^^^ + +// The next ones shouldn't all work - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : any +> : ^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : typeof m10 +> : ^^^^^^^^^^ + +void m1; +>void m1 : undefined +> : ^^^^^^^^^ +>m1 : typeof m1 +> : ^^^^^^^^^ + +void m2; +>void m2 : undefined +> : ^^^^^^^^^ +>m2 : typeof m2 +> : ^^^^^^^^^ + +void m3; +>void m3 : undefined +> : ^^^^^^^^^ +>m3 : typeof m3 +> : ^^^^^^^^^ + +void m4; +>void m4 : undefined +> : ^^^^^^^^^ +>m4 : typeof m4 +> : ^^^^^^^^^ + +void m5; +>void m5 : undefined +> : ^^^^^^^^^ +>m5 : typeof m5 +> : ^^^^^^^^^ + +void m6; +>void m6 : undefined +> : ^^^^^^^^^ +>m6 : typeof m6 +> : ^^^^^^^^^ + +void m7; +>void m7 : undefined +> : ^^^^^^^^^ +>m7 : typeof m7 +> : ^^^^^^^^^ + +void m8; +>void m8 : undefined +> : ^^^^^^^^^ +>m8 : typeof m8 +> : ^^^^^^^^^ + +void m9; +>void m9 : undefined +> : ^^^^^^^^^ +>m9 : typeof m9 +> : ^^^^^^^^^ + +void m10; +>void m10 : undefined +> : ^^^^^^^^^ +>m10 : typeof m10 +> : ^^^^^^^^^^ + +void m11; +>void m11 : undefined +> : ^^^^^^^^^ +>m11 : typeof m11 +> : ^^^^^^^^^^ + +void m12; +>void m12 : undefined +> : ^^^^^^^^^ +>m12 : typeof m12 +> : ^^^^^^^^^^ + +void m13; +>void m13 : undefined +> : ^^^^^^^^^ +>m13 : any +> : ^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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("./"); +>m24 : any +> : ^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : any +> : ^^^ + +import m27 = require("./subfolder/"); +>m27 : any +> : ^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : any +> : ^^^ + +import m30 = require("./subfolder2/"); +>m30 : any +> : ^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : any +> : ^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : any +> : ^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : any +> : ^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : any +> : ^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : any +> : ^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : any +> : ^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : any +> : ^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : any +> : ^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : any +> : ^^^ + +void m34; +>void m34 : undefined +> : ^^^^^^^^^ +>m34 : typeof m10 +> : ^^^^^^^^^^ + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Promise +> : ^^^^^^^^^^^^ +>import("./") : Promise +> : ^^^^^^^^^^^^ +>"./" : "./" +> : ^^^^ + +const _m36 = import("./index"); +>_m36 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./index" : "./index" +> : ^^^^^^^^^ + +const _m37 = import("./subfolder"); +>_m37 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder" : "./subfolder" +> : ^^^^^^^^^^^^^ + +const _m38 = import("./subfolder/"); +>_m38 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder/" : "./subfolder/" +> : ^^^^^^^^^^^^^^ + +const _m39 = import("./subfolder/index"); +>_m39 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder/index" : "./subfolder/index" +> : ^^^^^^^^^^^^^^^^^^^ + +const _m40 = import("./subfolder2"); +>_m40 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2" : "./subfolder2" +> : ^^^^^^^^^^^^^^ + +const _m41 = import("./subfolder2/"); +>_m41 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/" : "./subfolder2/" +> : ^^^^^^^^^^^^^^^ + +const _m42 = import("./subfolder2/index"); +>_m42 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder2/index" : "./subfolder2/index" +> : ^^^^^^^^^^^^^^^^^^^^ + +const _m43 = import("./subfolder2/another"); +>_m43 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another" : "./subfolder2/another" +> : ^^^^^^^^^^^^^^^^^^^^^^ + +const _m44 = import("./subfolder2/another/"); +>_m44 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another/" : "./subfolder2/another/" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/another/index") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./subfolder2/another/index" : "./subfolder2/another/index" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt new file mode 100644 index 0000000000000..5c7ecc38491f1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt @@ -0,0 +1,611 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(15,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(17,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(18,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(20,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(21,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(23,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(24,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(51,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(53,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(54,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(56,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(57,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(60,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(75,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(77,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(78,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(80,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(81,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(83,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(84,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(59,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(59,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder/index.cjs (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder/index.mjs (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/index.js (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder2/index.cjs (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder2/index.mjs (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/another/index.js (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== subfolder2/another/index.cjs (0 errors) ==== + // cjs format file + const x = 1; + export {x}; +==== subfolder2/another/index.mjs (0 errors) ==== + // esm format file + const x = 1; + export {x}; +==== index.js (32 errors) ==== + import * as m1 from "./index.js"; + import * as m2 from "./index.mjs"; + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + import * as m11 from "./subfolder2/another/index.mjs"; + 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m14 from "./index"; + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m23 from "./subfolder2/another/index"; + void m1; + void m2; + void m3; + void m4; + void m5; + void m6; + void m7; + void m8; + void m9; + void m10; + void m11; + void m12; + void m13; + void m14; + void m15; + void m16; + void m17; + void m18; + void m19; + void m20; + void m21; + void m22; + void m23; + + // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m25 = require("./index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m26 = require("./subfolder"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m28 = require("./subfolder/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m29 = require("./subfolder2"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m31 = require("./subfolder2/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + void m24; + void m25; + void m26; + void m27; + void m28; + void m29; + void m30; + void m31; + void m32; + void m33; + void m34; + + // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution + const _m35 = import("./"); + ~~~~ +!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m36 = import("./index"); + const _m37 = import("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m38 = import("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m39 = import("./subfolder/index"); + const _m40 = import("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m41 = import("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m42 = import("./subfolder2/index"); + const _m43 = import("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m44 = import("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m45 = import("./subfolder2/another/index"); + // esm format file + const x = 1; + export {x}; +==== index.cjs (32 errors) ==== + // ESM-format imports below should issue errors + import * as m1 from "./index.js"; + import * as m2 from "./index.mjs"; + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + import * as m11 from "./subfolder2/another/index.mjs"; + 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m14 from "./index"; + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m23 from "./subfolder2/another/index"; + void m1; + void m2; + void m3; + void m4; + void m5; + void m6; + void m7; + void m8; + void m9; + void m10; + void m11; + void m12; + void m13; + void m14; + void m15; + void m16; + void m17; + void m18; + void m19; + void m20; + void m21; + void m22; + void m23; + + // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m25 = require("./index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m26 = require("./subfolder"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m28 = require("./subfolder/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m29 = require("./subfolder2"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m31 = require("./subfolder2/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + void m24; + void m25; + void m26; + void m27; + void m28; + void m29; + void m30; + void m31; + void m32; + void m33; + void m34; + + // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution + const _m35 = import("./"); + ~~~~ +!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m36 = import("./index"); + const _m37 = import("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m38 = import("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m39 = import("./subfolder/index"); + const _m40 = import("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m41 = import("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m42 = import("./subfolder2/index"); + const _m43 = import("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m44 = import("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m45 = import("./subfolder2/another/index"); + // cjs format file + const x = 1; + export {x}; +==== index.mjs (32 errors) ==== + import * as m1 from "./index.js"; + import * as m2 from "./index.mjs"; + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + import * as m11 from "./subfolder2/another/index.mjs"; + 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m14 from "./index"; + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as m23 from "./subfolder2/another/index"; + void m1; + void m2; + void m3; + void m4; + void m5; + void m6; + void m7; + void m8; + void m9; + void m10; + void m11; + void m12; + void m13; + void m14; + void m15; + void m16; + void m17; + void m18; + void m19; + void m20; + void m21; + void m22; + void m23; + + // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m25 = require("./index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m26 = require("./subfolder"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m28 = require("./subfolder/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m29 = require("./subfolder2"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m31 = require("./subfolder2/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + void m24; + void m25; + void m26; + void m27; + void m28; + void m29; + void m30; + void m31; + void m32; + void m33; + void m34; + + // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution + const _m35 = import("./"); + ~~~~ +!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m36 = import("./index"); + const _m37 = import("./subfolder"); + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m38 = import("./subfolder/"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m39 = import("./subfolder/index"); + const _m40 = import("./subfolder2"); + ~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m41 = import("./subfolder2/"); + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m42 = import("./subfolder2/index"); + const _m43 = import("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m44 = import("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + const _m45 = import("./subfolder2/another/index"); + + // esm format file + const x = 1; + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== subfolder2/package.json (0 errors) ==== + { + } +==== subfolder2/another/package.json (0 errors) ==== + { + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js new file mode 100644 index 0000000000000..3b2d339f3aefb --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js @@ -0,0 +1,679 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts] //// + +//// [index.js] +// cjs format file +const x = 1; +export {x}; +//// [index.cjs] +// cjs format file +const x = 1; +export {x}; +//// [index.mjs] +// esm format file +const x = 1; +export {x}; +//// [index.js] +// cjs format file +const x = 1; +export {x}; +//// [index.cjs] +// cjs format file +const x = 1; +export {x}; +//// [index.mjs] +// esm format file +const x = 1; +export {x}; +//// [index.js] +// esm format file +const x = 1; +export {x}; +//// [index.cjs] +// cjs format file +const x = 1; +export {x}; +//// [index.mjs] +// esm format file +const x = 1; +export {x}; +//// [index.js] +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; + +// 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("./"); +import m25 = require("./index"); +import m26 = require("./subfolder"); +import m27 = require("./subfolder/"); +import m28 = require("./subfolder/index"); +import m29 = require("./subfolder2"); +import m30 = require("./subfolder2/"); +import m31 = require("./subfolder2/index"); +import m32 = require("./subfolder2/another"); +import m33 = require("./subfolder2/another/"); +import m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// esm format file +const x = 1; +export {x}; +//// [index.cjs] +// ESM-format imports below should issue errors +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; + +// 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("./"); +import m25 = require("./index"); +import m26 = require("./subfolder"); +import m27 = require("./subfolder/"); +import m28 = require("./subfolder/index"); +import m29 = require("./subfolder2"); +import m30 = require("./subfolder2/"); +import m31 = require("./subfolder2/index"); +import m32 = require("./subfolder2/another"); +import m33 = require("./subfolder2/another/"); +import m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// cjs format file +const x = 1; +export {x}; +//// [index.mjs] +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; + +// 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("./"); +import m25 = require("./index"); +import m26 = require("./subfolder"); +import m27 = require("./subfolder/"); +import m28 = require("./subfolder/index"); +import m29 = require("./subfolder2"); +import m30 = require("./subfolder2/"); +import m31 = require("./subfolder2/index"); +import m32 = require("./subfolder2/another"); +import m33 = require("./subfolder2/another/"); +import m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); + +// esm format file +const x = 1; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [package.json] +{ +} +//// [package.json] +{ + "type": "module" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = 1; +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// ESM-format imports below should issue errors +const m1 = require("./index.js"); +const m2 = require("./index.mjs"); +const m3 = require("./index.cjs"); +const m4 = require("./subfolder/index.js"); +const m5 = require("./subfolder/index.mjs"); +const m6 = require("./subfolder/index.cjs"); +const m7 = require("./subfolder2/index.js"); +const m8 = require("./subfolder2/index.mjs"); +const m9 = require("./subfolder2/index.cjs"); +const m10 = require("./subfolder2/another/index.js"); +const m11 = require("./subfolder2/another/index.mjs"); +const m12 = require("./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) +const m13 = require("./"); +const m14 = require("./index"); +const m15 = require("./subfolder"); +const m16 = require("./subfolder/"); +const m17 = require("./subfolder/index"); +const m18 = require("./subfolder2"); +const m19 = require("./subfolder2/"); +const m20 = require("./subfolder2/index"); +const m21 = require("./subfolder2/another"); +const m22 = require("./subfolder2/another/"); +const m23 = require("./subfolder2/another/index"); +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; +// 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!) +const m24 = require("./"); +const m25 = require("./index"); +const m26 = require("./subfolder"); +const m27 = require("./subfolder/"); +const m28 = require("./subfolder/index"); +const m29 = require("./subfolder2"); +const m30 = require("./subfolder2/"); +const m31 = require("./subfolder2/index"); +const m32 = require("./subfolder2/another"); +const m33 = require("./subfolder2/another/"); +const m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// cjs format file +const x = 1; +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +const m1 = require("./index.js"); +const m2 = require("./index.mjs"); +const m3 = require("./index.cjs"); +const m4 = require("./subfolder/index.js"); +const m5 = require("./subfolder/index.mjs"); +const m6 = require("./subfolder/index.cjs"); +const m7 = require("./subfolder2/index.js"); +const m8 = require("./subfolder2/index.mjs"); +const m9 = require("./subfolder2/index.cjs"); +const m10 = require("./subfolder2/another/index.js"); +const m11 = require("./subfolder2/another/index.mjs"); +const m12 = require("./subfolder2/another/index.cjs"); +// The next ones should all fail - esm format files have no index resolution or extension resolution +const m13 = require("./"); +const m14 = require("./index"); +const m15 = require("./subfolder"); +const m16 = require("./subfolder/"); +const m17 = require("./subfolder/index"); +const m18 = require("./subfolder2"); +const m19 = require("./subfolder2/"); +const m20 = require("./subfolder2/index"); +const m21 = require("./subfolder2/another"); +const m22 = require("./subfolder2/another/"); +const m23 = require("./subfolder2/another/index"); +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; +// 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!) +const m24 = require("./"); +const m25 = require("./index"); +const m26 = require("./subfolder"); +const m27 = require("./subfolder/"); +const m28 = require("./subfolder/index"); +const m29 = require("./subfolder2"); +const m30 = require("./subfolder2/"); +const m31 = require("./subfolder2/index"); +const m32 = require("./subfolder2/another"); +const m33 = require("./subfolder2/another/"); +const m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// esm format file +const x = 1; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +const m1 = require("./index.js"); +const m2 = require("./index.mjs"); +const m3 = require("./index.cjs"); +const m4 = require("./subfolder/index.js"); +const m5 = require("./subfolder/index.mjs"); +const m6 = require("./subfolder/index.cjs"); +const m7 = require("./subfolder2/index.js"); +const m8 = require("./subfolder2/index.mjs"); +const m9 = require("./subfolder2/index.cjs"); +const m10 = require("./subfolder2/another/index.js"); +const m11 = require("./subfolder2/another/index.mjs"); +const m12 = require("./subfolder2/another/index.cjs"); +// The next ones shouldn't all work - esm format files have no index resolution or extension resolution +const m13 = require("./"); +const m14 = require("./index"); +const m15 = require("./subfolder"); +const m16 = require("./subfolder/"); +const m17 = require("./subfolder/index"); +const m18 = require("./subfolder2"); +const m19 = require("./subfolder2/"); +const m20 = require("./subfolder2/index"); +const m21 = require("./subfolder2/another"); +const m22 = require("./subfolder2/another/"); +const m23 = require("./subfolder2/another/index"); +void m1; +void m2; +void m3; +void m4; +void m5; +void m6; +void m7; +void m8; +void m9; +void m10; +void m11; +void m12; +void m13; +void m14; +void m15; +void m16; +void m17; +void m18; +void m19; +void m20; +void m21; +void m22; +void m23; +// 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!) +const m24 = require("./"); +const m25 = require("./index"); +const m26 = require("./subfolder"); +const m27 = require("./subfolder/"); +const m28 = require("./subfolder/index"); +const m29 = require("./subfolder2"); +const m30 = require("./subfolder2/"); +const m31 = require("./subfolder2/index"); +const m32 = require("./subfolder2/another"); +const m33 = require("./subfolder2/another/"); +const m34 = require("./subfolder2/another/index"); +void m24; +void m25; +void m26; +void m27; +void m28; +void m29; +void m30; +void m31; +void m32; +void m33; +void m34; +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +const _m36 = import("./index"); +const _m37 = import("./subfolder"); +const _m38 = import("./subfolder/"); +const _m39 = import("./subfolder/index"); +const _m40 = import("./subfolder2"); +const _m41 = import("./subfolder2/"); +const _m42 = import("./subfolder2/index"); +const _m43 = import("./subfolder2/another"); +const _m44 = import("./subfolder2/another/"); +const _m45 = import("./subfolder2/another/index"); +// esm format file +const x = 1; +exports.x = x; + + +//// [index.d.ts] +export const x: 1; +//// [index.d.cts] +export const x: 1; +//// [index.d.mts] +export const x: 1; +//// [index.d.ts] +export const x: 1; +//// [index.d.cts] +export const x: 1; +//// [index.d.mts] +export const x: 1; +//// [index.d.ts] +export const x: 1; +//// [index.d.cts] +export const x: 1; +//// [index.d.mts] +export const x: 1; +//// [index.d.cts] +export const x: 1; +//// [index.d.mts] +export const x: 1; +//// [index.d.ts] +export const x: 1; diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols new file mode 100644 index 0000000000000..eb2533cdf8e1d --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols @@ -0,0 +1,831 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts] //// + +=== subfolder/index.js === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.js, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + +=== subfolder/index.cjs === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cjs, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.cjs, 2, 8)) + +=== subfolder/index.mjs === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mjs, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.mjs, 2, 8)) + +=== subfolder2/index.js === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.js, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + +=== subfolder2/index.cjs === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cjs, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.cjs, 2, 8)) + +=== subfolder2/index.mjs === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mjs, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.mjs, 2, 8)) + +=== subfolder2/another/index.js === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.js, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + +=== subfolder2/another/index.cjs === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cjs, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.cjs, 2, 8)) + +=== subfolder2/another/index.mjs === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mjs, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.mjs, 2, 8)) + +=== index.js === +import * as m1 from "./index.js"; +>m1 : Symbol(m1, Decl(index.js, 0, 6)) + +import * as m2 from "./index.mjs"; +>m2 : Symbol(m2, Decl(index.js, 1, 6)) + +import * as m3 from "./index.cjs"; +>m3 : Symbol(m3, Decl(index.js, 2, 6)) + +import * as m4 from "./subfolder/index.js"; +>m4 : Symbol(m4, Decl(index.js, 3, 6)) + +import * as m5 from "./subfolder/index.mjs"; +>m5 : Symbol(m5, Decl(index.js, 4, 6)) + +import * as m6 from "./subfolder/index.cjs"; +>m6 : Symbol(m6, Decl(index.js, 5, 6)) + +import * as m7 from "./subfolder2/index.js"; +>m7 : Symbol(m7, Decl(index.js, 6, 6)) + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : Symbol(m8, Decl(index.js, 7, 6)) + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : Symbol(m9, Decl(index.js, 8, 6)) + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : Symbol(m10, Decl(index.js, 9, 6)) + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : Symbol(m11, Decl(index.js, 10, 6)) + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : Symbol(m12, Decl(index.js, 11, 6)) + +// The next ones shouldn't all work - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : Symbol(m13, Decl(index.js, 13, 6)) + +import * as m14 from "./index"; +>m14 : Symbol(m14, Decl(index.js, 14, 6)) + +import * as m15 from "./subfolder"; +>m15 : Symbol(m15, Decl(index.js, 15, 6)) + +import * as m16 from "./subfolder/"; +>m16 : Symbol(m16, Decl(index.js, 16, 6)) + +import * as m17 from "./subfolder/index"; +>m17 : Symbol(m17, Decl(index.js, 17, 6)) + +import * as m18 from "./subfolder2"; +>m18 : Symbol(m18, Decl(index.js, 18, 6)) + +import * as m19 from "./subfolder2/"; +>m19 : Symbol(m19, Decl(index.js, 19, 6)) + +import * as m20 from "./subfolder2/index"; +>m20 : Symbol(m20, Decl(index.js, 20, 6)) + +import * as m21 from "./subfolder2/another"; +>m21 : Symbol(m21, Decl(index.js, 21, 6)) + +import * as m22 from "./subfolder2/another/"; +>m22 : Symbol(m22, Decl(index.js, 22, 6)) + +import * as m23 from "./subfolder2/another/index"; +>m23 : Symbol(m23, Decl(index.js, 23, 6)) + +void m1; +>m1 : Symbol(m1, Decl(index.js, 0, 6)) + +void m2; +>m2 : Symbol(m2, Decl(index.js, 1, 6)) + +void m3; +>m3 : Symbol(m3, Decl(index.js, 2, 6)) + +void m4; +>m4 : Symbol(m4, Decl(index.js, 3, 6)) + +void m5; +>m5 : Symbol(m5, Decl(index.js, 4, 6)) + +void m6; +>m6 : Symbol(m6, Decl(index.js, 5, 6)) + +void m7; +>m7 : Symbol(m7, Decl(index.js, 6, 6)) + +void m8; +>m8 : Symbol(m8, Decl(index.js, 7, 6)) + +void m9; +>m9 : Symbol(m9, Decl(index.js, 8, 6)) + +void m10; +>m10 : Symbol(m10, Decl(index.js, 9, 6)) + +void m11; +>m11 : Symbol(m11, Decl(index.js, 10, 6)) + +void m12; +>m12 : Symbol(m12, Decl(index.js, 11, 6)) + +void m13; +>m13 : Symbol(m13, Decl(index.js, 13, 6)) + +void m14; +>m14 : Symbol(m14, Decl(index.js, 14, 6)) + +void m15; +>m15 : Symbol(m15, Decl(index.js, 15, 6)) + +void m16; +>m16 : Symbol(m16, Decl(index.js, 16, 6)) + +void m17; +>m17 : Symbol(m17, Decl(index.js, 17, 6)) + +void m18; +>m18 : Symbol(m18, Decl(index.js, 18, 6)) + +void m19; +>m19 : Symbol(m19, Decl(index.js, 19, 6)) + +void m20; +>m20 : Symbol(m20, Decl(index.js, 20, 6)) + +void m21; +>m21 : Symbol(m21, Decl(index.js, 21, 6)) + +void m22; +>m22 : Symbol(m22, Decl(index.js, 22, 6)) + +void m23; +>m23 : Symbol(m23, Decl(index.js, 23, 6)) + +// 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("./"); +>m24 : Symbol(m24, Decl(index.js, 46, 9)) + +import m25 = require("./index"); +>m25 : Symbol(m25, Decl(index.js, 49, 27)) + +import m26 = require("./subfolder"); +>m26 : Symbol(m26, Decl(index.js, 50, 32)) + +import m27 = require("./subfolder/"); +>m27 : Symbol(m27, Decl(index.js, 51, 36)) + +import m28 = require("./subfolder/index"); +>m28 : Symbol(m28, Decl(index.js, 52, 37)) + +import m29 = require("./subfolder2"); +>m29 : Symbol(m29, Decl(index.js, 53, 42)) + +import m30 = require("./subfolder2/"); +>m30 : Symbol(m30, Decl(index.js, 54, 37)) + +import m31 = require("./subfolder2/index"); +>m31 : Symbol(m31, Decl(index.js, 55, 38)) + +import m32 = require("./subfolder2/another"); +>m32 : Symbol(m32, Decl(index.js, 56, 43)) + +import m33 = require("./subfolder2/another/"); +>m33 : Symbol(m33, Decl(index.js, 57, 45)) + +import m34 = require("./subfolder2/another/index"); +>m34 : Symbol(m34, Decl(index.js, 58, 46)) + +void m24; +>m24 : Symbol(m24, Decl(index.js, 46, 9)) + +void m25; +>m25 : Symbol(m25, Decl(index.js, 49, 27)) + +void m26; +>m26 : Symbol(m26, Decl(index.js, 50, 32)) + +void m27; +>m27 : Symbol(m27, Decl(index.js, 51, 36)) + +void m28; +>m28 : Symbol(m28, Decl(index.js, 52, 37)) + +void m29; +>m29 : Symbol(m29, Decl(index.js, 53, 42)) + +void m30; +>m30 : Symbol(m30, Decl(index.js, 54, 37)) + +void m31; +>m31 : Symbol(m31, Decl(index.js, 55, 38)) + +void m32; +>m32 : Symbol(m32, Decl(index.js, 56, 43)) + +void m33; +>m33 : Symbol(m33, Decl(index.js, 57, 45)) + +void m34; +>m34 : Symbol(m34, Decl(index.js, 58, 46)) + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Symbol(_m35, Decl(index.js, 73, 5)) + +const _m36 = import("./index"); +>_m36 : Symbol(_m36, Decl(index.js, 74, 5)) +>"./index" : Symbol(m1, Decl(index.js, 0, 0)) + +const _m37 = import("./subfolder"); +>_m37 : Symbol(_m37, Decl(index.js, 75, 5)) + +const _m38 = import("./subfolder/"); +>_m38 : Symbol(_m38, Decl(index.js, 76, 5)) + +const _m39 = import("./subfolder/index"); +>_m39 : Symbol(_m39, Decl(index.js, 77, 5)) +>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) + +const _m40 = import("./subfolder2"); +>_m40 : Symbol(_m40, Decl(index.js, 78, 5)) + +const _m41 = import("./subfolder2/"); +>_m41 : Symbol(_m41, Decl(index.js, 79, 5)) + +const _m42 = import("./subfolder2/index"); +>_m42 : Symbol(_m42, Decl(index.js, 80, 5)) +>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) + +const _m43 = import("./subfolder2/another"); +>_m43 : Symbol(_m43, Decl(index.js, 81, 5)) + +const _m44 = import("./subfolder2/another/"); +>_m44 : Symbol(_m44, Decl(index.js, 82, 5)) + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Symbol(_m45, Decl(index.js, 83, 5)) +>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) + +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.js, 85, 5)) + +export {x}; +>x : Symbol(m1.x, Decl(index.js, 86, 8)) + +=== index.cjs === +// ESM-format imports below should issue errors +import * as m1 from "./index.js"; +>m1 : Symbol(m1, Decl(index.cjs, 1, 6)) + +import * as m2 from "./index.mjs"; +>m2 : Symbol(m2, Decl(index.cjs, 2, 6)) + +import * as m3 from "./index.cjs"; +>m3 : Symbol(m3, Decl(index.cjs, 3, 6)) + +import * as m4 from "./subfolder/index.js"; +>m4 : Symbol(m4, Decl(index.cjs, 4, 6)) + +import * as m5 from "./subfolder/index.mjs"; +>m5 : Symbol(m5, Decl(index.cjs, 5, 6)) + +import * as m6 from "./subfolder/index.cjs"; +>m6 : Symbol(m6, Decl(index.cjs, 6, 6)) + +import * as m7 from "./subfolder2/index.js"; +>m7 : Symbol(m7, Decl(index.cjs, 7, 6)) + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : Symbol(m8, Decl(index.cjs, 8, 6)) + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : Symbol(m9, Decl(index.cjs, 9, 6)) + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : Symbol(m10, Decl(index.cjs, 10, 6)) + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : Symbol(m11, Decl(index.cjs, 11, 6)) + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : Symbol(m12, Decl(index.cjs, 12, 6)) + +// 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 "./"; +>m13 : Symbol(m13, Decl(index.cjs, 14, 6)) + +import * as m14 from "./index"; +>m14 : Symbol(m14, Decl(index.cjs, 15, 6)) + +import * as m15 from "./subfolder"; +>m15 : Symbol(m15, Decl(index.cjs, 16, 6)) + +import * as m16 from "./subfolder/"; +>m16 : Symbol(m16, Decl(index.cjs, 17, 6)) + +import * as m17 from "./subfolder/index"; +>m17 : Symbol(m17, Decl(index.cjs, 18, 6)) + +import * as m18 from "./subfolder2"; +>m18 : Symbol(m18, Decl(index.cjs, 19, 6)) + +import * as m19 from "./subfolder2/"; +>m19 : Symbol(m19, Decl(index.cjs, 20, 6)) + +import * as m20 from "./subfolder2/index"; +>m20 : Symbol(m20, Decl(index.cjs, 21, 6)) + +import * as m21 from "./subfolder2/another"; +>m21 : Symbol(m21, Decl(index.cjs, 22, 6)) + +import * as m22 from "./subfolder2/another/"; +>m22 : Symbol(m22, Decl(index.cjs, 23, 6)) + +import * as m23 from "./subfolder2/another/index"; +>m23 : Symbol(m23, Decl(index.cjs, 24, 6)) + +void m1; +>m1 : Symbol(m1, Decl(index.cjs, 1, 6)) + +void m2; +>m2 : Symbol(m2, Decl(index.cjs, 2, 6)) + +void m3; +>m3 : Symbol(m3, Decl(index.cjs, 3, 6)) + +void m4; +>m4 : Symbol(m4, Decl(index.cjs, 4, 6)) + +void m5; +>m5 : Symbol(m5, Decl(index.cjs, 5, 6)) + +void m6; +>m6 : Symbol(m6, Decl(index.cjs, 6, 6)) + +void m7; +>m7 : Symbol(m7, Decl(index.cjs, 7, 6)) + +void m8; +>m8 : Symbol(m8, Decl(index.cjs, 8, 6)) + +void m9; +>m9 : Symbol(m9, Decl(index.cjs, 9, 6)) + +void m10; +>m10 : Symbol(m10, Decl(index.cjs, 10, 6)) + +void m11; +>m11 : Symbol(m11, Decl(index.cjs, 11, 6)) + +void m12; +>m12 : Symbol(m12, Decl(index.cjs, 12, 6)) + +void m13; +>m13 : Symbol(m13, Decl(index.cjs, 14, 6)) + +void m14; +>m14 : Symbol(m14, Decl(index.cjs, 15, 6)) + +void m15; +>m15 : Symbol(m15, Decl(index.cjs, 16, 6)) + +void m16; +>m16 : Symbol(m16, Decl(index.cjs, 17, 6)) + +void m17; +>m17 : Symbol(m17, Decl(index.cjs, 18, 6)) + +void m18; +>m18 : Symbol(m18, Decl(index.cjs, 19, 6)) + +void m19; +>m19 : Symbol(m19, Decl(index.cjs, 20, 6)) + +void m20; +>m20 : Symbol(m20, Decl(index.cjs, 21, 6)) + +void m21; +>m21 : Symbol(m21, Decl(index.cjs, 22, 6)) + +void m22; +>m22 : Symbol(m22, Decl(index.cjs, 23, 6)) + +void m23; +>m23 : Symbol(m23, Decl(index.cjs, 24, 6)) + +// 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("./"); +>m24 : Symbol(m24, Decl(index.cjs, 47, 9)) + +import m25 = require("./index"); +>m25 : Symbol(m25, Decl(index.cjs, 50, 27)) + +import m26 = require("./subfolder"); +>m26 : Symbol(m26, Decl(index.cjs, 51, 32)) + +import m27 = require("./subfolder/"); +>m27 : Symbol(m27, Decl(index.cjs, 52, 36)) + +import m28 = require("./subfolder/index"); +>m28 : Symbol(m28, Decl(index.cjs, 53, 37)) + +import m29 = require("./subfolder2"); +>m29 : Symbol(m29, Decl(index.cjs, 54, 42)) + +import m30 = require("./subfolder2/"); +>m30 : Symbol(m30, Decl(index.cjs, 55, 37)) + +import m31 = require("./subfolder2/index"); +>m31 : Symbol(m31, Decl(index.cjs, 56, 38)) + +import m32 = require("./subfolder2/another"); +>m32 : Symbol(m32, Decl(index.cjs, 57, 43)) + +import m33 = require("./subfolder2/another/"); +>m33 : Symbol(m33, Decl(index.cjs, 58, 45)) + +import m34 = require("./subfolder2/another/index"); +>m34 : Symbol(m34, Decl(index.cjs, 59, 46)) + +void m24; +>m24 : Symbol(m24, Decl(index.cjs, 47, 9)) + +void m25; +>m25 : Symbol(m25, Decl(index.cjs, 50, 27)) + +void m26; +>m26 : Symbol(m26, Decl(index.cjs, 51, 32)) + +void m27; +>m27 : Symbol(m27, Decl(index.cjs, 52, 36)) + +void m28; +>m28 : Symbol(m28, Decl(index.cjs, 53, 37)) + +void m29; +>m29 : Symbol(m29, Decl(index.cjs, 54, 42)) + +void m30; +>m30 : Symbol(m30, Decl(index.cjs, 55, 37)) + +void m31; +>m31 : Symbol(m31, Decl(index.cjs, 56, 38)) + +void m32; +>m32 : Symbol(m32, Decl(index.cjs, 57, 43)) + +void m33; +>m33 : Symbol(m33, Decl(index.cjs, 58, 45)) + +void m34; +>m34 : Symbol(m34, Decl(index.cjs, 59, 46)) + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Symbol(_m35, Decl(index.cjs, 74, 5)) + +const _m36 = import("./index"); +>_m36 : Symbol(_m36, Decl(index.cjs, 75, 5)) +>"./index" : Symbol(m1, Decl(index.js, 0, 0)) + +const _m37 = import("./subfolder"); +>_m37 : Symbol(_m37, Decl(index.cjs, 76, 5)) + +const _m38 = import("./subfolder/"); +>_m38 : Symbol(_m38, Decl(index.cjs, 77, 5)) + +const _m39 = import("./subfolder/index"); +>_m39 : Symbol(_m39, Decl(index.cjs, 78, 5)) +>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) + +const _m40 = import("./subfolder2"); +>_m40 : Symbol(_m40, Decl(index.cjs, 79, 5)) + +const _m41 = import("./subfolder2/"); +>_m41 : Symbol(_m41, Decl(index.cjs, 80, 5)) + +const _m42 = import("./subfolder2/index"); +>_m42 : Symbol(_m42, Decl(index.cjs, 81, 5)) +>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) + +const _m43 = import("./subfolder2/another"); +>_m43 : Symbol(_m43, Decl(index.cjs, 82, 5)) + +const _m44 = import("./subfolder2/another/"); +>_m44 : Symbol(_m44, Decl(index.cjs, 83, 5)) + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Symbol(_m45, Decl(index.cjs, 84, 5)) +>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) + +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.cjs, 86, 5)) + +export {x}; +>x : Symbol(m3.x, Decl(index.cjs, 87, 8)) + +=== index.mjs === +import * as m1 from "./index.js"; +>m1 : Symbol(m1, Decl(index.mjs, 0, 6)) + +import * as m2 from "./index.mjs"; +>m2 : Symbol(m2, Decl(index.mjs, 1, 6)) + +import * as m3 from "./index.cjs"; +>m3 : Symbol(m3, Decl(index.mjs, 2, 6)) + +import * as m4 from "./subfolder/index.js"; +>m4 : Symbol(m4, Decl(index.mjs, 3, 6)) + +import * as m5 from "./subfolder/index.mjs"; +>m5 : Symbol(m5, Decl(index.mjs, 4, 6)) + +import * as m6 from "./subfolder/index.cjs"; +>m6 : Symbol(m6, Decl(index.mjs, 5, 6)) + +import * as m7 from "./subfolder2/index.js"; +>m7 : Symbol(m7, Decl(index.mjs, 6, 6)) + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : Symbol(m8, Decl(index.mjs, 7, 6)) + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : Symbol(m9, Decl(index.mjs, 8, 6)) + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : Symbol(m10, Decl(index.mjs, 9, 6)) + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : Symbol(m11, Decl(index.mjs, 10, 6)) + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : Symbol(m12, Decl(index.mjs, 11, 6)) + +// The next ones should all fail - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : Symbol(m13, Decl(index.mjs, 13, 6)) + +import * as m14 from "./index"; +>m14 : Symbol(m14, Decl(index.mjs, 14, 6)) + +import * as m15 from "./subfolder"; +>m15 : Symbol(m15, Decl(index.mjs, 15, 6)) + +import * as m16 from "./subfolder/"; +>m16 : Symbol(m16, Decl(index.mjs, 16, 6)) + +import * as m17 from "./subfolder/index"; +>m17 : Symbol(m17, Decl(index.mjs, 17, 6)) + +import * as m18 from "./subfolder2"; +>m18 : Symbol(m18, Decl(index.mjs, 18, 6)) + +import * as m19 from "./subfolder2/"; +>m19 : Symbol(m19, Decl(index.mjs, 19, 6)) + +import * as m20 from "./subfolder2/index"; +>m20 : Symbol(m20, Decl(index.mjs, 20, 6)) + +import * as m21 from "./subfolder2/another"; +>m21 : Symbol(m21, Decl(index.mjs, 21, 6)) + +import * as m22 from "./subfolder2/another/"; +>m22 : Symbol(m22, Decl(index.mjs, 22, 6)) + +import * as m23 from "./subfolder2/another/index"; +>m23 : Symbol(m23, Decl(index.mjs, 23, 6)) + +void m1; +>m1 : Symbol(m1, Decl(index.mjs, 0, 6)) + +void m2; +>m2 : Symbol(m2, Decl(index.mjs, 1, 6)) + +void m3; +>m3 : Symbol(m3, Decl(index.mjs, 2, 6)) + +void m4; +>m4 : Symbol(m4, Decl(index.mjs, 3, 6)) + +void m5; +>m5 : Symbol(m5, Decl(index.mjs, 4, 6)) + +void m6; +>m6 : Symbol(m6, Decl(index.mjs, 5, 6)) + +void m7; +>m7 : Symbol(m7, Decl(index.mjs, 6, 6)) + +void m8; +>m8 : Symbol(m8, Decl(index.mjs, 7, 6)) + +void m9; +>m9 : Symbol(m9, Decl(index.mjs, 8, 6)) + +void m10; +>m10 : Symbol(m10, Decl(index.mjs, 9, 6)) + +void m11; +>m11 : Symbol(m11, Decl(index.mjs, 10, 6)) + +void m12; +>m12 : Symbol(m12, Decl(index.mjs, 11, 6)) + +void m13; +>m13 : Symbol(m13, Decl(index.mjs, 13, 6)) + +void m14; +>m14 : Symbol(m14, Decl(index.mjs, 14, 6)) + +void m15; +>m15 : Symbol(m15, Decl(index.mjs, 15, 6)) + +void m16; +>m16 : Symbol(m16, Decl(index.mjs, 16, 6)) + +void m17; +>m17 : Symbol(m17, Decl(index.mjs, 17, 6)) + +void m18; +>m18 : Symbol(m18, Decl(index.mjs, 18, 6)) + +void m19; +>m19 : Symbol(m19, Decl(index.mjs, 19, 6)) + +void m20; +>m20 : Symbol(m20, Decl(index.mjs, 20, 6)) + +void m21; +>m21 : Symbol(m21, Decl(index.mjs, 21, 6)) + +void m22; +>m22 : Symbol(m22, Decl(index.mjs, 22, 6)) + +void m23; +>m23 : Symbol(m23, Decl(index.mjs, 23, 6)) + +// 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("./"); +>m24 : Symbol(m24, Decl(index.mjs, 46, 9)) + +import m25 = require("./index"); +>m25 : Symbol(m25, Decl(index.mjs, 49, 27)) + +import m26 = require("./subfolder"); +>m26 : Symbol(m26, Decl(index.mjs, 50, 32)) + +import m27 = require("./subfolder/"); +>m27 : Symbol(m27, Decl(index.mjs, 51, 36)) + +import m28 = require("./subfolder/index"); +>m28 : Symbol(m28, Decl(index.mjs, 52, 37)) + +import m29 = require("./subfolder2"); +>m29 : Symbol(m29, Decl(index.mjs, 53, 42)) + +import m30 = require("./subfolder2/"); +>m30 : Symbol(m30, Decl(index.mjs, 54, 37)) + +import m31 = require("./subfolder2/index"); +>m31 : Symbol(m31, Decl(index.mjs, 55, 38)) + +import m32 = require("./subfolder2/another"); +>m32 : Symbol(m32, Decl(index.mjs, 56, 43)) + +import m33 = require("./subfolder2/another/"); +>m33 : Symbol(m33, Decl(index.mjs, 57, 45)) + +import m34 = require("./subfolder2/another/index"); +>m34 : Symbol(m34, Decl(index.mjs, 58, 46)) + +void m24; +>m24 : Symbol(m24, Decl(index.mjs, 46, 9)) + +void m25; +>m25 : Symbol(m25, Decl(index.mjs, 49, 27)) + +void m26; +>m26 : Symbol(m26, Decl(index.mjs, 50, 32)) + +void m27; +>m27 : Symbol(m27, Decl(index.mjs, 51, 36)) + +void m28; +>m28 : Symbol(m28, Decl(index.mjs, 52, 37)) + +void m29; +>m29 : Symbol(m29, Decl(index.mjs, 53, 42)) + +void m30; +>m30 : Symbol(m30, Decl(index.mjs, 54, 37)) + +void m31; +>m31 : Symbol(m31, Decl(index.mjs, 55, 38)) + +void m32; +>m32 : Symbol(m32, Decl(index.mjs, 56, 43)) + +void m33; +>m33 : Symbol(m33, Decl(index.mjs, 57, 45)) + +void m34; +>m34 : Symbol(m34, Decl(index.mjs, 58, 46)) + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Symbol(_m35, Decl(index.mjs, 73, 5)) + +const _m36 = import("./index"); +>_m36 : Symbol(_m36, Decl(index.mjs, 74, 5)) +>"./index" : Symbol(m1, Decl(index.js, 0, 0)) + +const _m37 = import("./subfolder"); +>_m37 : Symbol(_m37, Decl(index.mjs, 75, 5)) + +const _m38 = import("./subfolder/"); +>_m38 : Symbol(_m38, Decl(index.mjs, 76, 5)) + +const _m39 = import("./subfolder/index"); +>_m39 : Symbol(_m39, Decl(index.mjs, 77, 5)) +>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) + +const _m40 = import("./subfolder2"); +>_m40 : Symbol(_m40, Decl(index.mjs, 78, 5)) + +const _m41 = import("./subfolder2/"); +>_m41 : Symbol(_m41, Decl(index.mjs, 79, 5)) + +const _m42 = import("./subfolder2/index"); +>_m42 : Symbol(_m42, Decl(index.mjs, 80, 5)) +>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) + +const _m43 = import("./subfolder2/another"); +>_m43 : Symbol(_m43, Decl(index.mjs, 81, 5)) + +const _m44 = import("./subfolder2/another/"); +>_m44 : Symbol(_m44, Decl(index.mjs, 82, 5)) + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Symbol(_m45, Decl(index.mjs, 83, 5)) +>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) + +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.mjs, 86, 5)) + +export {x}; +>x : Symbol(m2.x, Decl(index.mjs, 87, 8)) + diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types new file mode 100644 index 0000000000000..15420c10fe1e8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types @@ -0,0 +1,1440 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts] //// + +=== subfolder/index.js === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder/index.cjs === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder/index.mjs === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/index.js === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/index.cjs === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/index.mjs === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/another/index.js === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/another/index.cjs === +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== subfolder2/another/index.mjs === +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== index.js === +import * as m1 from "./index.js"; +>m1 : typeof m1 +> : ^^^^^^^^^ + +import * as m2 from "./index.mjs"; +>m2 : typeof m2 +> : ^^^^^^^^^ + +import * as m3 from "./index.cjs"; +>m3 : typeof m3 +> : ^^^^^^^^^ + +import * as m4 from "./subfolder/index.js"; +>m4 : typeof m4 +> : ^^^^^^^^^ + +import * as m5 from "./subfolder/index.mjs"; +>m5 : typeof m5 +> : ^^^^^^^^^ + +import * as m6 from "./subfolder/index.cjs"; +>m6 : typeof m6 +> : ^^^^^^^^^ + +import * as m7 from "./subfolder2/index.js"; +>m7 : typeof m7 +> : ^^^^^^^^^ + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : typeof m8 +> : ^^^^^^^^^ + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : typeof m9 +> : ^^^^^^^^^ + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : typeof m10 +> : ^^^^^^^^^^ + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : typeof m11 +> : ^^^^^^^^^^ + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : typeof m12 +> : ^^^^^^^^^^ + +// The next ones shouldn't all work - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : any +> : ^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : typeof m10 +> : ^^^^^^^^^^ + +void m1; +>void m1 : undefined +> : ^^^^^^^^^ +>m1 : typeof m1 +> : ^^^^^^^^^ + +void m2; +>void m2 : undefined +> : ^^^^^^^^^ +>m2 : typeof m2 +> : ^^^^^^^^^ + +void m3; +>void m3 : undefined +> : ^^^^^^^^^ +>m3 : typeof m3 +> : ^^^^^^^^^ + +void m4; +>void m4 : undefined +> : ^^^^^^^^^ +>m4 : typeof m4 +> : ^^^^^^^^^ + +void m5; +>void m5 : undefined +> : ^^^^^^^^^ +>m5 : typeof m5 +> : ^^^^^^^^^ + +void m6; +>void m6 : undefined +> : ^^^^^^^^^ +>m6 : typeof m6 +> : ^^^^^^^^^ + +void m7; +>void m7 : undefined +> : ^^^^^^^^^ +>m7 : typeof m7 +> : ^^^^^^^^^ + +void m8; +>void m8 : undefined +> : ^^^^^^^^^ +>m8 : typeof m8 +> : ^^^^^^^^^ + +void m9; +>void m9 : undefined +> : ^^^^^^^^^ +>m9 : typeof m9 +> : ^^^^^^^^^ + +void m10; +>void m10 : undefined +> : ^^^^^^^^^ +>m10 : typeof m10 +> : ^^^^^^^^^^ + +void m11; +>void m11 : undefined +> : ^^^^^^^^^ +>m11 : typeof m11 +> : ^^^^^^^^^^ + +void m12; +>void m12 : undefined +> : ^^^^^^^^^ +>m12 : typeof m12 +> : ^^^^^^^^^^ + +void m13; +>void m13 : undefined +> : ^^^^^^^^^ +>m13 : any +> : ^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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("./"); +>m24 : any +> : ^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : any +> : ^^^ + +import m27 = require("./subfolder/"); +>m27 : any +> : ^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : any +> : ^^^ + +import m30 = require("./subfolder2/"); +>m30 : any +> : ^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : any +> : ^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : any +> : ^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : any +> : ^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : any +> : ^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : any +> : ^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : any +> : ^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : any +> : ^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : any +> : ^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : any +> : ^^^ + +void m34; +>void m34 : undefined +> : ^^^^^^^^^ +>m34 : typeof m10 +> : ^^^^^^^^^^ + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Promise +> : ^^^^^^^^^^^^ +>import("./") : Promise +> : ^^^^^^^^^^^^ +>"./" : "./" +> : ^^^^ + +const _m36 = import("./index"); +>_m36 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./index" : "./index" +> : ^^^^^^^^^ + +const _m37 = import("./subfolder"); +>_m37 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder" : "./subfolder" +> : ^^^^^^^^^^^^^ + +const _m38 = import("./subfolder/"); +>_m38 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder/" : "./subfolder/" +> : ^^^^^^^^^^^^^^ + +const _m39 = import("./subfolder/index"); +>_m39 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder/index" : "./subfolder/index" +> : ^^^^^^^^^^^^^^^^^^^ + +const _m40 = import("./subfolder2"); +>_m40 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2" : "./subfolder2" +> : ^^^^^^^^^^^^^^ + +const _m41 = import("./subfolder2/"); +>_m41 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/" : "./subfolder2/" +> : ^^^^^^^^^^^^^^^ + +const _m42 = import("./subfolder2/index"); +>_m42 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder2/index" : "./subfolder2/index" +> : ^^^^^^^^^^^^^^^^^^^^ + +const _m43 = import("./subfolder2/another"); +>_m43 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another" : "./subfolder2/another" +> : ^^^^^^^^^^^^^^^^^^^^^^ + +const _m44 = import("./subfolder2/another/"); +>_m44 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another/" : "./subfolder2/another/" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/another/index") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./subfolder2/another/index" : "./subfolder2/another/index" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== index.cjs === +// ESM-format imports below should issue errors +import * as m1 from "./index.js"; +>m1 : typeof m1 +> : ^^^^^^^^^ + +import * as m2 from "./index.mjs"; +>m2 : typeof m2 +> : ^^^^^^^^^ + +import * as m3 from "./index.cjs"; +>m3 : typeof m3 +> : ^^^^^^^^^ + +import * as m4 from "./subfolder/index.js"; +>m4 : typeof m4 +> : ^^^^^^^^^ + +import * as m5 from "./subfolder/index.mjs"; +>m5 : typeof m5 +> : ^^^^^^^^^ + +import * as m6 from "./subfolder/index.cjs"; +>m6 : typeof m6 +> : ^^^^^^^^^ + +import * as m7 from "./subfolder2/index.js"; +>m7 : typeof m7 +> : ^^^^^^^^^ + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : typeof m8 +> : ^^^^^^^^^ + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : typeof m9 +> : ^^^^^^^^^ + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : typeof m10 +> : ^^^^^^^^^^ + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : typeof m11 +> : ^^^^^^^^^^ + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : typeof m12 +> : ^^^^^^^^^^ + +// 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 "./"; +>m13 : any +> : ^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : typeof m10 +> : ^^^^^^^^^^ + +void m1; +>void m1 : undefined +> : ^^^^^^^^^ +>m1 : typeof m1 +> : ^^^^^^^^^ + +void m2; +>void m2 : undefined +> : ^^^^^^^^^ +>m2 : typeof m2 +> : ^^^^^^^^^ + +void m3; +>void m3 : undefined +> : ^^^^^^^^^ +>m3 : typeof m3 +> : ^^^^^^^^^ + +void m4; +>void m4 : undefined +> : ^^^^^^^^^ +>m4 : typeof m4 +> : ^^^^^^^^^ + +void m5; +>void m5 : undefined +> : ^^^^^^^^^ +>m5 : typeof m5 +> : ^^^^^^^^^ + +void m6; +>void m6 : undefined +> : ^^^^^^^^^ +>m6 : typeof m6 +> : ^^^^^^^^^ + +void m7; +>void m7 : undefined +> : ^^^^^^^^^ +>m7 : typeof m7 +> : ^^^^^^^^^ + +void m8; +>void m8 : undefined +> : ^^^^^^^^^ +>m8 : typeof m8 +> : ^^^^^^^^^ + +void m9; +>void m9 : undefined +> : ^^^^^^^^^ +>m9 : typeof m9 +> : ^^^^^^^^^ + +void m10; +>void m10 : undefined +> : ^^^^^^^^^ +>m10 : typeof m10 +> : ^^^^^^^^^^ + +void m11; +>void m11 : undefined +> : ^^^^^^^^^ +>m11 : typeof m11 +> : ^^^^^^^^^^ + +void m12; +>void m12 : undefined +> : ^^^^^^^^^ +>m12 : typeof m12 +> : ^^^^^^^^^^ + +void m13; +>void m13 : undefined +> : ^^^^^^^^^ +>m13 : any +> : ^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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("./"); +>m24 : any +> : ^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : any +> : ^^^ + +import m27 = require("./subfolder/"); +>m27 : any +> : ^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : any +> : ^^^ + +import m30 = require("./subfolder2/"); +>m30 : any +> : ^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : any +> : ^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : any +> : ^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : any +> : ^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : any +> : ^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : any +> : ^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : any +> : ^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : any +> : ^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : any +> : ^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : any +> : ^^^ + +void m34; +>void m34 : undefined +> : ^^^^^^^^^ +>m34 : typeof m10 +> : ^^^^^^^^^^ + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Promise +> : ^^^^^^^^^^^^ +>import("./") : Promise +> : ^^^^^^^^^^^^ +>"./" : "./" +> : ^^^^ + +const _m36 = import("./index"); +>_m36 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./index" : "./index" +> : ^^^^^^^^^ + +const _m37 = import("./subfolder"); +>_m37 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder" : "./subfolder" +> : ^^^^^^^^^^^^^ + +const _m38 = import("./subfolder/"); +>_m38 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder/" : "./subfolder/" +> : ^^^^^^^^^^^^^^ + +const _m39 = import("./subfolder/index"); +>_m39 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder/index" : "./subfolder/index" +> : ^^^^^^^^^^^^^^^^^^^ + +const _m40 = import("./subfolder2"); +>_m40 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2" : "./subfolder2" +> : ^^^^^^^^^^^^^^ + +const _m41 = import("./subfolder2/"); +>_m41 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/" : "./subfolder2/" +> : ^^^^^^^^^^^^^^^ + +const _m42 = import("./subfolder2/index"); +>_m42 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder2/index" : "./subfolder2/index" +> : ^^^^^^^^^^^^^^^^^^^^ + +const _m43 = import("./subfolder2/another"); +>_m43 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another" : "./subfolder2/another" +> : ^^^^^^^^^^^^^^^^^^^^^^ + +const _m44 = import("./subfolder2/another/"); +>_m44 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another/" : "./subfolder2/another/" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/another/index") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./subfolder2/another/index" : "./subfolder2/another/index" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +// cjs format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +=== index.mjs === +import * as m1 from "./index.js"; +>m1 : typeof m1 +> : ^^^^^^^^^ + +import * as m2 from "./index.mjs"; +>m2 : typeof m2 +> : ^^^^^^^^^ + +import * as m3 from "./index.cjs"; +>m3 : typeof m3 +> : ^^^^^^^^^ + +import * as m4 from "./subfolder/index.js"; +>m4 : typeof m4 +> : ^^^^^^^^^ + +import * as m5 from "./subfolder/index.mjs"; +>m5 : typeof m5 +> : ^^^^^^^^^ + +import * as m6 from "./subfolder/index.cjs"; +>m6 : typeof m6 +> : ^^^^^^^^^ + +import * as m7 from "./subfolder2/index.js"; +>m7 : typeof m7 +> : ^^^^^^^^^ + +import * as m8 from "./subfolder2/index.mjs"; +>m8 : typeof m8 +> : ^^^^^^^^^ + +import * as m9 from "./subfolder2/index.cjs"; +>m9 : typeof m9 +> : ^^^^^^^^^ + +import * as m10 from "./subfolder2/another/index.js"; +>m10 : typeof m10 +> : ^^^^^^^^^^ + +import * as m11 from "./subfolder2/another/index.mjs"; +>m11 : typeof m11 +> : ^^^^^^^^^^ + +import * as m12 from "./subfolder2/another/index.cjs"; +>m12 : typeof m12 +> : ^^^^^^^^^^ + +// The next ones should all fail - esm format files have no index resolution or extension resolution +import * as m13 from "./"; +>m13 : any +> : ^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : typeof m10 +> : ^^^^^^^^^^ + +void m1; +>void m1 : undefined +> : ^^^^^^^^^ +>m1 : typeof m1 +> : ^^^^^^^^^ + +void m2; +>void m2 : undefined +> : ^^^^^^^^^ +>m2 : typeof m2 +> : ^^^^^^^^^ + +void m3; +>void m3 : undefined +> : ^^^^^^^^^ +>m3 : typeof m3 +> : ^^^^^^^^^ + +void m4; +>void m4 : undefined +> : ^^^^^^^^^ +>m4 : typeof m4 +> : ^^^^^^^^^ + +void m5; +>void m5 : undefined +> : ^^^^^^^^^ +>m5 : typeof m5 +> : ^^^^^^^^^ + +void m6; +>void m6 : undefined +> : ^^^^^^^^^ +>m6 : typeof m6 +> : ^^^^^^^^^ + +void m7; +>void m7 : undefined +> : ^^^^^^^^^ +>m7 : typeof m7 +> : ^^^^^^^^^ + +void m8; +>void m8 : undefined +> : ^^^^^^^^^ +>m8 : typeof m8 +> : ^^^^^^^^^ + +void m9; +>void m9 : undefined +> : ^^^^^^^^^ +>m9 : typeof m9 +> : ^^^^^^^^^ + +void m10; +>void m10 : undefined +> : ^^^^^^^^^ +>m10 : typeof m10 +> : ^^^^^^^^^^ + +void m11; +>void m11 : undefined +> : ^^^^^^^^^ +>m11 : typeof m11 +> : ^^^^^^^^^^ + +void m12; +>void m12 : undefined +> : ^^^^^^^^^ +>m12 : typeof m12 +> : ^^^^^^^^^^ + +void m13; +>void m13 : undefined +> : ^^^^^^^^^ +>m13 : any +> : ^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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("./"); +>m24 : any +> : ^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : any +> : ^^^ + +import m27 = require("./subfolder/"); +>m27 : any +> : ^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : any +> : ^^^ + +import m30 = require("./subfolder2/"); +>m30 : any +> : ^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : any +> : ^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : any +> : ^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : any +> : ^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : any +> : ^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : any +> : ^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : any +> : ^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : any +> : ^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : any +> : ^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : any +> : ^^^ + +void m34; +>void m34 : undefined +> : ^^^^^^^^^ +>m34 : typeof m10 +> : ^^^^^^^^^^ + +// These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution +const _m35 = import("./"); +>_m35 : Promise +> : ^^^^^^^^^^^^ +>import("./") : Promise +> : ^^^^^^^^^^^^ +>"./" : "./" +> : ^^^^ + +const _m36 = import("./index"); +>_m36 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./index" : "./index" +> : ^^^^^^^^^ + +const _m37 = import("./subfolder"); +>_m37 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder" : "./subfolder" +> : ^^^^^^^^^^^^^ + +const _m38 = import("./subfolder/"); +>_m38 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder/" : "./subfolder/" +> : ^^^^^^^^^^^^^^ + +const _m39 = import("./subfolder/index"); +>_m39 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder/index" : "./subfolder/index" +> : ^^^^^^^^^^^^^^^^^^^ + +const _m40 = import("./subfolder2"); +>_m40 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2" : "./subfolder2" +> : ^^^^^^^^^^^^^^ + +const _m41 = import("./subfolder2/"); +>_m41 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/" : "./subfolder2/" +> : ^^^^^^^^^^^^^^^ + +const _m42 = import("./subfolder2/index"); +>_m42 : Promise +> : ^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^^^^^^^ +>"./subfolder2/index" : "./subfolder2/index" +> : ^^^^^^^^^^^^^^^^^^^^ + +const _m43 = import("./subfolder2/another"); +>_m43 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another" : "./subfolder2/another" +> : ^^^^^^^^^^^^^^^^^^^^^^ + +const _m44 = import("./subfolder2/another/"); +>_m44 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/another/") : Promise +> : ^^^^^^^^^^^^ +>"./subfolder2/another/" : "./subfolder2/another/" +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +const _m45 = import("./subfolder2/another/index"); +>_m45 : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>import("./subfolder2/another/index") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./subfolder2/another/index" : "./subfolder2/another/index" +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +// esm format file +const x = 1; +>x : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt new file mode 100644 index 0000000000000..41929261d778f --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt @@ -0,0 +1,12 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== foo.cjs (0 errors) ==== + exports.foo = "foo" +==== bar.ts (1 errors) ==== + import foo from "./foo.cjs" + ~~~ +!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? + foo.foo; \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols new file mode 100644 index 0000000000000..823a7964f337e --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts] //// + +=== foo.cjs === +exports.foo = "foo" +>exports.foo : Symbol(foo, Decl(foo.cjs, 0, 0)) +>exports : Symbol(foo, Decl(foo.cjs, 0, 0)) +>foo : Symbol(foo, Decl(foo.cjs, 0, 0)) + +=== bar.ts === +import foo from "./foo.cjs" +>foo : Symbol(foo, Decl(bar.ts, 0, 6)) + +foo.foo; +>foo : Symbol(foo, Decl(bar.ts, 0, 6)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types new file mode 100644 index 0000000000000..e56fb703b18d2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts] //// + +=== foo.cjs === +exports.foo = "foo" +>exports.foo = "foo" : "foo" +> : ^^^^^ +>exports.foo : "foo" +> : ^^^^^ +>exports : typeof import("foo") +> : ^^^^^^^^^^^^^^^^^^^^ +>foo : "foo" +> : ^^^^^ +>"foo" : "foo" +> : ^^^^^ + +=== bar.ts === +import foo from "./foo.cjs" +>foo : any +> : ^^^ + +foo.foo; +>foo.foo : any +> : ^^^ +>foo : any +> : ^^^ +>foo : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt new file mode 100644 index 0000000000000..5398523e2bcdc --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -0,0 +1,224 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (7 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi.mjsSource; + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; +==== index.mjs (7 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi.mjsSource; + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; +==== index.cjs (7 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi.cjsSource; + mjsi.cjsSource; + typei.implicitCjsSource; + ts.cjsSource; +==== node_modules/inner/index.d.ts (4 errors) ==== + // cjs format file + import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; + export { ts }; + export const implicitCjsSource = true; +==== node_modules/inner/index.d.mts (4 errors) ==== + // esm format file + import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; + export { ts }; + export const mjsSource = true; +==== node_modules/inner/index.d.cts (4 errors) ==== + // cjs format file + import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; + export { ts }; + export const cjsSource = 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": { + "./a": { + "require": "./index.cjs", + "node": "./index.mjs" + }, + "./b": { + "import": "./index.mjs", + "node": "./index.cjs" + }, + ".": { + "import": "./index.mjs", + "node": "./index.js" + }, + "./types": { + "types": { + "import": "./index.d.mts", + "require": "./index.d.cts", + }, + "node": { + "import": "./index.mjs", + "require": "./index.cjs" + } + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js new file mode 100644 index 0000000000000..7090dc9eb4a60 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js @@ -0,0 +1,186 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts] //// + +//// [index.js] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.mjs] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.cjsSource; +mjsi.cjsSource; +typei.implicitCjsSource; +ts.cjsSource; +//// [index.d.ts] +// cjs format file +import * as cjs from "inner/a"; +import * as mjs from "inner/b"; +import * as type from "inner"; +import * as ts from "inner/types"; +export { cjs }; +export { mjs }; +export { type }; +export { ts }; +export const implicitCjsSource = true; +//// [index.d.mts] +// esm format file +import * as cjs from "inner/a"; +import * as mjs from "inner/b"; +import * as type from "inner"; +import * as ts from "inner/types"; +export { cjs }; +export { mjs }; +export { type }; +export { ts }; +export const mjsSource = true; +//// [index.d.cts] +// cjs format file +import * as cjs from "inner/a"; +import * as mjs from "inner/b"; +import * as type from "inner"; +import * as ts from "inner/types"; +export { cjs }; +export { mjs }; +export { type }; +export { ts }; +export const cjsSource = true; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./a": { + "require": "./index.cjs", + "node": "./index.mjs" + }, + "./b": { + "import": "./index.mjs", + "node": "./index.cjs" + }, + ".": { + "import": "./index.mjs", + "node": "./index.js" + }, + "./types": { + "types": { + "import": "./index.d.mts", + "require": "./index.d.cts", + }, + "node": { + "import": "./index.mjs", + "require": "./index.cjs" + } + } + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/a"); +const mjsi = require("inner/b"); +const typei = require("inner"); +const ts = require("inner/types"); +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/a"); +const mjsi = require("inner/b"); +const typei = require("inner"); +const ts = require("inner/types"); +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/a"); +const mjsi = require("inner/b"); +const typei = require("inner"); +const ts = require("inner/types"); +cjsi.cjsSource; +mjsi.cjsSource; +typei.implicitCjsSource; +ts.cjsSource; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols new file mode 100644 index 0000000000000..cabaaecaec289 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols @@ -0,0 +1,221 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts] //// + +=== index.js === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.js, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.js, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.js, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.js, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.js, 2, 6)) + +type; +>type : Symbol(type, Decl(index.js, 3, 6)) + +import * as cjsi from "inner/a"; +>cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) + +import * as mjsi from "inner/b"; +>mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.js, 9, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.js, 10, 6)) + +cjsi.mjsSource; +>cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) + +mjsi.mjsSource; +>mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) + +typei.mjsSource; +>typei : Symbol(typei, Decl(index.js, 9, 6)) + +ts.mjsSource; +>ts : Symbol(ts, Decl(index.js, 10, 6)) + +=== index.mjs === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.mjs, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.mjs, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.mjs, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.mjs, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.mjs, 2, 6)) + +type; +>type : Symbol(type, Decl(index.mjs, 3, 6)) + +import * as cjsi from "inner/a"; +>cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) + +import * as mjsi from "inner/b"; +>mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.mjs, 9, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.mjs, 10, 6)) + +cjsi.mjsSource; +>cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) + +mjsi.mjsSource; +>mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) + +typei.mjsSource; +>typei : Symbol(typei, Decl(index.mjs, 9, 6)) + +ts.mjsSource; +>ts : Symbol(ts, Decl(index.mjs, 10, 6)) + +=== index.cjs === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.cjs, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.cjs, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.cjs, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.cjs, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.cjs, 2, 6)) + +type; +>type : Symbol(type, Decl(index.cjs, 3, 6)) + +import * as cjsi from "inner/a"; +>cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) + +import * as mjsi from "inner/b"; +>mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.cjs, 9, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.cjs, 10, 6)) + +cjsi.cjsSource; +>cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) + +mjsi.cjsSource; +>mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) + +typei.implicitCjsSource; +>typei : Symbol(typei, Decl(index.cjs, 9, 6)) + +ts.cjsSource; +>ts : Symbol(ts, Decl(index.cjs, 10, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/b"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.d.ts, 4, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 7, 8)) + +export { ts }; +>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) + +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/a"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/b"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.d.mts, 4, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 6, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 7, 8)) + +export { ts }; +>ts : Symbol(ts, Decl(index.d.mts, 8, 8)) + +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/b"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.d.cts, 4, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 6, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 7, 8)) + +export { ts }; +>ts : Symbol(ts, Decl(index.d.cts, 8, 8)) + +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types new file mode 100644 index 0000000000000..afec0a932a933 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types @@ -0,0 +1,344 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts] //// + +=== index.js === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/a"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/b"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : any +> : ^^^ +>cjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : any +> : ^^^ +>mjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +typei.mjsSource; +>typei.mjsSource : any +> : ^^^ +>typei : any +> : ^^^ +>mjsSource : any +> : ^^^ + +ts.mjsSource; +>ts.mjsSource : any +> : ^^^ +>ts : any +> : ^^^ +>mjsSource : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/a"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/b"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : any +> : ^^^ +>cjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : any +> : ^^^ +>mjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +typei.mjsSource; +>typei.mjsSource : any +> : ^^^ +>typei : any +> : ^^^ +>mjsSource : any +> : ^^^ + +ts.mjsSource; +>ts.mjsSource : any +> : ^^^ +>ts : any +> : ^^^ +>mjsSource : any +> : ^^^ + +=== index.cjs === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/a"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/b"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +cjsi.cjsSource; +>cjsi.cjsSource : any +> : ^^^ +>cjsi : any +> : ^^^ +>cjsSource : any +> : ^^^ + +mjsi.cjsSource; +>mjsi.cjsSource : any +> : ^^^ +>mjsi : any +> : ^^^ +>cjsSource : any +> : ^^^ + +typei.implicitCjsSource; +>typei.implicitCjsSource : any +> : ^^^ +>typei : any +> : ^^^ +>implicitCjsSource : any +> : ^^^ + +ts.cjsSource; +>ts.cjsSource : any +> : ^^^ +>ts : any +> : ^^^ +>cjsSource : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +export { ts }; +>ts : any +> : ^^^ + +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +export { ts }; +>ts : any +> : ^^^ + +export const mjsSource = true; +>mjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +export { ts }; +>ts : any +> : ^^^ + +export const cjsSource = true; +>cjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt new file mode 100644 index 0000000000000..ddd61ba43b672 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt @@ -0,0 +1,26 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (0 errors) ==== + // cjs format file + export async function main() { + const { readFile } = await import("fs"); + } +==== index.js (0 errors) ==== + // esm format file + export async function main() { + const { readFile } = await import("fs"); + } +==== 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/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js new file mode 100644 index 0000000000000..8214d98c428a7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts] //// + +//// [index.js] +// cjs format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [index.js] +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = main; +// cjs format file +async function main() { + const { readFile } = await import("fs"); +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = main; +// esm format file +async function main() { + const { readFile } = await import("fs"); +} + + +//// [index.d.ts] +export function main(): Promise; +//// [index.d.ts] +export function main(): Promise; diff --git a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).symbols new file mode 100644 index 0000000000000..eabf1117f687d --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts] //// + +=== subfolder/index.js === +// cjs format file +export async function main() { +>main : Symbol(main, Decl(index.js, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.js, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== index.js === +// esm format file +export async function main() { +>main : Symbol(main, Decl(index.js, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.js, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types new file mode 100644 index 0000000000000..fd7e480880512 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts] //// + +=== subfolder/index.js === +// cjs format file +export async function main() { +>main : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const { readFile } = await import("fs"); +>readFile : any +> : ^^^ +>await import("fs") : any +> : ^^^ +>import("fs") : Promise +> : ^^^^^^^^^^^^ +>"fs" : "fs" +> : ^^^^ +} +=== index.js === +// esm format file +export async function main() { +>main : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const { readFile } = await import("fs"); +>readFile : any +> : ^^^ +>await import("fs") : any +> : ^^^ +>import("fs") : Promise +> : ^^^^^^^^^^^^ +>"fs" : "fs" +> : ^^^^ +} +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt new file mode 100644 index 0000000000000..ec30d1cf8adc7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt @@ -0,0 +1,46 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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. +index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. +subfolder/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(3,1): error TS8003: 'export =' can only be used in TypeScript files. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (2 errors) ==== + // cjs 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. +==== 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. + ~~~~~~~~~~~ +!!! error TS8003: 'export =' can only be used in TypeScript files. +==== 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 diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js new file mode 100644 index 0000000000000..738816e9d16d2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js @@ -0,0 +1,65 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts] //// + +//// [index.js] +// cjs format file +const a = {}; +export = a; +//// [file.js] +// cjs format file +const a = {}; +module.exports = a; +//// [index.js] +// esm format file +const a = {}; +export = a; +//// [file.js] +// esm format file +import "fs"; +const a = {}; +module.exports = a; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +// cjs format file +const a = {}; +module.exports = a; +//// [file.js] +"use strict"; +// cjs format file +const a = {}; +module.exports = a; +//// [index.js] +"use strict"; +// esm format file +const a = {}; +module.exports = a; +//// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +require("fs"); +const a = {}; +module.exports = a; + + +//// [index.d.ts] +export = a; +declare const a: {}; +//// [file.d.ts] +export = a; +declare const a: {}; +//// [index.d.ts] +export = a; +declare const a: {}; +//// [file.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).symbols new file mode 100644 index 0000000000000..0e6aa57c8289b --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).symbols @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts] //// + +=== subfolder/index.js === +// cjs format file +const a = {}; +>a : Symbol(a, Decl(index.js, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.js, 1, 5)) + +=== subfolder/file.js === +// cjs format file +const a = {}; +>a : Symbol(a, Decl(file.js, 1, 5)) + +module.exports = a; +>module.exports : Symbol(module.exports, Decl(file.js, 0, 0)) +>module : Symbol(export=, Decl(file.js, 1, 13)) +>exports : Symbol(export=, Decl(file.js, 1, 13)) +>a : Symbol(a, Decl(file.js, 1, 5)) + +=== index.js === +// esm format file +const a = {}; +>a : Symbol(a, Decl(index.js, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.js, 1, 5)) + +=== file.js === +// esm format file +import "fs"; +const a = {}; +>a : Symbol(a, Decl(file.js, 2, 5)) + +module.exports = a; +>a : Symbol(a, Decl(file.js, 2, 5)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).types new file mode 100644 index 0000000000000..b860b335a2df8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts] //// + +=== subfolder/index.js === +// cjs format file +const a = {}; +>a : {} +> : ^^ +>{} : {} +> : ^^ + +export = a; +>a : {} +> : ^^ + +=== subfolder/file.js === +// cjs format file +const a = {}; +>a : {} +> : ^^ +>{} : {} +> : ^^ + +module.exports = a; +>module.exports = a : {} +> : ^^ +>module.exports : {} +> : ^^ +>module : { exports: {}; } +> : ^^^^^^^^^^^^^^^^ +>exports : {} +> : ^^ +>a : {} +> : ^^ + +=== index.js === +// esm format file +const a = {}; +>a : {} +> : ^^ +>{} : {} +> : ^^ + +export = a; +>a : {} +> : ^^ + +=== file.js === +// esm format file +import "fs"; +const a = {}; +>a : {} +> : ^^ +>{} : {} +> : ^^ + +module.exports = a; +>module.exports = a : any +> : ^^^ +>module.exports : any +> : ^^^ +>module : any +> : ^^^ +>exports : any +> : ^^^ +>a : {} +> : ^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt new file mode 100644 index 0000000000000..ef2cf1fb69bed --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt @@ -0,0 +1,8 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== foo.cjs (0 errors) ==== + // this file is a module despite having no imports +==== bar.js (0 errors) ==== + // however this file is _not_ a module \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).js new file mode 100644 index 0000000000000..e3ca6368e77fb --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts] //// + +//// [foo.cjs] +// this file is a module despite having no imports +//// [bar.js] +// however this file is _not_ a module + +//// [foo.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// this file is a module despite having no imports +//// [bar.js] +// however this file is _not_ a module diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).symbols new file mode 100644 index 0000000000000..38a5ad1bc4e01 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts] //// + +=== foo.cjs === + +// this file is a module despite having no imports +=== bar.js === + +// however this file is _not_ a module diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).types new file mode 100644 index 0000000000000..38a5ad1bc4e01 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).types @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts] //// + +=== foo.cjs === + +// this file is a module despite having no imports +=== bar.js === + +// however this file is _not_ a module diff --git a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt new file mode 100644 index 0000000000000..1c5d02077e80c --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (0 errors) ==== + // cjs format file + function require() {} + const exports = {}; + class Object {} + export const __esModule = false; + export {require, exports, Object}; +==== index.js (0 errors) ==== + // esm format file + function require() {} + const exports = {}; + class Object {} + export const __esModule = false; + export {require, exports, Object}; +==== 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/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js new file mode 100644 index 0000000000000..63bc1238be293 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts] //// + +//// [index.js] +// cjs format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [index.js] +// esm format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = exports.exports = exports.__esModule = void 0; +exports.require = require; +// cjs format file +function require() { } +const exports = {}; +exports.exports = exports; +class Object { +} +exports.Object = Object; +exports.__esModule = false; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = exports.exports = exports.__esModule = void 0; +exports.require = require; +// esm format file +function require() { } +const exports = {}; +exports.exports = exports; +class Object { +} +exports.Object = Object; +exports.__esModule = false; + + +//// [index.d.ts] +export const __esModule: false; +export function require(): void; +export const exports: {}; +export class Object { +} +//// [index.d.ts] +export const __esModule: false; +export function require(): void; +export const exports: {}; +export class Object { +} diff --git a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).symbols new file mode 100644 index 0000000000000..f68efe37918e7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).symbols @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts] //// + +=== subfolder/index.js === +// cjs format file +function require() {} +>require : Symbol(require, Decl(index.js, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.js, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.js, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.js, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.js, 5, 8)) +>exports : Symbol(exports, Decl(index.js, 5, 16)) +>Object : Symbol(Object, Decl(index.js, 5, 25)) + +=== index.js === +// esm format file +function require() {} +>require : Symbol(require, Decl(index.js, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.js, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.js, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.js, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.js, 5, 8)) +>exports : Symbol(exports, Decl(index.js, 5, 16)) +>Object : Symbol(Object, Decl(index.js, 5, 25)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).types new file mode 100644 index 0000000000000..fd07e237a77db --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).types @@ -0,0 +1,62 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts] //// + +=== subfolder/index.js === +// cjs format file +function require() {} +>require : () => void +> : ^^^^^^^^^^ + +const exports = {}; +>exports : {} +> : ^^ +>{} : {} +> : ^^ + +class Object {} +>Object : Object +> : ^^^^^^ + +export const __esModule = false; +>__esModule : false +> : ^^^^^ +>false : false +> : ^^^^^ + +export {require, exports, Object}; +>require : () => void +> : ^^^^^^^^^^ +>exports : {} +> : ^^ +>Object : typeof Object +> : ^^^^^^^^^^^^^ + +=== index.js === +// esm format file +function require() {} +>require : () => void +> : ^^^^^^^^^^ + +const exports = {}; +>exports : {} +> : ^^ +>{} : {} +> : ^^ + +class Object {} +>Object : Object +> : ^^^^^^ + +export const __esModule = false; +>__esModule : false +> : ^^^^^ +>false : false +> : ^^^^^ + +export {require, exports, Object}; +>require : () => void +> : ^^^^^^^^^^ +>exports : {} +> : ^^ +>Object : typeof Object +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt new file mode 100644 index 0000000000000..fa7517650f495 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt @@ -0,0 +1,51 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +file.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. +file.js(6,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. +subfolder/index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. +subfolder/index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (2 errors) ==== + // cjs format file + import fs = require("fs"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + fs.readFile; + export import fs2 = require("fs"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. +==== index.js (2 errors) ==== + // esm format file + import fs = require("fs"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + fs.readFile; + export import fs2 = require("fs"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. +==== file.js (2 errors) ==== + // esm format file + const __require = null; + const _createRequire = null; + import fs = require("fs"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + fs.readFile; + export import fs2 = require("fs"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. +==== 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/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js new file mode 100644 index 0000000000000..b7f92cf813f02 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts] //// + +//// [index.js] +// cjs format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [index.js] +// esm format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [file.js] +// esm format file +const __require = null; +const _createRequire = null; +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); +//// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const __require = null; +const _createRequire = null; +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); + + +//// [index.d.ts] +import fs2 = require("fs"); +//// [index.d.ts] +import fs2 = require("fs"); +//// [file.d.ts] +import fs2 = require("fs"); diff --git a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).symbols new file mode 100644 index 0000000000000..6ceddec39de76 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).symbols @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts] //// + +=== subfolder/index.js === +// cjs format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.js, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.js, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.js, 2, 12)) + +=== index.js === +// esm format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.js, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.js, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.js, 2, 12)) + +=== file.js === +// esm format file +const __require = null; +>__require : Symbol(__require, Decl(file.js, 1, 5)) + +const _createRequire = null; +>_createRequire : Symbol(_createRequire, Decl(file.js, 2, 5)) + +import fs = require("fs"); +>fs : Symbol(fs, Decl(file.js, 2, 28)) + +fs.readFile; +>fs : Symbol(fs, Decl(file.js, 2, 28)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(file.js, 4, 12)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).types new file mode 100644 index 0000000000000..daea59c9155d4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).types @@ -0,0 +1,69 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts] //// + +=== subfolder/index.js === +// cjs format file +import fs = require("fs"); +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +export import fs2 = require("fs"); +>fs2 : any +> : ^^^ + +=== index.js === +// esm format file +import fs = require("fs"); +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +export import fs2 = require("fs"); +>fs2 : any +> : ^^^ + +=== file.js === +// esm format file +const __require = null; +>__require : any +> : ^^^ + +const _createRequire = null; +>_createRequire : any +> : ^^^ + +import fs = require("fs"); +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +export import fs2 = require("fs"); +>fs2 : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt new file mode 100644 index 0000000000000..e7cfe79e31a52 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt @@ -0,0 +1,32 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (0 errors) ==== + // cjs format file + import {default as _fs} from "fs"; + _fs.readFile; + import * as fs from "fs"; + fs.readFile; +==== index.js (0 errors) ==== + // esm format file + import {default as _fs} from "fs"; + _fs.readFile; + import * as fs from "fs"; + fs.readFile; +==== 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"; + declare module "tslib" { + export {}; + // intentionally missing all helpers + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js new file mode 100644 index 0000000000000..1210148c3a7b9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js @@ -0,0 +1,53 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts] //// + +//// [index.js] +// cjs format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [index.js] +// esm format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const fs_1 = require("fs"); +fs_1.default.readFile; +const fs = require("fs"); +fs.readFile; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const fs_1 = require("fs"); +fs_1.default.readFile; +const fs = require("fs"); +fs.readFile; + + +//// [index.d.ts] +export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).symbols new file mode 100644 index 0000000000000..223fb64bb63dd --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).symbols @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts] //// + +=== subfolder/index.js === +// cjs format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.js, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.js, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.js, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.js, 3, 6)) + +=== index.js === +// esm format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.js, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.js, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.js, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.js, 3, 6)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).types new file mode 100644 index 0000000000000..b9184a9515937 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).types @@ -0,0 +1,70 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts] //// + +=== subfolder/index.js === +// cjs format file +import {default as _fs} from "fs"; +>default : any +> : ^^^ +>_fs : any +> : ^^^ + +_fs.readFile; +>_fs.readFile : any +> : ^^^ +>_fs : any +> : ^^^ +>readFile : any +> : ^^^ + +import * as fs from "fs"; +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +=== index.js === +// esm format file +import {default as _fs} from "fs"; +>default : any +> : ^^^ +>_fs : any +> : ^^^ + +_fs.readFile; +>_fs.readFile : any +> : ^^^ +>_fs : any +> : ^^^ +>readFile : any +> : ^^^ + +import * as fs from "fs"; +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + +declare module "tslib" { +>"tslib" : typeof import("tslib") +> : ^^^^^^^^^^^^^^^^^^^^^^ + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt new file mode 100644 index 0000000000000..85fba739c6b44 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + export * from "fs"; + export * as fs from "fs"; +==== index.js (0 errors) ==== + // esm format file + export * from "fs"; + export * as fs from "fs"; +==== 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"; + declare module "tslib" { + export {}; + // intentionally missing all helpers + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js new file mode 100644 index 0000000000000..bc79f13e7fa21 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js @@ -0,0 +1,77 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts] //// + +//// [index.ts] +// cjs format file +export * from "fs"; +export * as fs from "fs"; +//// [index.js] +// esm format file +export * from "fs"; +export * as fs from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +// cjs format file +__exportStar(require("fs"), exports); +exports.fs = require("fs"); +//// [index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +// esm format file +__exportStar(require("fs"), exports); +exports.fs = require("fs"); + + +//// [index.d.ts] +export * from "fs"; +export * as fs from "fs"; +//// [index.d.ts] +export * from "fs"; +export * as fs from "fs"; diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).symbols new file mode 100644 index 0000000000000..f8442eecea2a9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts] //// + +=== subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== index.js === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.js, 2, 6)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).types new file mode 100644 index 0000000000000..f27b3f021b897 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).types @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts] //// + +=== subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : any +> : ^^^ + +=== index.js === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + +declare module "tslib" { +>"tslib" : typeof import("tslib") +> : ^^^^^^^^^^^^^^^^^^^^^^ + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt new file mode 100644 index 0000000000000..ee0f262effc3c --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt @@ -0,0 +1,30 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.js (0 errors) ==== + // cjs format file + export {default} from "fs"; + export {default as foo} from "fs"; + export {bar as baz} from "fs"; +==== index.js (0 errors) ==== + // esm format file + export {default} from "fs"; + export {default as foo} from "fs"; + export {bar as baz} from "fs"; +==== 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"; + declare module "tslib" { + export {}; + // intentionally missing all helpers + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js new file mode 100644 index 0000000000000..4a6f4b906ee92 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js @@ -0,0 +1,57 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts] //// + +//// [index.js] +// cjs format file +export {default} from "fs"; +export {default as foo} from "fs"; +export {bar as baz} from "fs"; +//// [index.js] +// esm format file +export {default} from "fs"; +export {default as foo} from "fs"; +export {bar as baz} from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.baz = exports.foo = exports.default = void 0; +// cjs format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +var fs_2 = require("fs"); +Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); +var fs_3 = require("fs"); +Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.baz = exports.foo = exports.default = void 0; +// esm format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +var fs_2 = require("fs"); +Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); +var fs_3 = require("fs"); +Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); + + +//// [index.d.ts] +export { default, default as foo, bar as baz } from "fs"; +//// [index.d.ts] +export { default, default as foo, bar as baz } from "fs"; diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).symbols new file mode 100644 index 0000000000000..ac8f12eb28526 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).symbols @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts] //// + +=== subfolder/index.js === +// cjs format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.js, 1, 8)) + +export {default as foo} from "fs"; +>default : Symbol("fs", Decl(types.d.ts, 0, 0)) +>foo : Symbol(foo, Decl(index.js, 2, 8)) + +export {bar as baz} from "fs"; +>bar : Symbol("fs", Decl(types.d.ts, 0, 0)) +>baz : Symbol(baz, Decl(index.js, 3, 8)) + +=== index.js === +// esm format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.js, 1, 8)) + +export {default as foo} from "fs"; +>default : Symbol("fs", Decl(types.d.ts, 0, 0)) +>foo : Symbol(foo, Decl(index.js, 2, 8)) + +export {bar as baz} from "fs"; +>bar : Symbol("fs", Decl(types.d.ts, 0, 0)) +>baz : Symbol(baz, Decl(index.js, 3, 8)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).types new file mode 100644 index 0000000000000..f610358647cd1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).types @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts] //// + +=== subfolder/index.js === +// cjs format file +export {default} from "fs"; +>default : any +> : ^^^ + +export {default as foo} from "fs"; +>default : any +> : ^^^ +>foo : any +> : ^^^ + +export {bar as baz} from "fs"; +>bar : any +> : ^^^ +>baz : any +> : ^^^ + +=== index.js === +// esm format file +export {default} from "fs"; +>default : any +> : ^^^ + +export {default as foo} from "fs"; +>default : any +> : ^^^ +>foo : any +> : ^^^ + +export {bar as baz} from "fs"; +>bar : any +> : ^^^ +>baz : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + +declare module "tslib" { +>"tslib" : typeof import("tslib") +> : ^^^^^^^^^^^^^^^^^^^^^^ + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt new file mode 100644 index 0000000000000..a7955aad00341 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== 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 (1 errors) ==== + // esm 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}; +==== 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/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js new file mode 100644 index 0000000000000..e2ef275a52a12 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts] //// + +//// [index.js] +// cjs format file +const x = import.meta.url; +export {x}; +//// [index.js] +// esm format file +const x = import.meta.url; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = import.meta.url; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = import.meta.url; +exports.x = x; + + +//// [index.d.ts] +export const x: string; +//// [index.d.ts] +export const x: string; diff --git a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).symbols new file mode 100644 index 0000000000000..b5fd6d2a740db --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts] //// + +=== subfolder/index.js === +// cjs format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.js, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(ImportMetaExpression.meta) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + +=== index.js === +// esm format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.js, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(ImportMetaExpression.meta) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).types new file mode 100644 index 0000000000000..c4fb0b6d2595f --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).types @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts] //// + +=== subfolder/index.js === +// cjs format file +const x = import.meta.url; +>x : string +> : ^^^^^^ +>import.meta.url : string +> : ^^^^^^ +>import.meta : ImportMeta +> : ^^^^^^^^^^ +>meta : ImportMeta +> : ^^^^^^^^^^ +>url : string +> : ^^^^^^ + +export {x}; +>x : string +> : ^^^^^^ + +=== index.js === +// esm format file +const x = import.meta.url; +>x : string +> : ^^^^^^ +>import.meta.url : string +> : ^^^^^^ +>import.meta : ImportMeta +> : ^^^^^^^^^^ +>meta : ImportMeta +> : ^^^^^^^^^^ +>url : string +> : ^^^^^^ + +export {x}; +>x : string +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt new file mode 100644 index 0000000000000..eb90cf53bdb1a --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -0,0 +1,172 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (6 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mjs (6 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cjs (6 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js new file mode 100644 index 0000000000000..05f5e0949ee77 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js @@ -0,0 +1,146 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts] //// + +//// [index.js] +// 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] +// 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] +// 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; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols new file mode 100644 index 0000000000000..4da1db5bae890 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols @@ -0,0 +1,176 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts] //// + +=== index.js === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.js, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.js, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.js, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.js, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.js, 2, 6)) + +type; +>type : Symbol(type, Decl(index.js, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.js, 9, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) + +typei; +>typei : Symbol(typei, Decl(index.js, 9, 6)) + +=== index.mjs === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.mjs, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.mjs, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.mjs, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.mjs, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.mjs, 2, 6)) + +type; +>type : Symbol(type, Decl(index.mjs, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.mjs, 9, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mjs, 9, 6)) + +=== index.cjs === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.cjs, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.cjs, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.cjs, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.cjs, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.cjs, 2, 6)) + +type; +>type : Symbol(type, Decl(index.cjs, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.cjs, 9, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cjs, 9, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types new file mode 100644 index 0000000000000..871405e728153 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types @@ -0,0 +1,230 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts] //// + +=== index.js === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cjs === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt new file mode 100644 index 0000000000000..afa529c804ad5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt @@ -0,0 +1,67 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (3 errors) ==== + // esm format file + import * as cjs from "#cjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; +==== index.mjs (3 errors) ==== + // esm format file + import * as cjs from "#cjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; +==== index.cjs (3 errors) ==== + // esm format file + import * as cjs from "#cjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js new file mode 100644 index 0000000000000..4e8df6368cca6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js @@ -0,0 +1,77 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts] //// + +//// [index.js] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; +//// [index.mjs] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; +//// [index.cjs] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js", + "imports": { + "#cjs": "./index.cjs", + "#mjs": "./index.mjs", + "#type": "./index.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("#cjs"); +const mjs = require("#mjs"); +const type = require("#type"); +cjs; +mjs; +type; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("#cjs"); +const mjs = require("#mjs"); +const type = require("#type"); +cjs; +mjs; +type; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("#cjs"); +const mjs = require("#mjs"); +const type = require("#type"); +cjs; +mjs; +type; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).symbols new file mode 100644 index 0000000000000..356904544fb5d --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).symbols @@ -0,0 +1,62 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts] //// + +=== index.js === +// esm format file +import * as cjs from "#cjs"; +>cjs : Symbol(cjs, Decl(index.js, 1, 6)) + +import * as mjs from "#mjs"; +>mjs : Symbol(mjs, Decl(index.js, 2, 6)) + +import * as type from "#type"; +>type : Symbol(type, Decl(index.js, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.js, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.js, 2, 6)) + +type; +>type : Symbol(type, Decl(index.js, 3, 6)) + +=== index.mjs === +// esm format file +import * as cjs from "#cjs"; +>cjs : Symbol(cjs, Decl(index.mjs, 1, 6)) + +import * as mjs from "#mjs"; +>mjs : Symbol(mjs, Decl(index.mjs, 2, 6)) + +import * as type from "#type"; +>type : Symbol(type, Decl(index.mjs, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.mjs, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.mjs, 2, 6)) + +type; +>type : Symbol(type, Decl(index.mjs, 3, 6)) + +=== index.cjs === +// esm format file +import * as cjs from "#cjs"; +>cjs : Symbol(cjs, Decl(index.cjs, 1, 6)) + +import * as mjs from "#mjs"; +>mjs : Symbol(mjs, Decl(index.cjs, 2, 6)) + +import * as type from "#type"; +>type : Symbol(type, Decl(index.cjs, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.cjs, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.cjs, 2, 6)) + +type; +>type : Symbol(type, Decl(index.cjs, 3, 6)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types new file mode 100644 index 0000000000000..7d87c22467c97 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts] //// + +=== index.js === +// esm format file +import * as cjs from "#cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "#mjs"; +>mjs : any +> : ^^^ + +import * as type from "#type"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as cjs from "#cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "#mjs"; +>mjs : any +> : ^^^ + +import * as type from "#type"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.cjs === +// esm format file +import * as cjs from "#cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "#mjs"; +>mjs : any +> : ^^^ + +import * as type from "#type"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt new file mode 100644 index 0000000000000..03fdafb9ecb97 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -0,0 +1,122 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mjs (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cjs (3 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js new file mode 100644 index 0000000000000..066c2c6afb461 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts] //// + +//// [index.js] +// 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] +// 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] +// 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; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module", +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./mjs/*": "./*.mjs", + "./js/*": "./*.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index"); +const mjsi = require("inner/mjs/index"); +const typei = require("inner/js/index"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index"); +const mjsi = require("inner/mjs/index"); +const typei = require("inner/js/index"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjsi = require("inner/cjs/index"); +const mjsi = require("inner/mjs/index"); +const typei = require("inner/js/index"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols new file mode 100644 index 0000000000000..98b3fb4849073 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols @@ -0,0 +1,122 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts] //// + +=== index.js === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : Symbol(cjsi, Decl(index.js, 1, 6)) + +import * as mjsi from "inner/mjs/index"; +>mjsi : Symbol(mjsi, Decl(index.js, 2, 6)) + +import * as typei from "inner/js/index"; +>typei : Symbol(typei, Decl(index.js, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.js, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.js, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.js, 3, 6)) + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : Symbol(cjsi, Decl(index.mjs, 1, 6)) + +import * as mjsi from "inner/mjs/index"; +>mjsi : Symbol(mjsi, Decl(index.mjs, 2, 6)) + +import * as typei from "inner/js/index"; +>typei : Symbol(typei, Decl(index.mjs, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mjs, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mjs, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mjs, 3, 6)) + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/index"; +>cjsi : Symbol(cjsi, Decl(index.cjs, 1, 6)) + +import * as mjsi from "inner/mjs/index"; +>mjsi : Symbol(mjsi, Decl(index.cjs, 2, 6)) + +import * as typei from "inner/js/index"; +>typei : Symbol(typei, Decl(index.cjs, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cjs, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cjs, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cjs, 3, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types new file mode 100644 index 0000000000000..8782e1209c94b --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types @@ -0,0 +1,158 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts] //// + +=== index.js === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt new file mode 100644 index 0000000000000..ee560de1ebabe --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt @@ -0,0 +1,125 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mjs (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cjs (3 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/exclude/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/exclude/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/exclude/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/exclude/*": null, + "./mjs/*": "./*.mjs", + "./mjs/exclude/*": null, + "./js/*": "./*.js", + "./js/exclude/*": null + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js new file mode 100644 index 0000000000000..6e380318eb8ce --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js @@ -0,0 +1,108 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts] //// + +//// [index.js] +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; +cjsi; +mjsi; +typei; +//// [index.mjs] +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; +cjsi; +mjsi; +typei; +//// [index.cjs] +// cjs format file +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; +cjsi; +mjsi; +typei; +//// [index.d.ts] +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +import * as mjs from "inner/mjs/exclude/index"; +import * as type from "inner/js/exclude/index"; +export { cjs }; +export { mjs }; +export { type }; +//// [index.d.mts] +// esm format file +import * as cjs from "inner/cjs/exclude/index"; +import * as mjs from "inner/mjs/exclude/index"; +import * as type from "inner/js/exclude/index"; +export { cjs }; +export { mjs }; +export { type }; +//// [index.d.cts] +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +import * as mjs from "inner/mjs/exclude/index"; +import * as type from "inner/js/exclude/index"; +export { cjs }; +export { mjs }; +export { type }; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./cjs/exclude/*": null, + "./mjs/*": "./*.mjs", + "./mjs/exclude/*": null, + "./js/*": "./*.js", + "./js/exclude/*": null + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/exclude/index"); +const mjsi = require("inner/mjs/exclude/index"); +const typei = require("inner/js/exclude/index"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/exclude/index"); +const mjsi = require("inner/mjs/exclude/index"); +const typei = require("inner/js/exclude/index"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjsi = require("inner/cjs/exclude/index"); +const mjsi = require("inner/mjs/exclude/index"); +const typei = require("inner/js/exclude/index"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).symbols new file mode 100644 index 0000000000000..53db76dc4d204 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).symbols @@ -0,0 +1,122 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts] //// + +=== index.js === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : Symbol(cjsi, Decl(index.js, 1, 6)) + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : Symbol(mjsi, Decl(index.js, 2, 6)) + +import * as typei from "inner/js/exclude/index"; +>typei : Symbol(typei, Decl(index.js, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.js, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.js, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.js, 3, 6)) + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : Symbol(cjsi, Decl(index.mjs, 1, 6)) + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : Symbol(mjsi, Decl(index.mjs, 2, 6)) + +import * as typei from "inner/js/exclude/index"; +>typei : Symbol(typei, Decl(index.mjs, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mjs, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mjs, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mjs, 3, 6)) + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : Symbol(cjsi, Decl(index.cjs, 1, 6)) + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : Symbol(mjsi, Decl(index.cjs, 2, 6)) + +import * as typei from "inner/js/exclude/index"; +>typei : Symbol(typei, Decl(index.cjs, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cjs, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cjs, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cjs, 3, 6)) + +=== node_modules/inner/exclude/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/exclude/index"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/exclude/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/exclude/index"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/exclude/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/exclude/index"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).types new file mode 100644 index 0000000000000..6e33ef99da8fd --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).types @@ -0,0 +1,158 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts] //// + +=== index.js === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/exclude/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/exclude/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/exclude/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/exclude/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/exclude/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/exclude/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/exclude/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/exclude/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/exclude/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt new file mode 100644 index 0000000000000..f2b6c5a1fdb97 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -0,0 +1,122 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cjs(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.js(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mjs(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.js (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mjs (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cjs (3 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js new file mode 100644 index 0000000000000..d269d9f4830d3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts] //// + +//// [index.js] +// 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] +// 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] +// 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; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module", +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs/*.cjs": "./*.cjs", + "./mjs/*.mjs": "./*.mjs", + "./js/*.js": "./*.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index.cjs"); +const mjsi = require("inner/mjs/index.mjs"); +const typei = require("inner/js/index.js"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index.cjs"); +const mjsi = require("inner/mjs/index.mjs"); +const typei = require("inner/js/index.js"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjsi = require("inner/cjs/index.cjs"); +const mjsi = require("inner/mjs/index.mjs"); +const typei = require("inner/js/index.js"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols new file mode 100644 index 0000000000000..8775c6fa39016 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols @@ -0,0 +1,122 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts] //// + +=== index.js === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : Symbol(cjsi, Decl(index.js, 1, 6)) + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : Symbol(mjsi, Decl(index.js, 2, 6)) + +import * as typei from "inner/js/index.js"; +>typei : Symbol(typei, Decl(index.js, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.js, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.js, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.js, 3, 6)) + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : Symbol(cjsi, Decl(index.mjs, 1, 6)) + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : Symbol(mjsi, Decl(index.mjs, 2, 6)) + +import * as typei from "inner/js/index.js"; +>typei : Symbol(typei, Decl(index.mjs, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mjs, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mjs, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mjs, 3, 6)) + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : Symbol(cjsi, Decl(index.cjs, 1, 6)) + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : Symbol(mjsi, Decl(index.cjs, 2, 6)) + +import * as typei from "inner/js/index.js"; +>typei : Symbol(typei, Decl(index.cjs, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cjs, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cjs, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cjs, 3, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/index.js"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/index.js"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/index.js"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types new file mode 100644 index 0000000000000..2f810966848df --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types @@ -0,0 +1,158 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts] //// + +=== index.js === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index.js"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index.js"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index.js"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index.js"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index.js"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index.js"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt new file mode 100644 index 0000000000000..a59232c3bc594 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt @@ -0,0 +1,48 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. +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. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== 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. + 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(); + } +==== index.js (2 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. + 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"); + 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/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js new file mode 100644 index 0000000000000..7d90a57a5ad81 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js @@ -0,0 +1,69 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts] //// + +//// [index.js] +// cjs format file +import {h} from "../index.js"; +import mod = require("../index.js"); +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] +// esm format file +import {h as _h} from "./index.js"; +import mod = require("./index.js"); +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] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.h = h; +// esm format file +const index_js_1 = require("./index.js"); +const mod = require("./index.js"); +const index_js_2 = require("./subfolder/index.js"); +const mod2 = require("./subfolder/index.js"); +async function h() { + const mod3 = await import("./index.js"); + const mod4 = await import("./subfolder/index.js"); + (0, index_js_2.f)(); +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = f; +// cjs format file +const index_js_1 = require("../index.js"); +const mod = require("../index.js"); +const index_js_2 = require("./index.js"); +const mod2 = require("./index.js"); +async function f() { + const mod3 = await import("../index.js"); + const mod4 = await import("./index.js"); + (0, index_js_1.h)(); +} + + +//// [index.d.ts] +export function h(): Promise; +//// [index.d.ts] +export function f(): Promise; diff --git a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).symbols new file mode 100644 index 0000000000000..4c498167184c4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).symbols @@ -0,0 +1,60 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts] //// + +=== subfolder/index.js === +// cjs format file +import {h} from "../index.js"; +>h : Symbol(h, Decl(index.js, 1, 8)) + +import mod = require("../index.js"); +>mod : Symbol(mod, Decl(index.js, 1, 30)) + +import {f as _f} from "./index.js"; +>f : Symbol(f, Decl(index.js, 4, 36)) +>_f : Symbol(_f, Decl(index.js, 3, 8)) + +import mod2 = require("./index.js"); +>mod2 : Symbol(mod2, Decl(index.js, 3, 35)) + +export async function f() { +>f : Symbol(f, Decl(index.js, 4, 36)) + + const mod3 = await import ("../index.js"); +>mod3 : Symbol(mod3, Decl(index.js, 6, 9)) +>"../index.js" : Symbol(mod, Decl(index.js, 0, 0)) + + const mod4 = await import ("./index.js"); +>mod4 : Symbol(mod4, Decl(index.js, 7, 9)) +>"./index.js" : Symbol(mod2, Decl(index.js, 0, 0)) + + h(); +>h : Symbol(h, Decl(index.js, 1, 8)) +} +=== index.js === +// esm format file +import {h as _h} from "./index.js"; +>h : Symbol(h, Decl(index.js, 4, 46)) +>_h : Symbol(_h, Decl(index.js, 1, 8)) + +import mod = require("./index.js"); +>mod : Symbol(mod, Decl(index.js, 1, 35)) + +import {f} from "./subfolder/index.js"; +>f : Symbol(f, Decl(index.js, 3, 8)) + +import mod2 = require("./subfolder/index.js"); +>mod2 : Symbol(mod2, Decl(index.js, 3, 39)) + +export async function h() { +>h : Symbol(h, Decl(index.js, 4, 46)) + + const mod3 = await import ("./index.js"); +>mod3 : Symbol(mod3, Decl(index.js, 6, 9)) +>"./index.js" : Symbol(mod, Decl(index.js, 0, 0)) + + const mod4 = await import ("./subfolder/index.js"); +>mod4 : Symbol(mod4, Decl(index.js, 7, 9)) +>"./subfolder/index.js" : Symbol(mod2, Decl(index.js, 0, 0)) + + f(); +>f : Symbol(f, Decl(index.js, 3, 8)) +} diff --git a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types new file mode 100644 index 0000000000000..df756555cade2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types @@ -0,0 +1,102 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts] //// + +=== subfolder/index.js === +// cjs format file +import {h} from "../index.js"; +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod = require("../index.js"); +>mod : typeof mod +> : ^^^^^^^^^^ + +import {f as _f} from "./index.js"; +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>_f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod2 = require("./index.js"); +>mod2 : typeof mod2 +> : ^^^^^^^^^^^ + +export async function f() { +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const mod3 = await import ("../index.js"); +>mod3 : typeof mod +> : ^^^^^^^^^^ +>await import ("../index.js") : typeof mod +> : ^^^^^^^^^^ +>import ("../index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"../index.js" : "../index.js" +> : ^^^^^^^^^^^^^ + + const mod4 = await import ("./index.js"); +>mod4 : typeof mod2 +> : ^^^^^^^^^^^ +>await import ("./index.js") : typeof mod2 +> : ^^^^^^^^^^^ +>import ("./index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^^ +>"./index.js" : "./index.js" +> : ^^^^^^^^^^^^ + + h(); +>h() : Promise +> : ^^^^^^^^^^^^^ +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +} +=== index.js === +// esm format file +import {h as _h} from "./index.js"; +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>_h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod = require("./index.js"); +>mod : typeof mod +> : ^^^^^^^^^^ + +import {f} from "./subfolder/index.js"; +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod2 = require("./subfolder/index.js"); +>mod2 : typeof mod2 +> : ^^^^^^^^^^^ + +export async function h() { +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const mod3 = await import ("./index.js"); +>mod3 : typeof mod +> : ^^^^^^^^^^ +>await import ("./index.js") : typeof mod +> : ^^^^^^^^^^ +>import ("./index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./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 +> : ^^^^^^^^^^^^^^^^^^^^ +>"./subfolder/index.js" : "./subfolder/index.js" +> : ^^^^^^^^^^^^^^^^^^^^^^ + + f(); +>f() : Promise +> : ^^^^^^^^^^^^^ +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt new file mode 100644 index 0000000000000..6ed5c8455eb78 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt @@ -0,0 +1,36 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== 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. + 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) ==== + // 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", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js new file mode 100644 index 0000000000000..0ef93181fc6ed --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts] //// + +//// [index.js] +// cjs format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [index.js] +// esm format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = await 1; +exports.x = x; +for await (const y of []) { } +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = await 1; +exports.x = x; +for await (const y of []) { } + + +//// [index.d.ts] +export const x: 1; +//// [index.d.ts] +export const x: 1; diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).symbols new file mode 100644 index 0000000000000..7eb982a9c7609 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts] //// + +=== subfolder/index.js === +// cjs format file +const x = await 1; +>x : Symbol(x, Decl(index.js, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.js, 3, 16)) + +=== index.js === +// esm format file +const x = await 1; +>x : Symbol(x, Decl(index.js, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.js, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.js, 3, 16)) + diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).types new file mode 100644 index 0000000000000..f3dc5e0e62a34 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).types @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts] //// + +=== subfolder/index.js === +// cjs format file +const x = await 1; +>x : 1 +> : ^ +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +for await (const y of []) {} +>y : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + +=== index.js === +// esm format file +const x = await 1; +>x : 1 +> : ^ +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +for await (const y of []) {} +>y : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt new file mode 100644 index 0000000000000..9692b5b736f78 --- /dev/null +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt @@ -0,0 +1,24 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== 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/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js new file mode 100644 index 0000000000000..b766039383966 --- /dev/null +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts] //// + +//// [index.ts] +// cjs format file +export const a = 1; +//// [index.ts] +// esm format file +import mod from "./subfolder/index.js"; +mod; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +// cjs format file +exports.a = 1; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const index_js_1 = require("./subfolder/index.js"); +index_js_1.default; + + +//// [index.d.ts] +export declare const a = 1; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).symbols b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).symbols new file mode 100644 index 0000000000000..44ba4c0a68a46 --- /dev/null +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts] //// + +=== subfolder/index.ts === +// cjs format file +export const a = 1; +>a : Symbol(a, Decl(index.ts, 1, 12)) + +=== index.ts === +// esm format file +import mod from "./subfolder/index.js"; +>mod : Symbol(mod, Decl(index.ts, 1, 6)) + +mod; +>mod : Symbol(mod, Decl(index.ts, 1, 6)) + diff --git a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types new file mode 100644 index 0000000000000..de096c908cfe0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts] //// + +=== subfolder/index.ts === +// cjs format file +export const a = 1; +>a : 1 +> : ^ +>1 : 1 +> : ^ + +=== index.ts === +// esm format file +import mod from "./subfolder/index.js"; +>mod : any +> : ^^^ + +mod; +>mod : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt new file mode 100644 index 0000000000000..cfc42c3d5013f --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -0,0 +1,224 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (7 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi.mjsSource; + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; +==== index.mts (7 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi.mjsSource; + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; +==== index.cts (7 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi.cjsSource; + mjsi.cjsSource; + typei.implicitCjsSource; + ts.cjsSource; +==== node_modules/inner/index.d.ts (4 errors) ==== + // cjs format file + import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; + export { ts }; + export const implicitCjsSource = true; +==== node_modules/inner/index.d.mts (4 errors) ==== + // esm format file + import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; + export { ts }; + export const mjsSource = true; +==== node_modules/inner/index.d.cts (4 errors) ==== + // cjs format file + import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as ts from "inner/types"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; + export { ts }; + export const cjsSource = 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": { + "./a": { + "require": "./index.cjs", + "node": "./index.mjs" + }, + "./b": { + "import": "./index.mjs", + "node": "./index.cjs" + }, + ".": { + "import": "./index.mjs", + "node": "./index.js" + }, + "./types": { + "types": { + "import": "./index.d.mts", + "require": "./index.d.cts", + }, + "node": { + "import": "./index.mjs", + "require": "./index.cjs" + } + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js new file mode 100644 index 0000000000000..7c9b662518c41 --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js @@ -0,0 +1,186 @@ +//// [tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts] //// + +//// [index.ts] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.mts] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.cts] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.cjsSource; +mjsi.cjsSource; +typei.implicitCjsSource; +ts.cjsSource; +//// [index.d.ts] +// cjs format file +import * as cjs from "inner/a"; +import * as mjs from "inner/b"; +import * as type from "inner"; +import * as ts from "inner/types"; +export { cjs }; +export { mjs }; +export { type }; +export { ts }; +export const implicitCjsSource = true; +//// [index.d.mts] +// esm format file +import * as cjs from "inner/a"; +import * as mjs from "inner/b"; +import * as type from "inner"; +import * as ts from "inner/types"; +export { cjs }; +export { mjs }; +export { type }; +export { ts }; +export const mjsSource = true; +//// [index.d.cts] +// cjs format file +import * as cjs from "inner/a"; +import * as mjs from "inner/b"; +import * as type from "inner"; +import * as ts from "inner/types"; +export { cjs }; +export { mjs }; +export { type }; +export { ts }; +export const cjsSource = true; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./a": { + "require": "./index.cjs", + "node": "./index.mjs" + }, + "./b": { + "import": "./index.mjs", + "node": "./index.cjs" + }, + ".": { + "import": "./index.mjs", + "node": "./index.js" + }, + "./types": { + "types": { + "import": "./index.d.mts", + "require": "./index.d.cts", + }, + "node": { + "import": "./index.mjs", + "require": "./index.cjs" + } + } + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/a"); +const mjsi = require("inner/b"); +const typei = require("inner"); +const ts = require("inner/types"); +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/a"); +const mjsi = require("inner/b"); +const typei = require("inner"); +const ts = require("inner/types"); +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/a"); +const mjsi = require("inner/b"); +const typei = require("inner"); +const ts = require("inner/types"); +cjsi.cjsSource; +mjsi.cjsSource; +typei.implicitCjsSource; +ts.cjsSource; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols new file mode 100644 index 0000000000000..62ae82c15d2e4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols @@ -0,0 +1,221 @@ +//// [tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +import * as cjsi from "inner/a"; +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +import * as mjsi from "inner/b"; +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.ts, 9, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.ts, 10, 6)) + +cjsi.mjsSource; +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +mjsi.mjsSource; +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +typei.mjsSource; +>typei : Symbol(typei, Decl(index.ts, 9, 6)) + +ts.mjsSource; +>ts : Symbol(ts, Decl(index.ts, 10, 6)) + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +import * as cjsi from "inner/a"; +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +import * as mjsi from "inner/b"; +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.mts, 9, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.mts, 10, 6)) + +cjsi.mjsSource; +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +mjsi.mjsSource; +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +typei.mjsSource; +>typei : Symbol(typei, Decl(index.mts, 9, 6)) + +ts.mjsSource; +>ts : Symbol(ts, Decl(index.mts, 10, 6)) + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.cts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.cts, 3, 6)) + +import * as cjsi from "inner/a"; +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +import * as mjsi from "inner/b"; +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.cts, 9, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.cts, 10, 6)) + +cjsi.cjsSource; +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +mjsi.cjsSource; +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +typei.implicitCjsSource; +>typei : Symbol(typei, Decl(index.cts, 9, 6)) + +ts.cjsSource; +>ts : Symbol(ts, Decl(index.cts, 10, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/b"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.d.ts, 4, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 7, 8)) + +export { ts }; +>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) + +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/a"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/b"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.d.mts, 4, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 6, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 7, 8)) + +export { ts }; +>ts : Symbol(ts, Decl(index.d.mts, 8, 8)) + +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/b"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +import * as ts from "inner/types"; +>ts : Symbol(ts, Decl(index.d.cts, 4, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 6, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 7, 8)) + +export { ts }; +>ts : Symbol(ts, Decl(index.d.cts, 8, 8)) + +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) + diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types new file mode 100644 index 0000000000000..2e8fe4bc82700 --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types @@ -0,0 +1,344 @@ +//// [tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/a"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/b"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : any +> : ^^^ +>cjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : any +> : ^^^ +>mjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +typei.mjsSource; +>typei.mjsSource : any +> : ^^^ +>typei : any +> : ^^^ +>mjsSource : any +> : ^^^ + +ts.mjsSource; +>ts.mjsSource : any +> : ^^^ +>ts : any +> : ^^^ +>mjsSource : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/a"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/b"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : any +> : ^^^ +>cjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : any +> : ^^^ +>mjsi : any +> : ^^^ +>mjsSource : any +> : ^^^ + +typei.mjsSource; +>typei.mjsSource : any +> : ^^^ +>typei : any +> : ^^^ +>mjsSource : any +> : ^^^ + +ts.mjsSource; +>ts.mjsSource : any +> : ^^^ +>ts : any +> : ^^^ +>mjsSource : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/a"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/b"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +cjsi.cjsSource; +>cjsi.cjsSource : any +> : ^^^ +>cjsi : any +> : ^^^ +>cjsSource : any +> : ^^^ + +mjsi.cjsSource; +>mjsi.cjsSource : any +> : ^^^ +>mjsi : any +> : ^^^ +>cjsSource : any +> : ^^^ + +typei.implicitCjsSource; +>typei.implicitCjsSource : any +> : ^^^ +>typei : any +> : ^^^ +>implicitCjsSource : any +> : ^^^ + +ts.cjsSource; +>ts.cjsSource : any +> : ^^^ +>ts : any +> : ^^^ +>cjsSource : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +export { ts }; +>ts : any +> : ^^^ + +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +export { ts }; +>ts : any +> : ^^^ + +export const mjsSource = true; +>mjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +import * as ts from "inner/types"; +>ts : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +export { ts }; +>ts : any +> : ^^^ + +export const cjsSource = true; +>cjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt new file mode 100644 index 0000000000000..8e8a5346eb6c4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt @@ -0,0 +1,184 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(5,1): error TS1036: Statements are not allowed in ambient contexts. +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (6 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = cjs; + export const b = mjs; + export const c = type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const d = cjsi; + export const e = mjsi; + export const f = typei; +==== index.mts (6 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = cjs; + export const b = mjs; + export const c = type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const d = cjsi; + export const e = mjsi; + export const f = typei; +==== index.cts (6 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = cjs; + export const b = mjs; + export const c = type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const d = cjsi; + export const e = mjsi; + export const f = typei; +==== node_modules/inner/index.d.ts (4 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + mjs; + type; + export const cjsMain = true; +==== node_modules/inner/index.d.mts (4 errors) ==== + // esm format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + mjs; + type; + export const esm = true; +==== node_modules/inner/index.d.cts (4 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + mjs; + type; + 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/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js new file mode 100644 index 0000000000000..fae2ab5dae7a8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js @@ -0,0 +1,167 @@ +//// [tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts] //// + +//// [index.ts] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; +//// [index.mts] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; +//// [index.cts] +// cjs format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; +//// [index.d.ts] +// cjs format file +import * as cjs from "inner/cjs"; +import * as mjs from "inner/mjs"; +import * as type from "inner"; +cjs; +mjs; +type; +export const cjsMain = true; +//// [index.d.mts] +// esm format file +import * as cjs from "inner/cjs"; +import * as mjs from "inner/mjs"; +import * as type from "inner"; +cjs; +mjs; +type; +export const esm = true; +//// [index.d.cts] +// cjs format file +import * as cjs from "inner/cjs"; +import * as mjs from "inner/mjs"; +import * as type from "inner"; +cjs; +mjs; +type; +export const cjsNonmain = true; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +exports.a = cjs; +exports.b = mjs; +exports.c = type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +exports.d = cjsi; +exports.e = mjsi; +exports.f = typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +exports.a = cjs; +exports.b = mjs; +exports.c = type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +exports.d = cjsi; +exports.e = mjsi; +exports.f = typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; +// cjs format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +exports.a = cjs; +exports.b = mjs; +exports.c = type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +exports.d = cjsi; +exports.e = mjsi; +exports.f = typei; + + +//// [index.d.ts] +export declare const a: any; +export declare const b: any; +export declare const c: any; +export declare const d: any; +export declare const e: any; +export declare const f: any; +//// [index.d.mts] +export declare const a: any; +export declare const b: any; +export declare const c: any; +export declare const d: any; +export declare const e: any; +export declare const f: any; +//// [index.d.cts] +export declare const a: any; +export declare const b: any; +export declare const c: any; +export declare const d: any; +export declare const e: any; +export declare const f: any; diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols new file mode 100644 index 0000000000000..2c1139d74c80b --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols @@ -0,0 +1,203 @@ +//// [tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +export const a = cjs; +>a : Symbol(a, Decl(index.ts, 4, 12)) +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +export const b = mjs; +>b : Symbol(b, Decl(index.ts, 5, 12)) +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +export const c = type; +>c : Symbol(c, Decl(index.ts, 6, 12)) +>type : Symbol(type, Decl(index.ts, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.ts, 9, 6)) + +export const d = cjsi; +>d : Symbol(d, Decl(index.ts, 10, 12)) +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +export const e = mjsi; +>e : Symbol(e, Decl(index.ts, 11, 12)) +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +export const f = typei; +>f : Symbol(f, Decl(index.ts, 12, 12)) +>typei : Symbol(typei, Decl(index.ts, 9, 6)) + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +export const a = cjs; +>a : Symbol(a, Decl(index.mts, 4, 12)) +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +export const b = mjs; +>b : Symbol(b, Decl(index.mts, 5, 12)) +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +export const c = type; +>c : Symbol(c, Decl(index.mts, 6, 12)) +>type : Symbol(type, Decl(index.mts, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.mts, 9, 6)) + +export const d = cjsi; +>d : Symbol(d, Decl(index.mts, 10, 12)) +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +export const e = mjsi; +>e : Symbol(e, Decl(index.mts, 11, 12)) +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +export const f = typei; +>f : Symbol(f, Decl(index.mts, 12, 12)) +>typei : Symbol(typei, Decl(index.mts, 9, 6)) + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.cts, 3, 6)) + +export const a = cjs; +>a : Symbol(a, Decl(index.cts, 4, 12)) +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +export const b = mjs; +>b : Symbol(b, Decl(index.cts, 5, 12)) +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +export const c = type; +>c : Symbol(c, Decl(index.cts, 6, 12)) +>type : Symbol(type, Decl(index.cts, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.cts, 9, 6)) + +export const d = cjsi; +>d : Symbol(d, Decl(index.cts, 10, 12)) +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +export const e = mjsi; +>e : Symbol(e, Decl(index.cts, 11, 12)) +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +export const f = typei; +>f : Symbol(f, Decl(index.cts, 12, 12)) +>typei : Symbol(typei, Decl(index.cts, 9, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export const cjsMain = true; +>cjsMain : Symbol(cjsMain, Decl(index.d.ts, 7, 12)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export const esm = true; +>esm : Symbol(esm, Decl(index.d.mts, 7, 12)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export const cjsNonmain = true; +>cjsNonmain : Symbol(cjsNonmain, Decl(index.d.cts, 7, 12)) + diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types new file mode 100644 index 0000000000000..25b24bedba1be --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types @@ -0,0 +1,284 @@ +//// [tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +export const a = cjs; +>a : any +> : ^^^ +>cjs : any +> : ^^^ + +export const b = mjs; +>b : any +> : ^^^ +>mjs : any +> : ^^^ + +export const c = type; +>c : any +> : ^^^ +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +export const d = cjsi; +>d : any +> : ^^^ +>cjsi : any +> : ^^^ + +export const e = mjsi; +>e : any +> : ^^^ +>mjsi : any +> : ^^^ + +export const f = typei; +>f : any +> : ^^^ +>typei : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +export const a = cjs; +>a : any +> : ^^^ +>cjs : any +> : ^^^ + +export const b = mjs; +>b : any +> : ^^^ +>mjs : any +> : ^^^ + +export const c = type; +>c : any +> : ^^^ +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +export const d = cjsi; +>d : any +> : ^^^ +>cjsi : any +> : ^^^ + +export const e = mjsi; +>e : any +> : ^^^ +>mjsi : any +> : ^^^ + +export const f = typei; +>f : any +> : ^^^ +>typei : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +export const a = cjs; +>a : any +> : ^^^ +>cjs : any +> : ^^^ + +export const b = mjs; +>b : any +> : ^^^ +>mjs : any +> : ^^^ + +export const c = type; +>c : any +> : ^^^ +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +export const d = cjsi; +>d : any +> : ^^^ +>cjsi : any +> : ^^^ + +export const e = mjsi; +>e : any +> : ^^^ +>mjsi : any +> : ^^^ + +export const f = typei; +>f : any +> : ^^^ +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +export const cjsMain = true; +>cjsMain : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +export const esm = true; +>esm : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +export const cjsNonmain = true; +>cjsNonmain : true +> : ^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt new file mode 100644 index 0000000000000..f86859a1c6931 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt @@ -0,0 +1,26 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + export async function main() { + const { readFile } = await import("fs"); + } +==== index.ts (0 errors) ==== + // esm format file + export async function main() { + const { readFile } = await import("fs"); + } +==== 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/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js new file mode 100644 index 0000000000000..bf08c0a12b4ee --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/node/nodeModulesDynamicImport.ts] //// + +//// [index.ts] +// cjs format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [index.ts] +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = main; +// cjs format file +async function main() { + const { readFile } = await import("fs"); +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = main; +// esm format file +async function main() { + const { readFile } = await import("fs"); +} + + +//// [index.d.ts] +export declare function main(): Promise; +//// [index.d.ts] +export declare function main(): Promise; diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).symbols b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).symbols new file mode 100644 index 0000000000000..ba5c96124df46 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesDynamicImport.ts] //// + +=== subfolder/index.ts === +// cjs format file +export async function main() { +>main : Symbol(main, Decl(index.ts, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.ts, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== index.ts === +// esm format file +export async function main() { +>main : Symbol(main, Decl(index.ts, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.ts, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types new file mode 100644 index 0000000000000..3e896f6a93e0e --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesDynamicImport.ts] //// + +=== subfolder/index.ts === +// cjs format file +export async function main() { +>main : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const { readFile } = await import("fs"); +>readFile : any +> : ^^^ +>await import("fs") : any +> : ^^^ +>import("fs") : Promise +> : ^^^^^^^^^^^^ +>"fs" : "fs" +> : ^^^^ +} +=== index.ts === +// esm format file +export async function main() { +>main : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const { readFile } = await import("fs"); +>readFile : any +> : ^^^ +>await import("fs") : any +> : ^^^ +>import("fs") : Promise +> : ^^^^^^^^^^^^ +>"fs" : "fs" +> : ^^^^ +} +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt new file mode 100644 index 0000000000000..31618d3c6664b --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (1 errors) ==== + // cjs 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.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/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js new file mode 100644 index 0000000000000..9154d21a05c18 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportAssignments.ts] //// + +//// [index.ts] +// cjs format file +const a = {}; +export = a; +//// [index.ts] +// esm format file +const a = {}; +export = a; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +// cjs format file +const a = {}; +module.exports = a; +//// [index.js] +"use strict"; +// esm format file +const a = {}; +module.exports = a; + + +//// [index.d.ts] +declare const a: {}; +export = a; +//// [index.d.ts] +declare const a: {}; +export = a; diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).symbols b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).symbols new file mode 100644 index 0000000000000..97363f05b7a86 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).symbols @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/node/nodeModulesExportAssignments.ts] //// + +=== subfolder/index.ts === +// cjs format file +const a = {}; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +=== index.ts === +// esm format file +const a = {}; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.ts, 1, 5)) + diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).types b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).types new file mode 100644 index 0000000000000..bb44573eb15c7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesExportAssignments.ts] //// + +=== subfolder/index.ts === +// cjs format file +const a = {}; +>a : {} +> : ^^ +>{} : {} +> : ^^ + +export = a; +>a : {} +> : ^^ + +=== index.ts === +// esm format file +const a = {}; +>a : {} +> : ^^ +>{} : {} +> : ^^ + +export = a; +>a : {} +> : ^^ + diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt new file mode 100644 index 0000000000000..5cd14e9edd0a0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt @@ -0,0 +1,38 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,32): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = (await import("inner")).x(); + ~~~~~ +!!! 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 TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +==== node_modules/inner/index.d.ts (0 errors) ==== + // esm format file + export { x } from "./other.js"; +==== node_modules/inner/other.d.ts (0 errors) ==== + // esm format file + export interface Thing {} + export const x: () => Thing; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js new file mode 100644 index 0000000000000..f558b624beffd --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts] //// + +//// [index.ts] +// esm format file +import { Thing } from "inner/other"; +export const a = (await import("inner")).x(); +//// [index.d.ts] +// esm format file +export { x } from "./other.js"; +//// [other.d.ts] +// esm format file +export interface Thing {} +export const x: () => Thing; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "type": "module", + "exports": "./index.js" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = (await import("inner")).x(); + + +//// [index.d.ts] +export declare const a: any; diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols new file mode 100644 index 0000000000000..75e2efd7ffcf9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : Symbol(Thing, Decl(index.ts, 1, 8)) + +export const a = (await import("inner")).x(); +>a : Symbol(a, Decl(index.ts, 2, 12)) + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : Symbol(x, Decl(index.d.ts, 1, 8)) + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + +export const x: () => Thing; +>x : Symbol(x, Decl(other.d.ts, 2, 12)) +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types new file mode 100644 index 0000000000000..98230aff8c096 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : any +> : ^^^ + +export const a = (await import("inner")).x(); +>a : any +> : ^^^ +>(await import("inner")).x() : any +> : ^^^ +>(await import("inner")).x : any +> : ^^^ +>(await import("inner")) : any +> : ^^^ +>await import("inner") : any +> : ^^^ +>import("inner") : Promise +> : ^^^^^^^^^^^^ +>"inner" : "inner" +> : ^^^^^^^ +>x : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +export const x: () => Thing; +>x : () => Thing +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt new file mode 100644 index 0000000000000..ce7aeb8c680f6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt @@ -0,0 +1,108 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Root file specified for compilation +/main.cts(1,16): error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.cts(2,16): error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.cts(3,16): error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.cts(4,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.cts(5,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.cts(6,16): error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(1,16): error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(2,16): error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(3,16): error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(4,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(5,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(6,16): error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +!!! error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? +!!! error TS6504: The file is in the program because: +!!! error TS6504: Root file specified for compilation +==== /node_modules/exports-and-types-versions/package.json (0 errors) ==== + { + "name": "exports-and-types-versions", + "version": "1.0.0", + "exports": { + "./foo": "./dist/foo.js", + "./yep": { + "types": "./types/foo.d.ts", + "default": "./dist/foo.js" + }, + "./versioned-yep": { + "types@>=4": "./types/foo.d.ts" + }, + "./versioned-nah": { + "types@<4": "./types/foo.d.ts" + } + }, + "typesVersions": { + "*": { + "foo": ["./types/foo.d.ts"], + "nope": ["./types/foo.d.ts"], + "versioned-nah": ["./types/foo.d.ts"] + } + } + } + +==== /node_modules/exports-and-types-versions/dist/foo.js (0 errors) ==== + module.exports = {}; + +==== /node_modules/exports-and-types-versions/types/foo.d.ts (0 errors) ==== + export {}; + +==== /node_modules/just-types-versions/package.json (0 errors) ==== + { + "name": "just-types-versions", + "version": "1.0.0", + "typesVersions": { + "*": { + "foo": ["./types/foo.d.ts"] + } + } + } + +==== /node_modules/just-types-versions/types/foo.d.ts (0 errors) ==== + export {}; + +==== /main.cts (6 errors) ==== + import {} from "exports-and-types-versions/foo"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/nope"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/yep"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/versioned-yep"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/versioned-nah"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "just-types-versions/foo"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /main.mts (6 errors) ==== + import {} from "exports-and-types-versions/foo"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/nope"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/yep"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/versioned-yep"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "exports-and-types-versions/versioned-nah"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {} from "just-types-versions/foo"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js new file mode 100644 index 0000000000000..f7796d030e151 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js @@ -0,0 +1,71 @@ +//// [tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts] //// + +//// [package.json] +{ + "name": "exports-and-types-versions", + "version": "1.0.0", + "exports": { + "./foo": "./dist/foo.js", + "./yep": { + "types": "./types/foo.d.ts", + "default": "./dist/foo.js" + }, + "./versioned-yep": { + "types@>=4": "./types/foo.d.ts" + }, + "./versioned-nah": { + "types@<4": "./types/foo.d.ts" + } + }, + "typesVersions": { + "*": { + "foo": ["./types/foo.d.ts"], + "nope": ["./types/foo.d.ts"], + "versioned-nah": ["./types/foo.d.ts"] + } + } +} + +//// [foo.js] +module.exports = {}; + +//// [foo.d.ts] +export {}; + +//// [package.json] +{ + "name": "just-types-versions", + "version": "1.0.0", + "typesVersions": { + "*": { + "foo": ["./types/foo.d.ts"] + } + } +} + +//// [foo.d.ts] +export {}; + +//// [main.cts] +import {} from "exports-and-types-versions/foo"; +import {} from "exports-and-types-versions/nope"; +import {} from "exports-and-types-versions/yep"; +import {} from "exports-and-types-versions/versioned-yep"; +import {} from "exports-and-types-versions/versioned-nah"; +import {} from "just-types-versions/foo"; + +//// [main.mts] +import {} from "exports-and-types-versions/foo"; +import {} from "exports-and-types-versions/nope"; +import {} from "exports-and-types-versions/yep"; +import {} from "exports-and-types-versions/versioned-yep"; +import {} from "exports-and-types-versions/versioned-nah"; +import {} from "just-types-versions/foo"; + + +//// [main.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//// [main.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).symbols new file mode 100644 index 0000000000000..9dc062fedd9a6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).symbols @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts] //// + +=== /node_modules/exports-and-types-versions/types/foo.d.ts === + +export {}; + +=== /node_modules/just-types-versions/types/foo.d.ts === + +export {}; + +=== /main.cts === + +import {} from "exports-and-types-versions/foo"; +import {} from "exports-and-types-versions/nope"; +import {} from "exports-and-types-versions/yep"; +import {} from "exports-and-types-versions/versioned-yep"; +import {} from "exports-and-types-versions/versioned-nah"; +import {} from "just-types-versions/foo"; + +=== /main.mts === + +import {} from "exports-and-types-versions/foo"; +import {} from "exports-and-types-versions/nope"; +import {} from "exports-and-types-versions/yep"; +import {} from "exports-and-types-versions/versioned-yep"; +import {} from "exports-and-types-versions/versioned-nah"; +import {} from "just-types-versions/foo"; + diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json new file mode 100644 index 0000000000000..50a86bfd3e992 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json @@ -0,0 +1,798 @@ +[ + "File '/node_modules/exports-and-types-versions/types/package.json' does not exist.", + "Found 'package.json' at '/node_modules/exports-and-types-versions/package.json'.", + "File '/node_modules/just-types-versions/types/package.json' does not exist.", + "Found 'package.json' at '/node_modules/just-types-versions/package.json'.", + "======== Resolving module 'exports-and-types-versions/foo' from '/main.cts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "======== Module name 'exports-and-types-versions/foo' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/nope' from '/main.cts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "======== Module name 'exports-and-types-versions/nope' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/yep' from '/main.cts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "======== Module name 'exports-and-types-versions/yep' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.cts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "======== Module name 'exports-and-types-versions/versioned-yep' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.cts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========", + "======== Resolving module 'just-types-versions/foo' from '/main.cts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "======== Module name 'just-types-versions/foo' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/foo' from '/main.mts'. ========", + "Resolution for module 'exports-and-types-versions/foo' was found in cache from location '/'.", + "======== Module name 'exports-and-types-versions/foo' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ========", + "Resolution for module 'exports-and-types-versions/nope' was found in cache from location '/'.", + "======== Module name 'exports-and-types-versions/nope' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/yep' from '/main.mts'. ========", + "Resolution for module 'exports-and-types-versions/yep' was found in cache from location '/'.", + "======== Module name 'exports-and-types-versions/yep' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.mts'. ========", + "Resolution for module 'exports-and-types-versions/versioned-yep' was found in cache from location '/'.", + "======== Module name 'exports-and-types-versions/versioned-yep' was not resolved. ========", + "======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.mts'. ========", + "Resolution for module 'exports-and-types-versions/versioned-nah' was found in cache from location '/'.", + "======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========", + "======== Resolving module 'just-types-versions/foo' from '/main.mts'. ========", + "Resolution for module 'just-types-versions/foo' was found in cache from location '/'.", + "======== Module name 'just-types-versions/foo' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/arraybuffer' from '/.src/__lib_node_modules_lookup_lib.es2017.arraybuffer.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/arraybuffer'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/arraybuffer'", + "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/arraybuffer' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).types b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).types new file mode 100644 index 0000000000000..9dc062fedd9a6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).types @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts] //// + +=== /node_modules/exports-and-types-versions/types/foo.d.ts === + +export {}; + +=== /node_modules/just-types-versions/types/foo.d.ts === + +export {}; + +=== /main.cts === + +import {} from "exports-and-types-versions/foo"; +import {} from "exports-and-types-versions/nope"; +import {} from "exports-and-types-versions/yep"; +import {} from "exports-and-types-versions/versioned-yep"; +import {} from "exports-and-types-versions/versioned-nah"; +import {} from "just-types-versions/foo"; + +=== /main.mts === + +import {} from "exports-and-types-versions/foo"; +import {} from "exports-and-types-versions/nope"; +import {} from "exports-and-types-versions/yep"; +import {} from "exports-and-types-versions/versioned-yep"; +import {} from "exports-and-types-versions/versioned-nah"; +import {} from "just-types-versions/foo"; + diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt new file mode 100644 index 0000000000000..3f951c05a6887 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt @@ -0,0 +1,42 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,32): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (4 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = (await import("inner")).x(); + ~~~~~ +!!! 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 TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import {a as a2} from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +==== node_modules/inner/index.ts (0 errors) ==== + // esm format file + export { x } from "./other.js"; +==== node_modules/inner/other.ts (0 errors) ==== + // esm format file + export interface Thing {} + export const x: () => Thing = null as any; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.ts" + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "type": "module", + "exports": "./index.ts" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js new file mode 100644 index 0000000000000..62adf646cdc89 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js @@ -0,0 +1,56 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSourceTs.ts] //// + +//// [index.ts] +// esm format file +import { Thing } from "inner/other"; +export const a = (await import("inner")).x(); +import {a as a2} from "package"; +//// [index.ts] +// esm format file +export { x } from "./other.js"; +//// [other.ts] +// esm format file +export interface Thing {} +export const x: () => Thing = null as any; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.ts" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "type": "module", + "exports": "./index.ts" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = (await import("inner")).x(); +//// [other.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +exports.x = null; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +var other_js_1 = require("./other.js"); +Object.defineProperty(exports, "x", { enumerable: true, get: function () { return other_js_1.x; } }); + + +//// [index.d.ts] +export declare const a: any; +//// [other.d.ts] +export interface Thing { +} +export declare const x: () => Thing; +//// [index.d.ts] +export { x } from "./other.js"; diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols new file mode 100644 index 0000000000000..b504d78ebc50e --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSourceTs.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : Symbol(Thing, Decl(index.ts, 1, 8)) + +export const a = (await import("inner")).x(); +>a : Symbol(a, Decl(index.ts, 2, 12)) + +import {a as a2} from "package"; +>a2 : Symbol(a2, Decl(index.ts, 3, 8)) + +=== node_modules/inner/index.ts === +// esm format file +export { x } from "./other.js"; +>x : Symbol(x, Decl(index.ts, 1, 8)) + +=== node_modules/inner/other.ts === +// esm format file +export interface Thing {} +>Thing : Symbol(Thing, Decl(other.ts, 0, 0)) + +export const x: () => Thing = null as any; +>x : Symbol(x, Decl(other.ts, 2, 12)) +>Thing : Symbol(Thing, Decl(other.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types new file mode 100644 index 0000000000000..b61b7853174c4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSourceTs.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : any +> : ^^^ + +export const a = (await import("inner")).x(); +>a : any +> : ^^^ +>(await import("inner")).x() : any +> : ^^^ +>(await import("inner")).x : any +> : ^^^ +>(await import("inner")) : any +> : ^^^ +>await import("inner") : any +> : ^^^ +>import("inner") : Promise +> : ^^^^^^^^^^^^ +>"inner" : "inner" +> : ^^^^^^^ +>x : any +> : ^^^ + +import {a as a2} from "package"; +>a : any +> : ^^^ +>a2 : any +> : ^^^ + +=== node_modules/inner/index.ts === +// esm format file +export { x } from "./other.js"; +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== node_modules/inner/other.ts === +// esm format file +export interface Thing {} +export const x: () => Thing = null as any; +>x : () => Thing +> : ^^^^^^ +>null as any : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt new file mode 100644 index 0000000000000..7bec6ced03161 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt @@ -0,0 +1,45 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(2,23): error TS2792: Cannot find module 'inner/other.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,32): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import { Thing } from "inner/other.js"; // should fail + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/other.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = (await import("inner")).x(); + ~~~~~ +!!! 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 TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +==== node_modules/inner/index.d.ts (0 errors) ==== + // esm format file + export { x } from "./other.js"; +==== node_modules/inner/other.d.ts (0 errors) ==== + // esm format file + export interface Thing {} + export const x: () => Thing; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "type": "module", + "exports": { + ".": { + "default": "./index.js" + }, + "./other": { + "default": "./other.js" + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js new file mode 100644 index 0000000000000..bf2286847a188 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js @@ -0,0 +1,44 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts] //// + +//// [index.ts] +// esm format file +import { Thing } from "inner/other.js"; // should fail +export const a = (await import("inner")).x(); +//// [index.d.ts] +// esm format file +export { x } from "./other.js"; +//// [other.d.ts] +// esm format file +export interface Thing {} +export const x: () => Thing; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "type": "module", + "exports": { + ".": { + "default": "./index.js" + }, + "./other": { + "default": "./other.js" + } + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = (await import("inner")).x(); + + +//// [index.d.ts] +export declare const a: any; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols new file mode 100644 index 0000000000000..c874e53a47a24 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other.js"; // should fail +>Thing : Symbol(Thing, Decl(index.ts, 1, 8)) + +export const a = (await import("inner")).x(); +>a : Symbol(a, Decl(index.ts, 2, 12)) + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : Symbol(x, Decl(index.d.ts, 1, 8)) + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + +export const x: () => Thing; +>x : Symbol(x, Decl(other.d.ts, 2, 12)) +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types new file mode 100644 index 0000000000000..89388ff0accb3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other.js"; // should fail +>Thing : any +> : ^^^ + +export const a = (await import("inner")).x(); +>a : any +> : ^^^ +>(await import("inner")).x() : any +> : ^^^ +>(await import("inner")).x : any +> : ^^^ +>(await import("inner")) : any +> : ^^^ +>await import("inner") : any +> : ^^^ +>import("inner") : Promise +> : ^^^^^^^^^^^^ +>"inner" : "inner" +> : ^^^^^^^ +>x : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +export const x: () => Thing; +>x : () => Thing +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt new file mode 100644 index 0000000000000..8408257a3cfd9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt @@ -0,0 +1,40 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,32): error TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = (await import("inner/index.js")).x(); + ~~~~~ +!!! 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 TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +==== node_modules/inner/index.d.ts (0 errors) ==== + // esm format file + export { x } from "./other.js"; +==== node_modules/inner/other.d.ts (0 errors) ==== + // esm format file + export interface Thing {} + export const x: () => Thing; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "type": "module", + "exports": { + "./": "./" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js new file mode 100644 index 0000000000000..df37c54ae36de --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts] //// + +//// [index.ts] +// esm format file +import { Thing } from "inner/other"; +export const a = (await import("inner/index.js")).x(); +//// [index.d.ts] +// esm format file +export { x } from "./other.js"; +//// [other.d.ts] +// esm format file +export interface Thing {} +export const x: () => Thing; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "type": "module", + "exports": { + "./": "./" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = (await import("inner/index.js")).x(); + + +//// [index.d.ts] +export declare const a: any; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols new file mode 100644 index 0000000000000..8473640f2b0bd --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : Symbol(Thing, Decl(index.ts, 1, 8)) + +export const a = (await import("inner/index.js")).x(); +>a : Symbol(a, Decl(index.ts, 2, 12)) + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : Symbol(x, Decl(index.d.ts, 1, 8)) + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + +export const x: () => Thing; +>x : Symbol(x, Decl(other.d.ts, 2, 12)) +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types new file mode 100644 index 0000000000000..417344f0b9857 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : any +> : ^^^ + +export const a = (await import("inner/index.js")).x(); +>a : any +> : ^^^ +>(await import("inner/index.js")).x() : any +> : ^^^ +>(await import("inner/index.js")).x : any +> : ^^^ +>(await import("inner/index.js")) : any +> : ^^^ +>await import("inner/index.js") : any +> : ^^^ +>import("inner/index.js") : Promise +> : ^^^^^^^^^^^^ +>"inner/index.js" : "inner/index.js" +> : ^^^^^^^^^^^^^^^^ +>x : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +export const x: () => Thing; +>x : () => Thing +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt new file mode 100644 index 0000000000000..79c2c8a224d51 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt @@ -0,0 +1,40 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,32): error TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const a = (await import("inner/index.js")).x(); + ~~~~~ +!!! 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 TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +==== node_modules/inner/index.d.ts (0 errors) ==== + // esm format file + export { x } from "./other.js"; +==== node_modules/inner/other.d.ts (0 errors) ==== + // esm format file + export interface Thing {} + export const x: () => Thing; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "type": "module", + "exports": { + "./*.js": "./*.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js new file mode 100644 index 0000000000000..7f44af7646402 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts] //// + +//// [index.ts] +// esm format file +import { Thing } from "inner/other"; +export const a = (await import("inner/index.js")).x(); +//// [index.d.ts] +// esm format file +export { x } from "./other.js"; +//// [other.d.ts] +// esm format file +export interface Thing {} +export const x: () => Thing; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "type": "module", + "exports": { + "./*.js": "./*.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = (await import("inner/index.js")).x(); + + +//// [index.d.ts] +export declare const a: any; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols new file mode 100644 index 0000000000000..0e7bf123351dd --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : Symbol(Thing, Decl(index.ts, 1, 8)) + +export const a = (await import("inner/index.js")).x(); +>a : Symbol(a, Decl(index.ts, 2, 12)) + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : Symbol(x, Decl(index.d.ts, 1, 8)) + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + +export const x: () => Thing; +>x : Symbol(x, Decl(other.d.ts, 2, 12)) +>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types new file mode 100644 index 0000000000000..5588e878db70c --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts] //// + +=== index.ts === +// esm format file +import { Thing } from "inner/other"; +>Thing : any +> : ^^^ + +export const a = (await import("inner/index.js")).x(); +>a : any +> : ^^^ +>(await import("inner/index.js")).x() : any +> : ^^^ +>(await import("inner/index.js")).x : any +> : ^^^ +>(await import("inner/index.js")) : any +> : ^^^ +>await import("inner/index.js") : any +> : ^^^ +>import("inner/index.js") : Promise +> : ^^^^^^^^^^^^ +>"inner/index.js" : "inner/index.js" +> : ^^^^^^^^^^^^^^^^ +>x : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// esm format file +export { x } from "./other.js"; +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== node_modules/inner/other.d.ts === +// esm format file +export interface Thing {} +export const x: () => Thing; +>x : () => Thing +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt new file mode 100644 index 0000000000000..59e005b0d5ece --- /dev/null +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt @@ -0,0 +1,141 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +subfolder/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +subfolder/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/another/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +subfolder2/another/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/another/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/another/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +subfolder2/another/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/another/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +subfolder2/index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. +subfolder2/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. +subfolder2/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + const x = () => (void 0); + export {x}; +==== subfolder/index.cts (3 errors) ==== + // cjs format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== subfolder/index.mts (3 errors) ==== + // esm format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== subfolder2/index.ts (0 errors) ==== + // cjs format file + const x = () => (void 0); + export {x}; +==== subfolder2/index.cts (3 errors) ==== + // cjs format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== subfolder2/index.mts (3 errors) ==== + // esm format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== subfolder2/another/index.ts (0 errors) ==== + // esm format file + const x = () => (void 0); + export {x}; +==== subfolder2/another/index.mts (3 errors) ==== + // esm format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== subfolder2/another/index.cts (3 errors) ==== + // cjs format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== index.mts (3 errors) ==== + // esm format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== index.cts (3 errors) ==== + // cjs format file + const x = () => (void 0); + ~ +!!! error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. + ~~~~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + ~~~~~~~~~~~~~ +!!! error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. + export {x}; +==== index.ts (0 errors) ==== + // esm format file + const x = () => (void 0); + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== subfolder2/package.json (0 errors) ==== + { + } +==== subfolder2/another/package.json (0 errors) ==== + { + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js new file mode 100644 index 0000000000000..43e30cd2d231c --- /dev/null +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js @@ -0,0 +1,190 @@ +//// [tests/cases/conformance/node/nodeModulesForbidenSyntax.ts] //// + +//// [index.ts] +// cjs format file +const x = () => (void 0); +export {x}; +//// [index.cts] +// cjs format file +const x = () => (void 0); +export {x}; +//// [index.mts] +// esm format file +const x = () => (void 0); +export {x}; +//// [index.ts] +// cjs format file +const x = () => (void 0); +export {x}; +//// [index.cts] +// cjs format file +const x = () => (void 0); +export {x}; +//// [index.mts] +// esm format file +const x = () => (void 0); +export {x}; +//// [index.ts] +// esm format file +const x = () => (void 0); +export {x}; +//// [index.mts] +// esm format file +const x = () => (void 0); +export {x}; +//// [index.cts] +// cjs format file +const x = () => (void 0); +export {x}; +//// [index.mts] +// esm format file +const x = () => (void 0); +export {x}; +//// [index.cts] +// cjs format file +const x = () => (void 0); +export {x}; +//// [index.ts] +// esm format file +const x = () => (void 0); +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [package.json] +{ +} +//// [package.json] +{ + "type": "module" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = () => (void 0); +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = () => (void 0); +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = () => (void 0); +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = () => (void 0); +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = () => (void 0); +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = () => (void 0); +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = () => (void 0); +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = () => (void 0); +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = () => (void 0); +exports.x = x; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = () => (void 0); +exports.x = x; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = () => (void 0); +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = () => (void 0); +exports.x = x; + + +//// [index.d.ts] +declare const x: () => T; +export { x }; +//// [index.d.cts] +declare const x: () => T; +export { x }; +//// [index.d.mts] +declare const x: () => T; +export { x }; +//// [index.d.ts] +declare const x: () => T; +export { x }; +//// [index.d.cts] +declare const x: () => T; +export { x }; +//// [index.d.mts] +declare const x: () => T; +export { x }; +//// [index.d.ts] +declare const x: () => T; +export { x }; +//// [index.d.mts] +declare const x: () => T; +export { x }; +//// [index.d.cts] +declare const x: () => T; +export { x }; +//// [index.d.mts] +declare const x: () => T; +export { x }; +//// [index.d.cts] +declare const x: () => T; +export { x }; +//// [index.d.ts] +declare const x: () => T; +export { x }; diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).symbols b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).symbols new file mode 100644 index 0000000000000..6283085cda132 --- /dev/null +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).symbols @@ -0,0 +1,122 @@ +//// [tests/cases/conformance/node/nodeModulesForbidenSyntax.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.ts, 1, 5)) +>T : Symbol(T, Decl(index.ts, 1, 11)) +>T : Symbol(T, Decl(index.ts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== subfolder/index.cts === +// cjs format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.cts, 1, 5)) +>T : Symbol(T, Decl(index.cts, 1, 11)) +>T : Symbol(T, Decl(index.cts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== subfolder/index.mts === +// esm format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.mts, 1, 5)) +>T : Symbol(T, Decl(index.mts, 1, 11)) +>T : Symbol(T, Decl(index.mts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== subfolder2/index.ts === +// cjs format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.ts, 1, 5)) +>T : Symbol(T, Decl(index.ts, 1, 11)) +>T : Symbol(T, Decl(index.ts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== subfolder2/index.cts === +// cjs format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.cts, 1, 5)) +>T : Symbol(T, Decl(index.cts, 1, 11)) +>T : Symbol(T, Decl(index.cts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== subfolder2/index.mts === +// esm format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.mts, 1, 5)) +>T : Symbol(T, Decl(index.mts, 1, 11)) +>T : Symbol(T, Decl(index.mts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== subfolder2/another/index.ts === +// esm format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.ts, 1, 5)) +>T : Symbol(T, Decl(index.ts, 1, 11)) +>T : Symbol(T, Decl(index.ts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== subfolder2/another/index.mts === +// esm format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.mts, 1, 5)) +>T : Symbol(T, Decl(index.mts, 1, 11)) +>T : Symbol(T, Decl(index.mts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== subfolder2/another/index.cts === +// cjs format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.cts, 1, 5)) +>T : Symbol(T, Decl(index.cts, 1, 11)) +>T : Symbol(T, Decl(index.cts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== index.mts === +// esm format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.mts, 1, 5)) +>T : Symbol(T, Decl(index.mts, 1, 11)) +>T : Symbol(T, Decl(index.mts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.mts, 2, 8)) + +=== index.cts === +// cjs format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.cts, 1, 5)) +>T : Symbol(T, Decl(index.cts, 1, 11)) +>T : Symbol(T, Decl(index.cts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.cts, 2, 8)) + +=== index.ts === +// esm format file +const x = () => (void 0); +>x : Symbol(x, Decl(index.ts, 1, 5)) +>T : Symbol(T, Decl(index.ts, 1, 11)) +>T : Symbol(T, Decl(index.ts, 1, 11)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).types b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).types new file mode 100644 index 0000000000000..ff52c1dedd1b3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).types @@ -0,0 +1,266 @@ +//// [tests/cases/conformance/node/nodeModulesForbidenSyntax.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder/index.cts === +// cjs format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder/index.mts === +// esm format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder2/index.ts === +// cjs format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder2/index.cts === +// cjs format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder2/index.mts === +// esm format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder2/another/index.ts === +// esm format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder2/another/index.mts === +// esm format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== subfolder2/another/index.cts === +// cjs format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== index.mts === +// esm format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== index.cts === +// cjs format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + +=== index.ts === +// esm format file +const x = () => (void 0); +>x : () => T +> : ^ ^^^^^^^ +>() => (void 0) : () => T +> : ^ ^^^^^^^ +>(void 0) : T +> : ^ +>(void 0) : any +> : ^^^ +>(void 0) : undefined +> : ^^^^^^^^^ +>void 0 : undefined +> : ^^^^^^^^^ +>0 : 0 +> : ^ + +export {x}; +>x : () => T +> : ^ ^^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt new file mode 100644 index 0000000000000..ecc8bf326aafc --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + function require() {} + const exports = {}; + class Object {} + export const __esModule = false; + export {require, exports, Object}; +==== index.ts (0 errors) ==== + // esm format file + function require() {} + const exports = {}; + class Object {} + export const __esModule = false; + export {require, exports, Object}; +==== 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/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js new file mode 100644 index 0000000000000..d399ccc45b2db --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js @@ -0,0 +1,69 @@ +//// [tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts] //// + +//// [index.ts] +// cjs format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [index.ts] +// esm format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = exports.exports = exports.__esModule = void 0; +exports.require = require; +// cjs format file +function require() { } +const exports = {}; +exports.exports = exports; +class Object { +} +exports.Object = Object; +exports.__esModule = false; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = exports.exports = exports.__esModule = void 0; +exports.require = require; +// esm format file +function require() { } +const exports = {}; +exports.exports = exports; +class Object { +} +exports.Object = Object; +exports.__esModule = false; + + +//// [index.d.ts] +declare function require(): void; +declare const exports: {}; +declare class Object { +} +export declare const __esModule = false; +export { require, exports, Object }; +//// [index.d.ts] +declare function require(): void; +declare const exports: {}; +declare class Object { +} +export declare const __esModule = false; +export { require, exports, Object }; diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).symbols b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).symbols new file mode 100644 index 0000000000000..a30d4a614f899 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).symbols @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts] //// + +=== subfolder/index.ts === +// cjs format file +function require() {} +>require : Symbol(require, Decl(index.ts, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.ts, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.ts, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.ts, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.ts, 5, 8)) +>exports : Symbol(exports, Decl(index.ts, 5, 16)) +>Object : Symbol(Object, Decl(index.ts, 5, 25)) + +=== index.ts === +// esm format file +function require() {} +>require : Symbol(require, Decl(index.ts, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.ts, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.ts, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.ts, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.ts, 5, 8)) +>exports : Symbol(exports, Decl(index.ts, 5, 16)) +>Object : Symbol(Object, Decl(index.ts, 5, 25)) + diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).types b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).types new file mode 100644 index 0000000000000..c1875847654cd --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).types @@ -0,0 +1,62 @@ +//// [tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts] //// + +=== subfolder/index.ts === +// cjs format file +function require() {} +>require : () => void +> : ^^^^^^^^^^ + +const exports = {}; +>exports : {} +> : ^^ +>{} : {} +> : ^^ + +class Object {} +>Object : Object +> : ^^^^^^ + +export const __esModule = false; +>__esModule : false +> : ^^^^^ +>false : false +> : ^^^^^ + +export {require, exports, Object}; +>require : () => void +> : ^^^^^^^^^^ +>exports : {} +> : ^^ +>Object : typeof Object +> : ^^^^^^^^^^^^^ + +=== index.ts === +// esm format file +function require() {} +>require : () => void +> : ^^^^^^^^^^ + +const exports = {}; +>exports : {} +> : ^^ +>{} : {} +> : ^^ + +class Object {} +>Object : Object +> : ^^^^^^ + +export const __esModule = false; +>__esModule : false +> : ^^^^^ +>false : false +> : ^^^^^ + +export {require, exports, Object}; +>require : () => void +> : ^^^^^^^^^^ +>exports : {} +> : ^^ +>Object : typeof Object +> : ^^^^^^^^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt index 13610391f6d16..87c7929eb2580 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt @@ -1,15 +1,15 @@ -index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +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'. ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== otherc.cts (1 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt new file mode 100644 index 0000000000000..77ffcab23e63a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +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. + + +!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + import json from "./package.json" assert { type: "json" }; + ~~~~ +!!! 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. +==== otherc.cts (2 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. + const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +==== package.json (0 errors) ==== + { + "name": "pkg", + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js new file mode 100644 index 0000000000000..e8d43f0ad3e91 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// + +//// [index.ts] +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 +const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +//// [package.json] +{ + "name": "pkg", + "private": true, + "type": "module" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//// [otherc.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols new file mode 100644 index 0000000000000..881cb771218da --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// + +=== index.ts === +import json from "./package.json" assert { type: "json" }; +>json : Symbol(json, Decl(index.ts, 0, 6)) + +=== otherc.cts === +import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +>json : Symbol(json, Decl(otherc.cts, 0, 6)) + +const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +>json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) +>"./package.json" : Symbol("package", Decl(package.json, 0, 0)) +>assert : Symbol(assert, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 50)) + +=== package.json === +{ + "name": "pkg", +>"name" : Symbol("name", Decl(package.json, 0, 1)) + + "private": true, +>"private" : Symbol("private", Decl(package.json, 1, 18)) + + "type": "module" +>"type" : Symbol("type", Decl(package.json, 2, 20)) +} diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types new file mode 100644 index 0000000000000..a6cd7496f4a01 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types @@ -0,0 +1,57 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// + +=== index.ts === +import json from "./package.json" assert { type: "json" }; +>json : any +> : ^^^ +>type : any +> : ^^^ + +=== otherc.cts === +import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +>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; }; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"./package.json" : "./package.json" +> : ^^^^^^^^^^^^^^^^ +>{ assert: { type: "json" } } : { assert: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>assert : { type: string; } +> : ^^^^^^^^^^^^^^^^^ +>{ type: "json" } : { type: string; } +> : ^^^^^^^^^^^^^^^^^ +>type : string +> : ^^^^^^ +>"json" : "json" +> : ^^^^^^ + +=== package.json === +{ +>{ "name": "pkg", "private": true, "type": "module"} : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + "name": "pkg", +>"name" : string +> : ^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ + + "private": true, +>"private" : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ + + "type": "module" +>"type" : string +> : ^^^^^^ +>"module" : "module" +> : ^^^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt new file mode 100644 index 0000000000000..46e611660c7d4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt @@ -0,0 +1,33 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + import fs = require("fs"); + fs.readFile; + export import fs2 = require("fs"); +==== index.ts (0 errors) ==== + // esm format file + import fs = require("fs"); + fs.readFile; + export import fs2 = require("fs"); +==== file.ts (0 errors) ==== + // esm format file + const __require = null; + const _createRequire = null; + import fs = require("fs"); + fs.readFile; + export import fs2 = require("fs"); +==== 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/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js new file mode 100644 index 0000000000000..4a8f44fd00b87 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js @@ -0,0 +1,63 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssignments.ts] //// + +//// [index.ts] +// cjs format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [index.ts] +// esm format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [file.ts] +// esm format file +const __require = null; +const _createRequire = null; +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); +//// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const __require = null; +const _createRequire = null; +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); + + +//// [index.d.ts] +export import fs2 = require("fs"); +//// [index.d.ts] +export import fs2 = require("fs"); +//// [file.d.ts] +export import fs2 = require("fs"); diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).symbols new file mode 100644 index 0000000000000..0833a1e78f70d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).symbols @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssignments.ts] //// + +=== subfolder/index.ts === +// cjs format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.ts, 2, 12)) + +=== index.ts === +// esm format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.ts, 2, 12)) + +=== file.ts === +// esm format file +const __require = null; +>__require : Symbol(__require, Decl(file.ts, 1, 5)) + +const _createRequire = null; +>_createRequire : Symbol(_createRequire, Decl(file.ts, 2, 5)) + +import fs = require("fs"); +>fs : Symbol(fs, Decl(file.ts, 2, 28)) + +fs.readFile; +>fs : Symbol(fs, Decl(file.ts, 2, 28)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(file.ts, 4, 12)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types new file mode 100644 index 0000000000000..029cf6d415bed --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types @@ -0,0 +1,69 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssignments.ts] //// + +=== subfolder/index.ts === +// cjs format file +import fs = require("fs"); +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +export import fs2 = require("fs"); +>fs2 : any +> : ^^^ + +=== index.ts === +// esm format file +import fs = require("fs"); +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +export import fs2 = require("fs"); +>fs2 : any +> : ^^^ + +=== file.ts === +// esm format file +const __require = null; +>__require : any +> : ^^^ + +const _createRequire = null; +>_createRequire : any +> : ^^^ + +import fs = require("fs"); +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +export import fs2 = require("fs"); +>fs2 : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt index c06636ec80aca..5d2fe738900b5 100644 --- a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt @@ -1,15 +1,15 @@ -index.ts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -otherc.cts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +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'. ==== index.ts (1 errors) ==== import json from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== otherc.cts (1 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt new file mode 100644 index 0000000000000..02fb2e9fd2c2c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt @@ -0,0 +1,29 @@ +error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.ts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag +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. + + +!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + import json from "./package.json" with { type: "json" }; + ~~~~ +!!! 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. +==== otherc.cts (2 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. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +==== package.json (0 errors) ==== + { + "name": "pkg", + "private": true, + "type": "module" + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js new file mode 100644 index 0000000000000..9653caaf24529 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +//// [index.ts] +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 +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +//// [package.json] +{ + "name": "pkg", + "private": true, + "type": "module" +} + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//// [otherc.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).symbols new file mode 100644 index 0000000000000..6666db3e5b459 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).symbols @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +=== index.ts === +import json from "./package.json" with { type: "json" }; +>json : Symbol(json, Decl(index.ts, 0, 6)) + +=== otherc.cts === +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +>json : Symbol(json, Decl(otherc.cts, 0, 6)) + +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +>json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) +>"./package.json" : Symbol("package", Decl(package.json, 0, 0)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) + +=== package.json === +{ + "name": "pkg", +>"name" : Symbol("name", Decl(package.json, 0, 1)) + + "private": true, +>"private" : Symbol("private", Decl(package.json, 1, 18)) + + "type": "module" +>"type" : Symbol("type", Decl(package.json, 2, 20)) +} + diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types new file mode 100644 index 0000000000000..a0e3595e7e20f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +=== index.ts === +import json from "./package.json" with { type: "json" }; +>json : any +> : ^^^ +>type : any +> : ^^^ + +=== otherc.cts === +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +>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; }; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"./package.json" : "./package.json" +> : ^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ +>{ type: "json" } : { type: string; } +> : ^^^^^^^^^^^^^^^^^ +>type : string +> : ^^^^^^ +>"json" : "json" +> : ^^^^^^ + +=== package.json === +{ +>{ "name": "pkg", "private": true, "type": "module"} : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + "name": "pkg", +>"name" : string +> : ^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ + + "private": true, +>"private" : boolean +> : ^^^^^^^ +>true : true +> : ^^^^ + + "type": "module" +>"type" : string +> : ^^^^^^ +>"module" : "module" +> : ^^^^^^^^ +} + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt index 5986330507739..dc92388a5f008 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).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', 'nodenext', or 'preserve'. +/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', 'nodenext', or 'preserve'. +/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) ==== @@ -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', 'nodenext', or 'preserve'. +!!! 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 TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt new file mode 100644 index 0000000000000..e911db19854b7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,54 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (8 errors) ==== + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /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/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).js new file mode 100644 index 0000000000000..7175dbf9479d7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols new file mode 100644 index 0000000000000..b357f147d0ee5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types new file mode 100644 index 0000000000000..be8fc085f344a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ +>Req : any +> : ^^^ + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ +>Imp : any +> : ^^^ + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt index 23d74c2152e6c..1bd8e26f0ac51 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt @@ -1,6 +1,6 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/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,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== /index.ts (3 errors) ==== @@ -13,10 +13,10 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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 TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt new file mode 100644 index 0000000000000..d3661fe11f6cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt @@ -0,0 +1,59 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (8 errors) ==== + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /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 {} +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js new file mode 100644 index 0000000000000..69c5d82a5505a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols new file mode 100644 index 0000000000000..5c9e6a993205d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types new file mode 100644 index 0000000000000..e42317e6535f5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ +>Req : any +> : ^^^ + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ +>Imp : any +> : ^^^ + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt index f488863314397..4bd1844e4824d 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).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', 'nodenext', or 'preserve'. +/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 TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/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 TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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 @@ -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', 'nodenext', or 'preserve'. +!!! 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 TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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 {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt new file mode 100644 index 0000000000000..20c6846fdafc9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt @@ -0,0 +1,51 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,45): error TS2857: Import attributes cannot be used with type-only imports or exports. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(4,33): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(4,39): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(6,70): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,76): error TS1454: `resolution-mode` can only be set for type-only imports. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (7 errors) ==== + // incorrect mode + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + // not type-only + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + // not exclusively type-only + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + + export interface LocalInterface extends RequireInterface, 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 interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).js new file mode 100644 index 0000000000000..988072b042c93 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg"; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols new file mode 100644 index 0000000000000..3783b14c2c0ba --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) + +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + + + + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types new file mode 100644 index 0000000000000..d2b4d085b2124 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : any +> : ^^^ + +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ +>Req : any +> : ^^^ +>RequireInterface : any +> : ^^^ +>Req2 : any +> : ^^^ + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt new file mode 100644 index 0000000000000..e35f7c579f05d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt @@ -0,0 +1,37 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /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/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js new file mode 100644 index 0000000000000..44948d9ed5250 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +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); + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +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", { with: { "resolution-mode": "require" } }).RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols new file mode 100644 index 0000000000000..389f152423bba --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & 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); +>a : Symbol(a, Decl(index.ts, 4, 12)) + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types new file mode 100644 index 0000000000000..c2151818ca3b0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & 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); +>a : any +> : ^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt new file mode 100644 index 0000000000000..27e68167e1f1f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt @@ -0,0 +1,343 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(3,22): error TS1005: 'with' expected. +/other.ts(3,39): error TS1005: ';' expected. +/other.ts(3,50): error TS1128: Declaration or statement expected. +/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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +/other.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(6,49): error TS1005: 'with' expected. +/other.ts(6,66): error TS1005: ';' expected. +/other.ts(6,77): error TS1128: Declaration or statement expected. +/other.ts(6,78): error TS1128: Declaration or statement expected. +/other.ts(6,79): error TS1128: Declaration or statement expected. +/other.ts(6,80): error TS1434: Unexpected keyword or identifier. +/other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. +/other.ts(6,96): error TS1128: Declaration or statement expected. +/other.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(7,49): error TS1005: 'with' expected. +/other.ts(7,66): error TS1005: ';' expected. +/other.ts(7,76): error TS1128: Declaration or statement expected. +/other.ts(7,77): error TS1128: Declaration or statement expected. +/other.ts(7,78): error TS1128: Declaration or statement expected. +/other.ts(7,79): error TS1434: Unexpected keyword or identifier. +/other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. +/other.ts(7,94): error TS1128: Declaration or statement expected. +/other2.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(4,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other3.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(3,21): error TS1005: '{' expected. +/other3.ts(3,23): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +/other3.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(6,48): error TS1005: '{' expected. +/other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/other3.ts(6,100): error TS1005: ',' expected. +/other3.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(7,48): error TS1005: '{' expected. +/other3.ts(7,50): error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. +/other3.ts(7,98): error TS1005: ',' expected. +/other4.ts(6,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(6,21): error TS1005: '{' expected. +/other4.ts(6,21): error TS2448: Block-scoped variable 'Attribute1' used before its declaration. +/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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +/other4.ts(9,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(9,48): error TS1005: '{' expected. +/other4.ts(9,58): error TS1005: ',' expected. +/other4.ts(9,59): error TS1134: Variable declaration expected. +/other4.ts(9,76): error TS1005: ',' expected. +/other4.ts(10,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(10,48): error TS1005: '{' expected. +/other4.ts(10,58): error TS1005: ',' expected. +/other4.ts(10,59): error TS1134: Variable declaration expected. +/other4.ts(10,75): error TS1005: ',' expected. +/other5.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /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 {} + +==== /index.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /other.ts (28 errors) ==== + // missing with: + export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + +==== /other2.ts (8 errors) ==== + // wrong attribute key + export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + + export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + +==== /other3.ts (17 errors) ==== + // Array instead of object-y thing + export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + +==== /other4.ts (19 errors) ==== + // Indirected attribute objecty-thing - not allowed + type Attribute1 = { with: {"resolution-mode": "require"} }; + type Attribute2 = { with: {"resolution-mode": "import"} }; + + export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:6:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'Attribute1' used before its declaration. +!!! related TS2728 /other4.ts:9:48: 'Attribute1' is declared here. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. + + export const a = (null as any as import("pkg", Attribute1).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:9:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", Attribute2).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:10:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + +==== /other5.ts (8 errors) ==== + export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + & import("pkg", { with: {} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + + export const a = (null as any as import("pkg", { with: {} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + export const b = (null as any as import("pkg", { with: {} }).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js new file mode 100644 index 0000000000000..c64b30d4e5bba --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js @@ -0,0 +1,153 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} + +//// [require.d.ts] +export interface RequireInterface {} + +//// [index.ts] +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + +//// [other.ts] +// missing with: +export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + +//// [other2.ts] +// wrong attribute key +export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + +//// [other3.ts] +// Array instead of object-y thing +export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + +//// [other4.ts] +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +type Attribute2 = { with: {"resolution-mode": "import"} }; + +export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + & import("pkg", Attribute2).ImportInterface; + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +export const b = (null as any as import("pkg", Attribute2).ImportInterface); + +//// [other5.ts] +export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +"resolution-mode"; +"require"; +RequireInterface + & import("pkg", { "resolution-mode": "import" }).ImportInterface; +exports.a = null; +"resolution-mode"; +"require"; +RequireInterface; +; +exports.b = null; +"resolution-mode"; +"import"; +ImportInterface; +; +//// [other2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +RequireInterface + & import("pkg", [{ "resolution-mode": "import" }]).ImportInterface; +exports.a = null.RequireInterface; +exports.b = null.ImportInterface; +//// [other4.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ImportInterface = exports.Attribute2 = exports.b = exports.RequireInterface = exports.Attribute1 = exports.a = void 0; +exports.Attribute1; +exports.RequireInterface + & import("pkg", exports.Attribute2).ImportInterface; +exports.a = null; +exports.b = null; +//// [other5.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +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", { with: { "resolution-mode": "foobar" } }).RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +//// [other.d.ts] +export type LocalInterface = import("pkg", { with: {} }); +export declare const a: import("pkg", { with: {} }); +export declare const b: import("pkg", { with: {} }); +//// [other2.d.ts] +export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; +export declare const a: import("pkg", { with: { "bad": "require" } }).RequireInterface; +export declare const b: import("pkg", { with: { "bad": "import" } }).ImportInterface; +//// [other3.d.ts] +export type LocalInterface = import("pkg", { with: {} })[{ + "resolution-mode": "require"; +}]; +export declare const a: any; +export declare const b: any; +//// [other4.d.ts] +export type LocalInterface = import("pkg", { with: {} }); +export declare const a: import("pkg", { with: {} }), Attribute1: any, RequireInterface: any; +export declare const b: import("pkg", { with: {} }), Attribute2: any, ImportInterface: any; +//// [other5.d.ts] +export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; +export declare const a: import("pkg", { with: {} }).RequireInterface; +export declare const b: import("pkg", { with: {} }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols new file mode 100644 index 0000000000000..e2d5fe2f4b60a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols @@ -0,0 +1,116 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /other.ts === +// missing with: +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other.ts, 0, 0)) + + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>"resolution-mode" : Symbol("resolution-mode", Decl(other.ts, 3, 21)) + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : Symbol(a, Decl(other.ts, 5, 12)) + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : Symbol(b, Decl(other.ts, 6, 12)) + +=== /other2.ts === +// wrong attribute key +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other2.ts, 0, 0)) + + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +>a : Symbol(a, Decl(other2.ts, 5, 12)) + +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); +>b : Symbol(b, Decl(other2.ts, 6, 12)) + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other3.ts, 0, 0)) + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 2, 23)) + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 3, 23)) + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : Symbol(a, Decl(other3.ts, 5, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 5, 50)) + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : Symbol(b, Decl(other3.ts, 6, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 6, 50)) + +=== /other4.ts === +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 0, 0), Decl(other4.ts, 8, 46)) +>with : Symbol(with, Decl(other4.ts, 1, 19)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 1, 27)) + +type Attribute2 = { with: {"resolution-mode": "import"} }; +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 1, 59), Decl(other4.ts, 9, 46)) +>with : Symbol(with, Decl(other4.ts, 2, 19)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 2, 27)) + +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other4.ts, 2, 58)) + + & import("pkg", Attribute1).RequireInterface +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) + + & import("pkg", Attribute2).ImportInterface; +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +>a : Symbol(a, Decl(other4.ts, 8, 12)) +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) + +export const b = (null as any as import("pkg", Attribute2).ImportInterface); +>b : Symbol(b, Decl(other4.ts, 9, 12)) +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) +>ImportInterface : Symbol(ImportInterface, Decl(other4.ts, 9, 59)) + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other5.ts, 0, 0)) + + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +>a : Symbol(a, Decl(other5.ts, 4, 12)) + +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); +>b : Symbol(b, Decl(other5.ts, 5, 12)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types new file mode 100644 index 0000000000000..99d04a1deec8a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types @@ -0,0 +1,293 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +=== /other.ts === +// missing with: +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", {"resolution-mode": "require"}).RequireInterface +>"resolution-mode" : "resolution-mode" +> : ^^^^^^^^^^^^^^^^^ +>"require" : "require" +> : ^^^^^^^^^ +>RequireInterface & import("pkg", {"resolution-mode": "import"}).ImportInterface : number +> : ^^^^^^ +>RequireInterface : any +> : ^^^ + + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>import("pkg", {"resolution-mode": "import"}).ImportInterface : any +> : ^^^ +>import("pkg", {"resolution-mode": "import"}) : Promise +> : ^^^^^^^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ +>{"resolution-mode": "import"} : { "resolution-mode": string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"resolution-mode" : string +> : ^^^^^^ +>"import" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { : any +> : ^^^ +>null as any as import("pkg", { : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "resolution-mode" +> : ^^^^^^^^^^^^^^^^^ +>"require" : "require" +> : ^^^^^^^^^ +>RequireInterface : any +> : ^^^ + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { : any +> : ^^^ +>null as any as import("pkg", { : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "resolution-mode" +> : ^^^^^^^^^^^^^^^^^ +>"import" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +=== /other2.ts === +// wrong attribute key +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : "require" +> : ^^^^^^^^^ +>RequireInterface & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : number +> : ^^^^^^ +>RequireInterface : any +> : ^^^ + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +> : ^^^ +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise +> : ^^^^^^^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ +>[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{"resolution-mode": "import"} : { "resolution-mode": string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"resolution-mode" : string +> : ^^^^^^ +>"import" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]) : any +> : ^^^ +>null as any as import("pkg", [ {"resolution-mode": "require"} ] : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "require" +> : ^^^^^^^^^ +>RequireInterface : any +> : ^^^ + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]) : any +> : ^^^ +>null as any as import("pkg", [ {"resolution-mode": "import"} ] : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +=== /other4.ts === +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +>Attribute1 : Attribute1 +> : ^^^^^^^^^^ +>with : { "resolution-mode": "require"; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>"resolution-mode" : "require" +> : ^^^^^^^^^ + +type Attribute2 = { with: {"resolution-mode": "import"} }; +>Attribute2 : Attribute2 +> : ^^^^^^^^^^ +>with : { "resolution-mode": "import"; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>"resolution-mode" : "import" +> : ^^^^^^^^ + +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", Attribute1).RequireInterface +>Attribute1 : any +> : ^^^ +>RequireInterface & import("pkg", Attribute2).ImportInterface : number +> : ^^^^^^ +>RequireInterface : any +> : ^^^ + + & import("pkg", Attribute2).ImportInterface; +>import("pkg", Attribute2).ImportInterface : any +> : ^^^ +>import("pkg", Attribute2) : Promise +> : ^^^^^^^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ +>Attribute2 : any +> : ^^^ +>ImportInterface : any +> : ^^^ + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", : any +> : ^^^ +>null as any as import("pkg", : any +> : ^^^ +>null as any : any +> : ^^^ +>Attribute1 : any +> : ^^^ +>RequireInterface : any +> : ^^^ + +export const b = (null as any as import("pkg", Attribute2).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", : any +> : ^^^ +>null as any as import("pkg", : any +> : ^^^ +>null as any : any +> : ^^^ +>Attribute2 : any +> : ^^^ +>ImportInterface : any +> : ^^^ + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { with: {} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { with: {} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { with: {} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt new file mode 100644 index 0000000000000..5ea35cf935593 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt @@ -0,0 +1,32 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + import {default as _fs} from "fs"; + _fs.readFile; + import * as fs from "fs"; + fs.readFile; +==== index.ts (0 errors) ==== + // esm format file + import {default as _fs} from "fs"; + _fs.readFile; + import * as fs from "fs"; + fs.readFile; +==== 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"; + declare module "tslib" { + export {}; + // intentionally missing all helpers + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js new file mode 100644 index 0000000000000..aab681b9dbd4f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js @@ -0,0 +1,53 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts] //// + +//// [index.ts] +// cjs format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [index.ts] +// esm format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const fs_1 = require("fs"); +fs_1.default.readFile; +const fs = require("fs"); +fs.readFile; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const fs_1 = require("fs"); +fs_1.default.readFile; +const fs = require("fs"); +fs.readFile; + + +//// [index.d.ts] +export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).symbols new file mode 100644 index 0000000000000..100e1481edf0d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).symbols @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts] //// + +=== subfolder/index.ts === +// cjs format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +=== index.ts === +// esm format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).types new file mode 100644 index 0000000000000..6290a2888be05 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).types @@ -0,0 +1,70 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts] //// + +=== subfolder/index.ts === +// cjs format file +import {default as _fs} from "fs"; +>default : any +> : ^^^ +>_fs : any +> : ^^^ + +_fs.readFile; +>_fs.readFile : any +> : ^^^ +>_fs : any +> : ^^^ +>readFile : any +> : ^^^ + +import * as fs from "fs"; +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +=== index.ts === +// esm format file +import {default as _fs} from "fs"; +>default : any +> : ^^^ +>_fs : any +> : ^^^ + +_fs.readFile; +>_fs.readFile : any +> : ^^^ +>_fs : any +> : ^^^ +>readFile : any +> : ^^^ + +import * as fs from "fs"; +>fs : any +> : ^^^ + +fs.readFile; +>fs.readFile : any +> : ^^^ +>fs : any +> : ^^^ +>readFile : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + +declare module "tslib" { +>"tslib" : typeof import("tslib") +> : ^^^^^^^^^^^^^^^^^^^^^^ + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt new file mode 100644 index 0000000000000..6802cc73a3be9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + export * from "fs"; + export * as fs from "fs"; +==== index.ts (0 errors) ==== + // esm format file + export * from "fs"; + export * as fs from "fs"; +==== 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"; + declare module "tslib" { + export {}; + // intentionally missing all helpers + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js new file mode 100644 index 0000000000000..78bfd6a54971e --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js @@ -0,0 +1,77 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts] //// + +//// [index.ts] +// cjs format file +export * from "fs"; +export * as fs from "fs"; +//// [index.ts] +// esm format file +export * from "fs"; +export * as fs from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +// cjs format file +__exportStar(require("fs"), exports); +exports.fs = require("fs"); +//// [index.js] +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +// esm format file +__exportStar(require("fs"), exports); +exports.fs = require("fs"); + + +//// [index.d.ts] +export * from "fs"; +export * as fs from "fs"; +//// [index.d.ts] +export * from "fs"; +export * as fs from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).symbols new file mode 100644 index 0000000000000..e41469a2edb5c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts] //// + +=== subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== index.ts === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).types new file mode 100644 index 0000000000000..84f5d49b9c0c3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).types @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts] //// + +=== subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : any +> : ^^^ + +=== index.ts === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + +declare module "tslib" { +>"tslib" : typeof import("tslib") +> : ^^^^^^^^^^^^^^^^^^^^^^ + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt new file mode 100644 index 0000000000000..da8b48c67f2f3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt @@ -0,0 +1,26 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + export {default} from "fs"; +==== index.ts (0 errors) ==== + // esm format file + export {default} from "fs"; +==== 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"; + declare module "tslib" { + export {}; + // intentionally missing all helpers + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js new file mode 100644 index 0000000000000..0d3ac537e4d18 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts] //// + +//// [index.ts] +// cjs format file +export {default} from "fs"; +//// [index.ts] +// esm format file +export {default} from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; +// cjs format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; +// esm format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); + + +//// [index.d.ts] +export { default } from "fs"; +//// [index.d.ts] +export { default } from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).symbols new file mode 100644 index 0000000000000..db6b4d5b50a13 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts] //// + +=== subfolder/index.ts === +// cjs format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.ts, 1, 8)) + +=== index.ts === +// esm format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.ts, 1, 8)) + +=== types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).types new file mode 100644 index 0000000000000..fe3a6a4729b0b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts] //// + +=== subfolder/index.ts === +// cjs format file +export {default} from "fs"; +>default : any +> : ^^^ + +=== index.ts === +// esm format file +export {default} from "fs"; +>default : any +> : ^^^ + +=== types.d.ts === +declare module "fs"; +>"fs" : any +> : ^^^ + +declare module "tslib" { +>"tslib" : typeof import("tslib") +> : ^^^^^^^^^^^^^^^^^^^^^^ + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt new file mode 100644 index 0000000000000..eea6769e776b3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt @@ -0,0 +1,28 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== 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 (1 errors) ==== + // esm 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}; +==== 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/tests/baselines/reference/nodeModulesImportMeta(module=node18).js b/tests/baselines/reference/nodeModulesImportMeta(module=node18).js new file mode 100644 index 0000000000000..a42ca0aa55d14 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).js @@ -0,0 +1,43 @@ +//// [tests/cases/conformance/node/nodeModulesImportMeta.ts] //// + +//// [index.ts] +// cjs format file +const x = import.meta.url; +export {x}; +//// [index.ts] +// esm format file +const x = import.meta.url; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = import.meta.url; +exports.x = x; +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = import.meta.url; +exports.x = x; + + +//// [index.d.ts] +declare const x: string; +export { x }; +//// [index.d.ts] +declare const x: string; +export { x }; diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node18).symbols b/tests/baselines/reference/nodeModulesImportMeta(module=node18).symbols new file mode 100644 index 0000000000000..dd1b136815bf7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesImportMeta.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.ts, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(ImportMetaExpression.meta) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== index.ts === +// esm format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.ts, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(ImportMetaExpression.meta) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node18).types b/tests/baselines/reference/nodeModulesImportMeta(module=node18).types new file mode 100644 index 0000000000000..b64e4b920275f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).types @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesImportMeta.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = import.meta.url; +>x : string +> : ^^^^^^ +>import.meta.url : string +> : ^^^^^^ +>import.meta : ImportMeta +> : ^^^^^^^^^^ +>meta : ImportMeta +> : ^^^^^^^^^^ +>url : string +> : ^^^^^^ + +export {x}; +>x : string +> : ^^^^^^ + +=== index.ts === +// esm format file +const x = import.meta.url; +>x : string +> : ^^^^^^ +>import.meta.url : string +> : ^^^^^^ +>import.meta : ImportMeta +> : ^^^^^^^^^^ +>meta : ImportMeta +> : ^^^^^^^^^^ +>url : string +> : ^^^^^^ + +export {x}; +>x : string +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index 7ab6639b5d644..550ef21197815 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).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', 'nodenext', or 'preserve'. +/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', 'nodenext', or 'preserve'. +/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) ==== @@ -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', 'nodenext', or 'preserve'. +!!! 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 TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt new file mode 100644 index 0000000000000..3d8953693b202 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,54 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (8 errors) ==== + import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /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/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js new file mode 100644 index 0000000000000..1b8bc65976edc --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols new file mode 100644 index 0000000000000..280c1d65ab17b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types new file mode 100644 index 0000000000000..e2d366a3c018c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ +>Req : any +> : ^^^ + +import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ +>Imp : any +> : ^^^ + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index 06d7b09c3ecbf..1604272f9e21a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,6 +1,6 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/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,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. ==== /index.ts (3 errors) ==== @@ -13,10 +13,10 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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 TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt new file mode 100644 index 0000000000000..101346bd2f985 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt @@ -0,0 +1,59 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (8 errors) ==== + import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /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 {} +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js new file mode 100644 index 0000000000000..7495778bd6fcb --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols new file mode 100644 index 0000000000000..d04d9cd473b9a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types new file mode 100644 index 0000000000000..23b3151bb69bc --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ +>Req : any +> : ^^^ + +import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ +>Imp : any +> : ^^^ + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ + +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index b84ec4d29a319..1bf72bb46af00 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).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', 'nodenext', or 'preserve'. +/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 TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/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 TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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 @@ -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', 'nodenext', or 'preserve'. +!!! 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 TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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 {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt new file mode 100644 index 0000000000000..d9c883dc8faa2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt @@ -0,0 +1,51 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,45): error TS2822: Import assertions cannot be used with type-only imports or exports. +/index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(4,33): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(4,39): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(6,70): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,76): error TS1454: `resolution-mode` can only be set for type-only imports. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (7 errors) ==== + // incorrect mode + import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2822: Import assertions cannot be used with type-only imports or exports. + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + // not type-only + import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + // not exclusively type-only + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + + export interface LocalInterface extends RequireInterface, 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 interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js new file mode 100644 index 0000000000000..3b2af2656d08b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +// incorrect mode +import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +// not type-only +import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg"; +import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols new file mode 100644 index 0000000000000..df997cc77a096 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) + +// not type-only +import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 115)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + + + + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types new file mode 100644 index 0000000000000..6fee3dbb784b5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types @@ -0,0 +1,29 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +>RequireInterface : any +> : ^^^ + +// not type-only +import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : any +> : ^^^ + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : any +> : ^^^ +>Req : any +> : ^^^ +>RequireInterface : any +> : ^^^ +>Req2 : any +> : ^^^ + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt new file mode 100644 index 0000000000000..86748c74923db --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt @@ -0,0 +1,35 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + type; +==== index.mts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + type; +==== index.cts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + type; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.cjs", + "imports": { + "#type": "package" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js new file mode 100644 index 0000000000000..08d6ed09ccb49 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js @@ -0,0 +1,51 @@ +//// [tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts] //// + +//// [index.ts] +// esm format file +import * as type from "#type"; +type; +//// [index.mts] +// esm format file +import * as type from "#type"; +type; +//// [index.cts] +// esm format file +import * as type from "#type"; +type; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.cjs", + "imports": { + "#type": "package" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const type = require("#type"); +type; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const type = require("#type"); +type; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const type = require("#type"); +type; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).symbols b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).symbols new file mode 100644 index 0000000000000..81f53360e0ce2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts] //// + +=== index.ts === +// esm format file +import * as type from "#type"; +>type : Symbol(type, Decl(index.ts, 1, 6)) + +type; +>type : Symbol(type, Decl(index.ts, 1, 6)) + +=== index.mts === +// esm format file +import * as type from "#type"; +>type : Symbol(type, Decl(index.mts, 1, 6)) + +type; +>type : Symbol(type, Decl(index.mts, 1, 6)) + +=== index.cts === +// esm format file +import * as type from "#type"; +>type : Symbol(type, Decl(index.cts, 1, 6)) + +type; +>type : Symbol(type, Decl(index.cts, 1, 6)) + diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types new file mode 100644 index 0000000000000..39ded55adfbea --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts] //// + +=== index.ts === +// esm format file +import * as type from "#type"; +>type : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.mts === +// esm format file +import * as type from "#type"; +>type : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.cts === +// esm format file +import * as type from "#type"; +>type : any +> : ^^^ + +type; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt new file mode 100644 index 0000000000000..3658a2f0d757f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt @@ -0,0 +1,35 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + type; +==== index.mts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + type; +==== index.cts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + type; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "package", + "imports": { + "#type": "package" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js new file mode 100644 index 0000000000000..4d9239ee4390b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js @@ -0,0 +1,51 @@ +//// [tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts] //// + +//// [index.ts] +// esm format file +import * as type from "#type"; +type; +//// [index.mts] +// esm format file +import * as type from "#type"; +type; +//// [index.cts] +// esm format file +import * as type from "#type"; +type; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "package", + "imports": { + "#type": "package" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const type = require("#type"); +type; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const type = require("#type"); +type; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const type = require("#type"); +type; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).symbols b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).symbols new file mode 100644 index 0000000000000..06c86181b6d0d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts] //// + +=== index.ts === +// esm format file +import * as type from "#type"; +>type : Symbol(type, Decl(index.ts, 1, 6)) + +type; +>type : Symbol(type, Decl(index.ts, 1, 6)) + +=== index.mts === +// esm format file +import * as type from "#type"; +>type : Symbol(type, Decl(index.mts, 1, 6)) + +type; +>type : Symbol(type, Decl(index.mts, 1, 6)) + +=== index.cts === +// esm format file +import * as type from "#type"; +>type : Symbol(type, Decl(index.cts, 1, 6)) + +type; +>type : Symbol(type, Decl(index.cts, 1, 6)) + diff --git a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).types b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).types new file mode 100644 index 0000000000000..d00dcba79df38 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts] //// + +=== index.ts === +// esm format file +import * as type from "#type"; +>type : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.mts === +// esm format file +import * as type from "#type"; +>type : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.cts === +// esm format file +import * as type from "#type"; +>type : any +> : ^^^ + +type; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt new file mode 100644 index 0000000000000..eec31746ec2d6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,37 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + +==== /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/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js new file mode 100644 index 0000000000000..100de5460ac25 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +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); + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +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: any; +export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols new file mode 100644 index 0000000000000..143e2ac662bcb --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & 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); +>a : Symbol(a, Decl(index.ts, 4, 12)) + +export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types new file mode 100644 index 0000000000000..7c14534ec1f54 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & 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); +>a : any +> : ^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt new file mode 100644 index 0000000000000..d9b65e97a2fc9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -0,0 +1,337 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(3,22): error TS1005: 'with' expected. +/other.ts(3,39): error TS1005: ';' expected. +/other.ts(3,50): error TS1128: Declaration or statement expected. +/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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +/other.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(6,49): error TS1005: 'with' expected. +/other.ts(6,66): error TS1005: ';' expected. +/other.ts(6,77): error TS1128: Declaration or statement expected. +/other.ts(6,78): error TS1128: Declaration or statement expected. +/other.ts(6,79): error TS1128: Declaration or statement expected. +/other.ts(6,80): error TS1434: Unexpected keyword or identifier. +/other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. +/other.ts(6,96): error TS1128: Declaration or statement expected. +/other.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(7,49): error TS1005: 'with' expected. +/other.ts(7,66): error TS1005: ';' expected. +/other.ts(7,76): error TS1128: Declaration or statement expected. +/other.ts(7,77): error TS1128: Declaration or statement expected. +/other.ts(7,78): error TS1128: Declaration or statement expected. +/other.ts(7,79): error TS1434: Unexpected keyword or identifier. +/other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. +/other.ts(7,94): error TS1128: Declaration or statement expected. +/other2.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(4,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other3.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(3,21): error TS1005: '{' expected. +/other3.ts(3,23): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +/other3.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(6,48): error TS1005: '{' expected. +/other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/other3.ts(6,100): error TS1005: ',' expected. +/other3.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(7,48): error TS1005: '{' expected. +/other3.ts(7,50): error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. +/other3.ts(7,98): error TS1005: ',' expected. +/other4.ts(6,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(6,21): error TS1005: '{' expected. +/other4.ts(6,21): error TS2448: Block-scoped variable 'Asserts1' used before its declaration. +/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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +/other4.ts(9,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(9,48): error TS1005: '{' expected. +/other4.ts(9,56): error TS1005: ',' expected. +/other4.ts(9,57): error TS1134: Variable declaration expected. +/other4.ts(9,74): error TS1005: ',' expected. +/other4.ts(10,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(10,48): error TS1005: '{' expected. +/other4.ts(10,56): error TS1005: ',' expected. +/other4.ts(10,57): error TS1134: Variable declaration expected. +/other4.ts(10,73): error TS1005: ',' expected. +/other5.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /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 {} +==== /index.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +==== /other.ts (28 errors) ==== + // missing assert: + export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~ +!!! error TS1128: Declaration or statement expected. +==== /other2.ts (8 errors) ==== + // wrong assertion key + export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + + export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~ +!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. +==== /other3.ts (17 errors) ==== + // Array instead of object-y thing + export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. +==== /other4.ts (19 errors) ==== + // Indirected assertion objecty-thing - not allowed + type Asserts1 = { assert: {"resolution-mode": "require"} }; + type Asserts2 = { assert: {"resolution-mode": "import"} }; + + export type LocalInterface = + & import("pkg", Asserts1).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:6:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~ +!!! error TS2448: Block-scoped variable 'Asserts1' used before its declaration. +!!! related TS2728 /other4.ts:9:48: 'Asserts1' is declared here. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. + + export const a = (null as any as import("pkg", Asserts1).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:9:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", Asserts2).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:10:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. +==== /other5.ts (8 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + & import("pkg", { assert: {} }).ImportInterface; + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + + export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); + ~~~~~ +!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~ +!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js new file mode 100644 index 0000000000000..7ed465ef0fbe6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js @@ -0,0 +1,147 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); +//// [other.ts] +// missing assert: +export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +//// [other2.ts] +// wrong assertion key +export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +//// [other3.ts] +// Array instead of object-y thing +export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +//// [other4.ts] +// Indirected assertion objecty-thing - not allowed +type Asserts1 = { assert: {"resolution-mode": "require"} }; +type Asserts2 = { assert: {"resolution-mode": "import"} }; + +export type LocalInterface = + & import("pkg", Asserts1).RequireInterface + & import("pkg", Asserts2).ImportInterface; + +export const a = (null as any as import("pkg", Asserts1).RequireInterface); +export const b = (null as any as import("pkg", Asserts2).ImportInterface); +//// [other5.ts] +export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface + & import("pkg", { assert: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +"resolution-mode"; +"require"; +RequireInterface + & import("pkg", { "resolution-mode": "import" }).ImportInterface; +exports.a = null; +"resolution-mode"; +"require"; +RequireInterface; +; +exports.b = null; +"resolution-mode"; +"import"; +ImportInterface; +; +//// [other2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +RequireInterface + & import("pkg", [{ "resolution-mode": "import" }]).ImportInterface; +exports.a = null.RequireInterface; +exports.b = null.ImportInterface; +//// [other4.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ImportInterface = exports.Asserts2 = exports.b = exports.RequireInterface = exports.Asserts1 = exports.a = void 0; +exports.Asserts1; +exports.RequireInterface + & import("pkg", exports.Asserts2).ImportInterface; +exports.a = null; +exports.b = null; +//// [other5.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +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: any; +export declare const b: any; +//// [other.d.ts] +export type LocalInterface = import("pkg", { with: {} }); +export declare const a: import("pkg", { with: {} }); +export declare const b: import("pkg", { with: {} }); +//// [other2.d.ts] +export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; +export declare const a: any; +export declare const b: any; +//// [other3.d.ts] +export type LocalInterface = import("pkg", { with: {} })[{ + "resolution-mode": "require"; +}]; +export declare const a: any; +export declare const b: any; +//// [other4.d.ts] +export type LocalInterface = import("pkg", { with: {} }); +export declare const a: import("pkg", { with: {} }), Asserts1: any, RequireInterface: any; +export declare const b: import("pkg", { with: {} }), Asserts2: any, ImportInterface: any; +//// [other5.d.ts] +export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; +export declare const a: any; +export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols new file mode 100644 index 0000000000000..257a13226618d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols @@ -0,0 +1,116 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts] //// + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) + +export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /other.ts === +// missing assert: +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other.ts, 0, 0)) + + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>"resolution-mode" : Symbol("resolution-mode", Decl(other.ts, 3, 21)) + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : Symbol(a, Decl(other.ts, 5, 12)) + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : Symbol(b, Decl(other.ts, 6, 12)) + +=== /other2.ts === +// wrong assertion key +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other2.ts, 0, 0)) + + & import("pkg", { assert: {"bad": "require"} }).RequireInterface + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +>a : Symbol(a, Decl(other2.ts, 5, 12)) + +export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +>b : Symbol(b, Decl(other2.ts, 6, 12)) + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other3.ts, 0, 0)) + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 2, 23)) + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 3, 23)) + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : Symbol(a, Decl(other3.ts, 5, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 5, 50)) + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : Symbol(b, Decl(other3.ts, 6, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 6, 50)) + +=== /other4.ts === +// Indirected assertion objecty-thing - not allowed +type Asserts1 = { assert: {"resolution-mode": "require"} }; +>Asserts1 : Symbol(Asserts1, Decl(other4.ts, 0, 0), Decl(other4.ts, 8, 46)) +>assert : Symbol(assert, Decl(other4.ts, 1, 17)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 1, 27)) + +type Asserts2 = { assert: {"resolution-mode": "import"} }; +>Asserts2 : Symbol(Asserts2, Decl(other4.ts, 1, 59), Decl(other4.ts, 9, 46)) +>assert : Symbol(assert, Decl(other4.ts, 2, 17)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 2, 27)) + +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other4.ts, 2, 58)) + + & import("pkg", Asserts1).RequireInterface +>Asserts1 : Symbol(Asserts1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 57)) + + & import("pkg", Asserts2).ImportInterface; +>Asserts2 : Symbol(Asserts2, Decl(other4.ts, 9, 46)) + +export const a = (null as any as import("pkg", Asserts1).RequireInterface); +>a : Symbol(a, Decl(other4.ts, 8, 12)) +>Asserts1 : Symbol(Asserts1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 57)) + +export const b = (null as any as import("pkg", Asserts2).ImportInterface); +>b : Symbol(b, Decl(other4.ts, 9, 12)) +>Asserts2 : Symbol(Asserts2, Decl(other4.ts, 9, 46)) +>ImportInterface : Symbol(ImportInterface, Decl(other4.ts, 9, 57)) + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other5.ts, 0, 0)) + + & import("pkg", { assert: {} }).RequireInterface + & import("pkg", { assert: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +>a : Symbol(a, Decl(other5.ts, 4, 12)) + +export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); +>b : Symbol(b, Decl(other5.ts, 5, 12)) + diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types new file mode 100644 index 0000000000000..4ea92fc9facbc --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types @@ -0,0 +1,291 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts] //// + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} +=== /index.ts === +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +=== /other.ts === +// missing assert: +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", {"resolution-mode": "require"}).RequireInterface +>"resolution-mode" : "resolution-mode" +> : ^^^^^^^^^^^^^^^^^ +>"require" : "require" +> : ^^^^^^^^^ +>RequireInterface & import("pkg", {"resolution-mode": "import"}).ImportInterface : number +> : ^^^^^^ +>RequireInterface : any +> : ^^^ + + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>import("pkg", {"resolution-mode": "import"}).ImportInterface : any +> : ^^^ +>import("pkg", {"resolution-mode": "import"}) : Promise +> : ^^^^^^^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ +>{"resolution-mode": "import"} : { "resolution-mode": string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"resolution-mode" : string +> : ^^^^^^ +>"import" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { : any +> : ^^^ +>null as any as import("pkg", { : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "resolution-mode" +> : ^^^^^^^^^^^^^^^^^ +>"require" : "require" +> : ^^^^^^^^^ +>RequireInterface : any +> : ^^^ + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { : any +> : ^^^ +>null as any as import("pkg", { : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "resolution-mode" +> : ^^^^^^^^^^^^^^^^^ +>"import" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +=== /other2.ts === +// wrong assertion key +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", { assert: {"bad": "require"} }).RequireInterface + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : "require" +> : ^^^^^^^^^ +>RequireInterface & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : number +> : ^^^^^^ +>RequireInterface : any +> : ^^^ + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +> : ^^^ +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise +> : ^^^^^^^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ +>[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{"resolution-mode": "import"} : { "resolution-mode": string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"resolution-mode" : string +> : ^^^^^^ +>"import" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]) : any +> : ^^^ +>null as any as import("pkg", [ {"resolution-mode": "require"} ] : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "require" +> : ^^^^^^^^^ +>RequireInterface : any +> : ^^^ + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +> : ^^^ +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]) : any +> : ^^^ +>null as any as import("pkg", [ {"resolution-mode": "import"} ] : any +> : ^^^ +>null as any : any +> : ^^^ +>"resolution-mode" : "import" +> : ^^^^^^^^ +>ImportInterface : any +> : ^^^ + +=== /other4.ts === +// Indirected assertion objecty-thing - not allowed +type Asserts1 = { assert: {"resolution-mode": "require"} }; +>Asserts1 : Asserts1 +> : ^^^^^^^^ +>assert : { "resolution-mode": "require"; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>"resolution-mode" : "require" +> : ^^^^^^^^^ + +type Asserts2 = { assert: {"resolution-mode": "import"} }; +>Asserts2 : Asserts2 +> : ^^^^^^^^ +>assert : { "resolution-mode": "import"; } +> : ^^^^^^^^^^^^^^^^^^^^^ ^^^ +>"resolution-mode" : "import" +> : ^^^^^^^^ + +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", Asserts1).RequireInterface +>Asserts1 : any +> : ^^^ +>RequireInterface & import("pkg", Asserts2).ImportInterface : number +> : ^^^^^^ +>RequireInterface : any +> : ^^^ + + & import("pkg", Asserts2).ImportInterface; +>import("pkg", Asserts2).ImportInterface : any +> : ^^^ +>import("pkg", Asserts2) : Promise +> : ^^^^^^^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ +>Asserts2 : any +> : ^^^ +>ImportInterface : any +> : ^^^ + +export const a = (null as any as import("pkg", Asserts1).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", : any +> : ^^^ +>null as any as import("pkg", : any +> : ^^^ +>null as any : any +> : ^^^ +>Asserts1 : any +> : ^^^ +>RequireInterface : any +> : ^^^ + +export const b = (null as any as import("pkg", Asserts2).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", : any +> : ^^^ +>null as any as import("pkg", : any +> : ^^^ +>null as any : any +> : ^^^ +>Asserts2 : any +> : ^^^ +>ImportInterface : any +> : ^^^ + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : any +> : ^^^ + + & import("pkg", { assert: {} }).RequireInterface + & import("pkg", { assert: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +>a : any +> : ^^^ +>(null as any as import("pkg", { assert: {} }).RequireInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {} }).RequireInterface : any +> : ^^^ +>null as any : any +> : ^^^ + +export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); +>b : any +> : ^^^ +>(null as any as import("pkg", { assert: {} }).ImportInterface) : any +> : ^^^ +>null as any as import("pkg", { assert: {} }).ImportInterface : any +> : ^^^ +>null as any : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesJson(module=node16).errors.txt b/tests/baselines/reference/nodeModulesJson(module=node16).errors.txt index 989bb7dcf9a58..b3f36d73facb4 100644 --- a/tests/baselines/reference/nodeModulesJson(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesJson(module=node16).errors.txt @@ -1,10 +1,10 @@ -/loosey.cts(1,36): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/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(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', 'nodenext', or 'preserve'. -/main.mts(6,52): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/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(8,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node16'. -/main.mts(8,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -/main.mts(9,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/main.mts(8,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/main.mts(9,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(10,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. @@ -49,19 +49,19 @@ import config from "./config.json" with { type: "json" }; // Ok ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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', 'nodenext', or 'preserve'. +!!! 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 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 TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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', 'nodenext', or 'preserve'. +!!! 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; }; }'. @@ -70,7 +70,7 @@ ==== /loosey.cts (2 errors) ==== import config from "./config.json" with { type: "json" }; // Error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import config2 from "./config.json"; // Ok import { version } from "./config.json"; // Ok import * as config3 from "./config.json"; diff --git a/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt b/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt new file mode 100644 index 0000000000000..3a3075f5a7bb1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt @@ -0,0 +1,93 @@ +error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/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(1,22): error TS2792: Cannot find module 'not.json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(2,22): error TS2792: Cannot find module 'actually-json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.mts(3,19): error TS2792: Cannot find module 'actually-json/typed'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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(8,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node18'. +/main.mts(10,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + + +!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /node_modules/not.json/package.json (0 errors) ==== + { + "name": "not.json", + "version": "1.0.0", + "type": "module", + "exports": "./index.js" + } + +==== /node_modules/not.json/index.d.ts (0 errors) ==== + export function oops(json: string): any; + +==== /node_modules/actually-json/package.json (0 errors) ==== + { + "name": "actually-json", + "version": "1.0.0", + "type": "module", + "exports": { + ".": "./index.json", + "./typed": "./typed.d.json.ts" + } + } + +==== /node_modules/actually-json/index.json (0 errors) ==== + {} + +==== /node_modules/actually-json/typed.d.json.ts (0 errors) ==== + declare const _default: {}; + export default _default; + +==== /config.json (0 errors) ==== + { + "version": 1 + } + +==== /main.mts (6 errors) ==== + import { oops } from "not.json"; // Ok + ~~~~~~~~~~ +!!! error TS2792: Cannot find module 'not.json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import moreOops from "actually-json"; // Error in nodenext + ~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'actually-json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import typed from "actually-json/typed"; // Error in nodenext + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'actually-json/typed'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + import config from "./config.json" with { type: "json" }; // Ok + import { default as config1 } from "./config.json" with { type: "json" }; // Ok + 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'. + 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'. + import * as config3 from "./config.json" with { type: "json" }; + config3.version; // Error + ~~~~~~~ +!!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + config3.default; // Ok + +==== /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. + 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 + config3.default; // Error + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type '{ version: number; }'. + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesJson(module=node18).symbols b/tests/baselines/reference/nodeModulesJson(module=node18).symbols new file mode 100644 index 0000000000000..207490214fc88 --- /dev/null +++ b/tests/baselines/reference/nodeModulesJson(module=node18).symbols @@ -0,0 +1,75 @@ +//// [tests/cases/conformance/node/nodeModulesJson.ts] //// + +=== /node_modules/not.json/index.d.ts === +export function oops(json: string): any; +>oops : Symbol(oops, Decl(index.d.ts, 0, 0)) +>json : Symbol(json, Decl(index.d.ts, 0, 21)) + +=== /node_modules/actually-json/typed.d.json.ts === +declare const _default: {}; +>_default : Symbol(_default, Decl(typed.d.json.ts, 0, 13)) + +export default _default; +>_default : Symbol(_default, Decl(typed.d.json.ts, 0, 13)) + +=== /config.json === +{ + "version": 1 +>"version" : Symbol("version", Decl(config.json, 0, 1)) +} + +=== /main.mts === +import { oops } from "not.json"; // Ok +>oops : Symbol(oops, Decl(main.mts, 0, 8)) + +import moreOops from "actually-json"; // Error in nodenext +>moreOops : Symbol(moreOops, Decl(main.mts, 1, 6)) + +import typed from "actually-json/typed"; // Error in nodenext +>typed : Symbol(typed, Decl(main.mts, 2, 6)) + +import config from "./config.json" with { type: "json" }; // Ok +>config : Symbol(config, Decl(main.mts, 4, 6)) + +import { default as config1 } from "./config.json" with { type: "json" }; // Ok +>default : Symbol(config, Decl(config.json, 0, 0)) +>config1 : Symbol(config1, Decl(main.mts, 5, 8)) + +import config2 from "./config.json"; // Error in nodenext, no attribute +>config2 : Symbol(config2, Decl(main.mts, 6, 6)) + +import { version } from "./config.json" with { type: "json" }; // Error, named import +>version : Symbol(version, Decl(main.mts, 7, 8)) + +import * as config3 from "./config.json" with { type: "json" }; +>config3 : Symbol(config3, Decl(main.mts, 8, 6)) + +config3.version; // Error +>config3 : Symbol(config3, Decl(main.mts, 8, 6)) + +config3.default; // Ok +>config3.default : Symbol("/config") +>config3 : Symbol(config3, Decl(main.mts, 8, 6)) +>default : Symbol("/config") + +=== /loosey.cts === +import config from "./config.json" with { type: "json" }; // Error +>config : Symbol(config, Decl(loosey.cts, 0, 6)) + +import config2 from "./config.json"; // Ok +>config2 : Symbol(config2, Decl(loosey.cts, 1, 6)) + +import { version } from "./config.json"; // Ok +>version : Symbol(version, Decl(loosey.cts, 2, 8)) + +import * as config3 from "./config.json"; +>config3 : Symbol(config3, Decl(loosey.cts, 3, 6)) + +config3.version; // Ok +>config3.version : Symbol(version, Decl(config.json, 0, 1)) +>config3 : Symbol(config3, Decl(loosey.cts, 3, 6)) +>version : Symbol(version, Decl(config.json, 0, 1)) + +config3.default; // Error +>config3 : Symbol(config3, Decl(loosey.cts, 3, 6)) + diff --git a/tests/baselines/reference/nodeModulesJson(module=node18).types b/tests/baselines/reference/nodeModulesJson(module=node18).types new file mode 100644 index 0000000000000..f254812ed632d --- /dev/null +++ b/tests/baselines/reference/nodeModulesJson(module=node18).types @@ -0,0 +1,124 @@ +//// [tests/cases/conformance/node/nodeModulesJson.ts] //// + +=== /node_modules/not.json/index.d.ts === +export function oops(json: string): any; +>oops : (json: string) => any +> : ^ ^^ ^^^^^ +>json : string +> : ^^^^^^ + +=== /node_modules/actually-json/typed.d.json.ts === +declare const _default: {}; +>_default : {} +> : ^^ + +export default _default; +>_default : {} +> : ^^ + +=== /config.json === +{ +>{ "version": 1} : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + + "version": 1 +>"version" : number +> : ^^^^^^ +>1 : 1 +> : ^ +} + +=== /main.mts === +import { oops } from "not.json"; // Ok +>oops : any +> : ^^^ + +import moreOops from "actually-json"; // Error in nodenext +>moreOops : any +> : ^^^ + +import typed from "actually-json/typed"; // Error in nodenext +>typed : any +> : ^^^ + +import config from "./config.json" with { type: "json" }; // Ok +>config : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>type : any +> : ^^^ + +import { default as config1 } from "./config.json" with { type: "json" }; // Ok +>default : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>config1 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>type : any +> : ^^^ + +import config2 from "./config.json"; // Error in nodenext, no attribute +>config2 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + +import { version } from "./config.json" with { type: "json" }; // Error, named import +>version : number +> : ^^^^^^ +>type : any +> : ^^^ + +import * as config3 from "./config.json" with { type: "json" }; +>config3 : { default: { version: number; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>type : any +> : ^^^ + +config3.version; // Error +>config3.version : any +> : ^^^ +>config3 : { default: { version: number; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>version : any +> : ^^^ + +config3.default; // Ok +>config3.default : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>config3 : { default: { version: number; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>default : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + +=== /loosey.cts === +import config from "./config.json" with { type: "json" }; // Error +>config : any +> : ^^^ +>type : any +> : ^^^ + +import config2 from "./config.json"; // Ok +>config2 : any +> : ^^^ + +import { version } from "./config.json"; // Ok +>version : number +> : ^^^^^^ + +import * as config3 from "./config.json"; +>config3 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + +config3.version; // Ok +>config3.version : number +> : ^^^^^^ +>config3 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>version : number +> : ^^^^^^ + +config3.default; // Error +>config3.default : any +> : ^^^ +>config3 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>default : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt new file mode 100644 index 0000000000000..cbc2d07c0d648 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt @@ -0,0 +1,172 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (6 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mts (6 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cts (6 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js new file mode 100644 index 0000000000000..0c6d3339216e9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js @@ -0,0 +1,146 @@ +//// [tests/cases/conformance/node/nodeModulesPackageExports.ts] //// + +//// [index.ts] +// 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] +// 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] +// 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; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); +cjs; +mjs; +type; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols new file mode 100644 index 0000000000000..39374133d0504 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols @@ -0,0 +1,176 @@ +//// [tests/cases/conformance/node/nodeModulesPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.ts, 9, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +typei; +>typei : Symbol(typei, Decl(index.ts, 9, 6)) + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.mts, 9, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mts, 9, 6)) + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +import * as mjs from "package/mjs"; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +import * as type from "package"; +>type : Symbol(type, Decl(index.cts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.cts, 3, 6)) + +import * as cjsi from "inner/cjs"; +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +import * as mjsi from "inner/mjs"; +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +import * as typei from "inner"; +>typei : Symbol(typei, Decl(index.cts, 9, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cts, 9, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesPackageExports(module=node18).types new file mode 100644 index 0000000000000..19aabab9d2c1a --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).types @@ -0,0 +1,230 @@ +//// [tests/cases/conformance/node/nodeModulesPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "package/mjs"; +>mjs : any +> : ^^^ + +import * as type from "package"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt new file mode 100644 index 0000000000000..b0dd011d30e70 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt @@ -0,0 +1,67 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import * as cjs from "#cjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; +==== index.mts (3 errors) ==== + // esm format file + import * as cjs from "#cjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjs; + mjs; + type; +==== index.cts (3 errors) ==== + // esm format file + import * as cjs from "#cjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "#type"; + ~~~~~~~ +!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesPackageImports(module=node18).js b/tests/baselines/reference/nodeModulesPackageImports(module=node18).js new file mode 100644 index 0000000000000..30a9f5e4b342b --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).js @@ -0,0 +1,77 @@ +//// [tests/cases/conformance/node/nodeModulesPackageImports.ts] //// + +//// [index.ts] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; +//// [index.mts] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; +//// [index.cts] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js", + "imports": { + "#cjs": "./index.cjs", + "#mjs": "./index.mjs", + "#type": "./index.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("#cjs"); +const mjs = require("#mjs"); +const type = require("#type"); +cjs; +mjs; +type; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("#cjs"); +const mjs = require("#mjs"); +const type = require("#type"); +cjs; +mjs; +type; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjs = require("#cjs"); +const mjs = require("#mjs"); +const type = require("#type"); +cjs; +mjs; +type; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackageImports(module=node18).symbols new file mode 100644 index 0000000000000..2004395af751e --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).symbols @@ -0,0 +1,62 @@ +//// [tests/cases/conformance/node/nodeModulesPackageImports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "#cjs"; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +import * as mjs from "#mjs"; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +import * as type from "#type"; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.ts, 3, 6)) + +=== index.mts === +// esm format file +import * as cjs from "#cjs"; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +import * as mjs from "#mjs"; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +import * as type from "#type"; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.mts, 3, 6)) + +=== index.cts === +// esm format file +import * as cjs from "#cjs"; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +import * as mjs from "#mjs"; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +import * as type from "#type"; +>type : Symbol(type, Decl(index.cts, 3, 6)) + +cjs; +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +mjs; +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +type; +>type : Symbol(type, Decl(index.cts, 3, 6)) + diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json b/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json new file mode 100644 index 0000000000000..5927f2f512fc2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json @@ -0,0 +1,874 @@ +[ + "======== Resolving module '#cjs' from '/.src/index.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File '/.src/#cjs.ts' does not exist.", + "File '/.src/#cjs.tsx' does not exist.", + "File '/.src/#cjs.d.ts' does not exist.", + "File '/#cjs.ts' does not exist.", + "File '/#cjs.tsx' does not exist.", + "File '/#cjs.d.ts' does not exist.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "File '/.src/#cjs.js' does not exist.", + "File '/.src/#cjs.jsx' does not exist.", + "File '/#cjs.js' does not exist.", + "File '/#cjs.jsx' does not exist.", + "======== Module name '#cjs' was not resolved. ========", + "======== Resolving module '#mjs' from '/.src/index.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File '/.src/#mjs.ts' does not exist.", + "File '/.src/#mjs.tsx' does not exist.", + "File '/.src/#mjs.d.ts' does not exist.", + "File '/#mjs.ts' does not exist.", + "File '/#mjs.tsx' does not exist.", + "File '/#mjs.d.ts' does not exist.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "File '/.src/#mjs.js' does not exist.", + "File '/.src/#mjs.jsx' does not exist.", + "File '/#mjs.js' does not exist.", + "File '/#mjs.jsx' does not exist.", + "======== Module name '#mjs' was not resolved. ========", + "======== Resolving module '#type' from '/.src/index.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File '/.src/#type.ts' does not exist.", + "File '/.src/#type.tsx' does not exist.", + "File '/.src/#type.d.ts' does not exist.", + "File '/#type.ts' does not exist.", + "File '/#type.tsx' does not exist.", + "File '/#type.d.ts' does not exist.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "File '/.src/#type.js' does not exist.", + "File '/.src/#type.jsx' does not exist.", + "File '/#type.js' does not exist.", + "File '/#type.jsx' does not exist.", + "======== Module name '#type' was not resolved. ========", + "======== Resolving module '#cjs' from '/.src/index.mts'. ========", + "Resolution for module '#cjs' was found in cache from location '/.src'.", + "======== Module name '#cjs' was not resolved. ========", + "======== Resolving module '#mjs' from '/.src/index.mts'. ========", + "Resolution for module '#mjs' was found in cache from location '/.src'.", + "======== Module name '#mjs' was not resolved. ========", + "======== Resolving module '#type' from '/.src/index.mts'. ========", + "Resolution for module '#type' was found in cache from location '/.src'.", + "======== Module name '#type' was not resolved. ========", + "======== Resolving module '#cjs' from '/.src/index.cts'. ========", + "Resolution for module '#cjs' was found in cache from location '/.src'.", + "======== Module name '#cjs' was not resolved. ========", + "======== Resolving module '#mjs' from '/.src/index.cts'. ========", + "Resolution for module '#mjs' was found in cache from location '/.src'.", + "======== Module name '#mjs' was not resolved. ========", + "======== Resolving module '#type' from '/.src/index.cts'. ========", + "Resolution for module '#type' was found in cache from location '/.src'.", + "======== Module name '#type' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/arraybuffer' from '/.src/__lib_node_modules_lookup_lib.es2017.arraybuffer.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/arraybuffer'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/arraybuffer'", + "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/arraybuffer' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).types b/tests/baselines/reference/nodeModulesPackageImports(module=node18).types new file mode 100644 index 0000000000000..a68648b7bd6d8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).types @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/node/nodeModulesPackageImports.ts] //// + +=== index.ts === +// esm format file +import * as cjs from "#cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "#mjs"; +>mjs : any +> : ^^^ + +import * as type from "#type"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjs from "#cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "#mjs"; +>mjs : any +> : ^^^ + +import * as type from "#type"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + +=== index.cts === +// esm format file +import * as cjs from "#cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "#mjs"; +>mjs : any +> : ^^^ + +import * as type from "#type"; +>type : any +> : ^^^ + +cjs; +>cjs : any +> : ^^^ + +mjs; +>mjs : any +> : ^^^ + +type; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt new file mode 100644 index 0000000000000..507218dfd54fe --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -0,0 +1,122 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mts (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cts (3 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js new file mode 100644 index 0000000000000..eea8a56131b20 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExports.ts] //// + +//// [index.ts] +// 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] +// 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] +// 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; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module", +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./mjs/*": "./*.mjs", + "./js/*": "./*.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index"); +const mjsi = require("inner/mjs/index"); +const typei = require("inner/js/index"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index"); +const mjsi = require("inner/mjs/index"); +const typei = require("inner/js/index"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjsi = require("inner/cjs/index"); +const mjsi = require("inner/mjs/index"); +const typei = require("inner/js/index"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols new file mode 100644 index 0000000000000..1c6db9a7d8368 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols @@ -0,0 +1,122 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExports.ts] //// + +=== index.ts === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : Symbol(cjsi, Decl(index.ts, 1, 6)) + +import * as mjsi from "inner/mjs/index"; +>mjsi : Symbol(mjsi, Decl(index.ts, 2, 6)) + +import * as typei from "inner/js/index"; +>typei : Symbol(typei, Decl(index.ts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.ts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.ts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.ts, 3, 6)) + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : Symbol(cjsi, Decl(index.mts, 1, 6)) + +import * as mjsi from "inner/mjs/index"; +>mjsi : Symbol(mjsi, Decl(index.mts, 2, 6)) + +import * as typei from "inner/js/index"; +>typei : Symbol(typei, Decl(index.mts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mts, 3, 6)) + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/index"; +>cjsi : Symbol(cjsi, Decl(index.cts, 1, 6)) + +import * as mjsi from "inner/mjs/index"; +>mjsi : Symbol(mjsi, Decl(index.cts, 2, 6)) + +import * as typei from "inner/js/index"; +>typei : Symbol(typei, Decl(index.cts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cts, 3, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types new file mode 100644 index 0000000000000..e12d858eb9244 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types @@ -0,0 +1,158 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExports.ts] //// + +=== index.ts === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt new file mode 100644 index 0000000000000..b434585b0ebdf --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -0,0 +1,221 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(8,24): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(9,24): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(10,25): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(8,24): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(9,24): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(10,25): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(8,24): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(9,24): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(10,25): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (6 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; + import * as cjsi2 from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi2 from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei2 from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi2; + mjsi2; + typei2; +==== index.mts (6 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; + import * as cjsi2 from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi2 from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei2 from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi2; + mjsi2; + typei2; +==== index.cts (6 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; + import * as cjsi2 from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi2 from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei2 from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi2; + mjsi2; + typei2; +==== node_modules/inner/exclude/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/exclude/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/exclude/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/exclude/*": null, + "./mjs/*": "./*.mjs", + "./mjs/exclude/*": null, + "./js/*": "./*.js", + "./js/exclude/*": null + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js new file mode 100644 index 0000000000000..47d4d67006a67 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js @@ -0,0 +1,168 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts] //// + +//// [index.ts] +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; +cjsi; +mjsi; +typei; +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; +cjsi2; +mjsi2; +typei2; +//// [index.mts] +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; +cjsi; +mjsi; +typei; +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; +cjsi2; +mjsi2; +typei2; +//// [index.cts] +// cjs format file +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; +cjsi; +mjsi; +typei; +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; +cjsi2; +mjsi2; +typei2; +//// [index.d.ts] +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +import * as mjs from "inner/mjs/exclude/index"; +import * as type from "inner/js/exclude/index"; +export { cjs }; +export { mjs }; +export { type }; +//// [index.d.mts] +// esm format file +import * as cjs from "inner/cjs/exclude/index"; +import * as mjs from "inner/mjs/exclude/index"; +import * as type from "inner/js/exclude/index"; +export { cjs }; +export { mjs }; +export { type }; +//// [index.d.cts] +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +import * as mjs from "inner/mjs/exclude/index"; +import * as type from "inner/js/exclude/index"; +export { cjs }; +export { mjs }; +export { type }; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./cjs/exclude/*": null, + "./mjs/*": "./*.mjs", + "./mjs/exclude/*": null, + "./js/*": "./*.js", + "./js/exclude/*": null + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/exclude/index"); +const mjsi = require("inner/mjs/exclude/index"); +const typei = require("inner/js/exclude/index"); +cjsi; +mjsi; +typei; +const cjsi2 = require("inner/cjs/index"); +const mjsi2 = require("inner/mjs/index"); +const typei2 = require("inner/js/index"); +cjsi2; +mjsi2; +typei2; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/exclude/index"); +const mjsi = require("inner/mjs/exclude/index"); +const typei = require("inner/js/exclude/index"); +cjsi; +mjsi; +typei; +const cjsi2 = require("inner/cjs/index"); +const mjsi2 = require("inner/mjs/index"); +const typei2 = require("inner/js/index"); +cjsi2; +mjsi2; +typei2; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjsi = require("inner/cjs/exclude/index"); +const mjsi = require("inner/mjs/exclude/index"); +const typei = require("inner/js/exclude/index"); +cjsi; +mjsi; +typei; +const cjsi2 = require("inner/cjs/index"); +const mjsi2 = require("inner/mjs/index"); +const typei2 = require("inner/js/index"); +cjsi2; +mjsi2; +typei2; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols new file mode 100644 index 0000000000000..58f51fc936974 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols @@ -0,0 +1,236 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts] //// + +=== index.ts === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : Symbol(cjsi, Decl(index.ts, 1, 6)) + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : Symbol(mjsi, Decl(index.ts, 2, 6)) + +import * as typei from "inner/js/exclude/index"; +>typei : Symbol(typei, Decl(index.ts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.ts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.ts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.ts, 3, 6)) + +import * as cjsi2 from "inner/cjs/index"; +>cjsi2 : Symbol(cjsi2, Decl(index.ts, 7, 6)) + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : Symbol(mjsi2, Decl(index.ts, 8, 6)) + +import * as typei2 from "inner/js/index"; +>typei2 : Symbol(typei2, Decl(index.ts, 9, 6)) + +cjsi2; +>cjsi2 : Symbol(cjsi2, Decl(index.ts, 7, 6)) + +mjsi2; +>mjsi2 : Symbol(mjsi2, Decl(index.ts, 8, 6)) + +typei2; +>typei2 : Symbol(typei2, Decl(index.ts, 9, 6)) + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : Symbol(cjsi, Decl(index.mts, 1, 6)) + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : Symbol(mjsi, Decl(index.mts, 2, 6)) + +import * as typei from "inner/js/exclude/index"; +>typei : Symbol(typei, Decl(index.mts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mts, 3, 6)) + +import * as cjsi2 from "inner/cjs/index"; +>cjsi2 : Symbol(cjsi2, Decl(index.mts, 7, 6)) + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : Symbol(mjsi2, Decl(index.mts, 8, 6)) + +import * as typei2 from "inner/js/index"; +>typei2 : Symbol(typei2, Decl(index.mts, 9, 6)) + +cjsi2; +>cjsi2 : Symbol(cjsi2, Decl(index.mts, 7, 6)) + +mjsi2; +>mjsi2 : Symbol(mjsi2, Decl(index.mts, 8, 6)) + +typei2; +>typei2 : Symbol(typei2, Decl(index.mts, 9, 6)) + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : Symbol(cjsi, Decl(index.cts, 1, 6)) + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : Symbol(mjsi, Decl(index.cts, 2, 6)) + +import * as typei from "inner/js/exclude/index"; +>typei : Symbol(typei, Decl(index.cts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cts, 3, 6)) + +import * as cjsi2 from "inner/cjs/index"; +>cjsi2 : Symbol(cjsi2, Decl(index.cts, 7, 6)) + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : Symbol(mjsi2, Decl(index.cts, 8, 6)) + +import * as typei2 from "inner/js/index"; +>typei2 : Symbol(typei2, Decl(index.cts, 9, 6)) + +cjsi2; +>cjsi2 : Symbol(cjsi2, Decl(index.cts, 7, 6)) + +mjsi2; +>mjsi2 : Symbol(mjsi2, Decl(index.cts, 8, 6)) + +typei2; +>typei2 : Symbol(typei2, Decl(index.cts, 9, 6)) + +=== node_modules/inner/exclude/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/exclude/index"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/exclude/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/exclude/index"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/exclude/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/exclude/index"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/index"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/index"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types new file mode 100644 index 0000000000000..9e3505eb6f132 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types @@ -0,0 +1,308 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts] //// + +=== index.ts === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/exclude/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +import * as cjsi2 from "inner/cjs/index"; +>cjsi2 : any +> : ^^^ + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : any +> : ^^^ + +import * as typei2 from "inner/js/index"; +>typei2 : any +> : ^^^ + +cjsi2; +>cjsi2 : any +> : ^^^ + +mjsi2; +>mjsi2 : any +> : ^^^ + +typei2; +>typei2 : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/exclude/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +import * as cjsi2 from "inner/cjs/index"; +>cjsi2 : any +> : ^^^ + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : any +> : ^^^ + +import * as typei2 from "inner/js/index"; +>typei2 : any +> : ^^^ + +cjsi2; +>cjsi2 : any +> : ^^^ + +mjsi2; +>mjsi2 : any +> : ^^^ + +typei2; +>typei2 : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/exclude/index"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/exclude/index"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/exclude/index"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +import * as cjsi2 from "inner/cjs/index"; +>cjsi2 : any +> : ^^^ + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : any +> : ^^^ + +import * as typei2 from "inner/js/index"; +>typei2 : any +> : ^^^ + +cjsi2; +>cjsi2 : any +> : ^^^ + +mjsi2; +>mjsi2 : any +> : ^^^ + +typei2; +>typei2 : any +> : ^^^ + +=== node_modules/inner/exclude/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/exclude/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/exclude/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/exclude/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/exclude/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/exclude/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/exclude/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/exclude/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt new file mode 100644 index 0000000000000..6cc66ddd5b3e9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -0,0 +1,122 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.mts (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== index.cts (3 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as typei from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (3 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import * as type from "inner/js/index.js"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + 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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js new file mode 100644 index 0000000000000..09239e1b577a0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts] //// + +//// [index.ts] +// 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] +// 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] +// 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; +//// [index.d.ts] +// 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 }; +//// [index.d.mts] +// 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 }; +//// [index.d.cts] +// 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] +{ + "name": "package", + "private": true, + "type": "module", +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + "./cjs/*.cjs": "./*.cjs", + "./mjs/*.mjs": "./*.mjs", + "./js/*.js": "./*.js" + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index.cjs"); +const mjsi = require("inner/mjs/index.mjs"); +const typei = require("inner/js/index.js"); +cjsi; +mjsi; +typei; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const cjsi = require("inner/cjs/index.cjs"); +const mjsi = require("inner/mjs/index.mjs"); +const typei = require("inner/js/index.js"); +cjsi; +mjsi; +typei; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const cjsi = require("inner/cjs/index.cjs"); +const mjsi = require("inner/mjs/index.mjs"); +const typei = require("inner/js/index.js"); +cjsi; +mjsi; +typei; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols new file mode 100644 index 0000000000000..522dc53a6b0ee --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols @@ -0,0 +1,122 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts] //// + +=== index.ts === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : Symbol(cjsi, Decl(index.ts, 1, 6)) + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : Symbol(mjsi, Decl(index.ts, 2, 6)) + +import * as typei from "inner/js/index.js"; +>typei : Symbol(typei, Decl(index.ts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.ts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.ts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.ts, 3, 6)) + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : Symbol(cjsi, Decl(index.mts, 1, 6)) + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : Symbol(mjsi, Decl(index.mts, 2, 6)) + +import * as typei from "inner/js/index.js"; +>typei : Symbol(typei, Decl(index.mts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.mts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.mts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.mts, 3, 6)) + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : Symbol(cjsi, Decl(index.cts, 1, 6)) + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : Symbol(mjsi, Decl(index.cts, 2, 6)) + +import * as typei from "inner/js/index.js"; +>typei : Symbol(typei, Decl(index.cts, 3, 6)) + +cjsi; +>cjsi : Symbol(cjsi, Decl(index.cts, 1, 6)) + +mjsi; +>mjsi : Symbol(mjsi, Decl(index.cts, 2, 6)) + +typei; +>typei : Symbol(typei, Decl(index.cts, 3, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) + +import * as type from "inner/js/index.js"; +>type : Symbol(type, Decl(index.d.ts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.ts, 6, 8)) + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) + +import * as type from "inner/js/index.js"; +>type : Symbol(type, Decl(index.d.mts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.mts, 6, 8)) + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) + +import * as type from "inner/js/index.js"; +>type : Symbol(type, Decl(index.d.cts, 3, 6)) + +export { cjs }; +>cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>type : Symbol(type, Decl(index.d.cts, 6, 8)) + diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json new file mode 100644 index 0000000000000..b30360e496914 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -0,0 +1,837 @@ +[ + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File name '/.src/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "File name '/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "File name '/.src/node_modules/@types/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "File name '/node_modules/@types/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "File name '/.src/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "File name '/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File name '/.src/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "File name '/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "File name '/.src/node_modules/@types/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "File name '/node_modules/@types/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "File name '/.src/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "File name '/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/index.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File name '/.src/inner/js/index.js' has a '.js' extension - stripping it.", + "File name '/inner/js/index.js' has a '.js' extension - stripping it.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "File name '/.src/node_modules/@types/inner/js/index.js' has a '.js' extension - stripping it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "File name '/node_modules/@types/inner/js/index.js' has a '.js' extension - stripping it.", + "File name '/.src/inner/js/index.js' has a '.js' extension - stripping it.", + "File name '/inner/js/index.js' has a '.js' extension - stripping it.", + "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== Module name 'inner/js/index.js' was not resolved. ========", + "Found 'package.json' at '/.src/node_modules/inner/package.json'.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File name '/.src/node_modules/inner/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "File name '/.src/node_modules/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File name '/.src/node_modules/inner/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "File name '/.src/node_modules/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ========", + "Module resolution kind is not specified, using 'Classic'.", + "File name '/.src/node_modules/inner/inner/js/index.js' has a '.js' extension - stripping it.", + "File name '/.src/node_modules/inner/js/index.js' has a '.js' extension - stripping it.", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/arraybuffer' from '/.src/__lib_node_modules_lookup_lib.es2017.arraybuffer.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/arraybuffer'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/arraybuffer'", + "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/arraybuffer' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types new file mode 100644 index 0000000000000..2f12cac8afb3a --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types @@ -0,0 +1,158 @@ +//// [tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts] //// + +=== index.ts === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index.js"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index.js"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : any +> : ^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : any +> : ^^^ + +import * as typei from "inner/js/index.js"; +>typei : any +> : ^^^ + +cjsi; +>cjsi : any +> : ^^^ + +mjsi; +>mjsi : any +> : ^^^ + +typei; +>typei : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index.js"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index.js"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : any +> : ^^^ + +import * as type from "inner/js/index.js"; +>type : any +> : ^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : any +> : ^^^ + +export { type }; +>type : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node16).errors.txt b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node16).errors.txt index 28215efa84cbd..25a8b3a5e995e 100644 --- a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node16).errors.txt @@ -1,17 +1,17 @@ -index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -index.ts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +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.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) ==== import pkg from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! 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', 'nodenext', or 'preserve'. +!!! 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) ==== @@ -23,11 +23,11 @@ index.ts(3,38): error TS2823: Import attributes are only supported when the '--m ==== 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', 'nodenext', or 'preserve'. +!!! 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', 'nodenext', or 'preserve'. +!!! 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; ==== package.json (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt new file mode 100644 index 0000000000000..dd1786c54b352 --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt @@ -0,0 +1,43 @@ +error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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.ts(2,25): error TS2339: Property 'name' does not exist on type 'string'. +index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. + + +!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (2 errors) ==== + import pkg from "./package.json" with { type: "json" }; + export const name = pkg.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type 'string'. + import * as ns from "./package.json" with { type: "json" }; + export const thing = ns; + export const name2 = ns.default.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type 'string'. +==== 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 (0 errors) ==== + import pkg from "./package.json" with { type: "json" }; + export const name = pkg.name; + import * as ns from "./package.json" with { type: "json" }; + export const thing = ns; + export const name2 = ns.default.name; +==== package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "type": "module", + "default": "misedirection" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js new file mode 100644 index 0000000000000..af502406763e4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js @@ -0,0 +1,93 @@ +//// [tests/cases/conformance/node/nodeModulesResolveJsonModule.ts] //// + +//// [index.ts] +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; +//// [index.cts] +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] +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "type": "module", + "default": "misedirection" +} + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "type": "module", + "default": "misedirection" +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.name2 = exports.thing = exports.name = void 0; +const package_json_1 = require("./package.json"); +exports.name = package_json_1.default.name; +const ns = require("./package.json"); +exports.thing = ns; +exports.name2 = ns.default.name; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.name2 = exports.thing = exports.name = void 0; +const package_json_1 = require("./package.json"); +exports.name = package_json_1.default.name; +const ns = require("./package.json"); +exports.thing = ns; +exports.name2 = ns.default.name; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.name2 = exports.thing = exports.name = void 0; +const package_json_1 = require("./package.json"); +exports.name = package_json_1.default.name; +const ns = require("./package.json"); +exports.thing = ns; +exports.name2 = ns.default.name; + + +//// [index.d.ts] +export declare const name: any; +export declare const thing: { + name: string; + version: string; + type: string; + default: string; +}; +export declare const name2: any; +//// [index.d.cts] +export declare const name: any; +export declare const thing: { + name: string; + version: string; + type: string; + default: string; +}; +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; + }; +}; +export declare const name2: string; diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols new file mode 100644 index 0000000000000..edd3cc7a55d66 --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols @@ -0,0 +1,83 @@ +//// [tests/cases/conformance/node/nodeModulesResolveJsonModule.ts] //// + +=== index.ts === +import pkg from "./package.json" with { type: "json" }; +>pkg : Symbol(pkg, Decl(index.ts, 0, 6)) + +export const name = pkg.name; +>name : Symbol(name, Decl(index.ts, 1, 12)) +>pkg : Symbol(pkg, Decl(index.ts, 0, 6)) + +import * as ns from "./package.json" with { type: "json" }; +>ns : Symbol(ns, Decl(index.ts, 2, 6)) + +export const thing = ns; +>thing : Symbol(thing, Decl(index.ts, 3, 12)) +>ns : Symbol(ns, Decl(index.ts, 2, 6)) + +export const name2 = ns.default.name; +>name2 : Symbol(name2, Decl(index.ts, 4, 12)) +>ns.default : Symbol(pkg, Decl(package.json, 3, 21)) +>ns : Symbol(ns, Decl(index.ts, 2, 6)) +>default : Symbol(pkg, Decl(package.json, 3, 21)) + +=== index.cts === +import pkg from "./package.json"; +>pkg : Symbol(pkg, Decl(index.cts, 0, 6)) + +export const name = pkg.name; +>name : Symbol(name, Decl(index.cts, 1, 12)) +>pkg : Symbol(pkg, Decl(index.cts, 0, 6)) + +import * as ns from "./package.json"; +>ns : Symbol(ns, Decl(index.cts, 2, 6)) + +export const thing = ns; +>thing : Symbol(thing, Decl(index.cts, 3, 12)) +>ns : Symbol(ns, Decl(index.cts, 2, 6)) + +export const name2 = ns.default.name; +>name2 : Symbol(name2, Decl(index.cts, 4, 12)) +>ns.default : Symbol(pkg, Decl(package.json, 3, 21)) +>ns : Symbol(ns, Decl(index.cts, 2, 6)) +>default : Symbol(pkg, Decl(package.json, 3, 21)) + +=== index.mts === +import pkg from "./package.json" with { type: "json" }; +>pkg : Symbol(pkg, Decl(index.mts, 0, 6)) + +export const name = pkg.name; +>name : Symbol(name, Decl(index.mts, 1, 12)) +>pkg.name : Symbol("name", Decl(package.json, 0, 1)) +>pkg : Symbol(pkg, Decl(index.mts, 0, 6)) +>name : Symbol("name", Decl(package.json, 0, 1)) + +import * as ns from "./package.json" with { type: "json" }; +>ns : Symbol(ns, Decl(index.mts, 2, 6)) + +export const thing = ns; +>thing : Symbol(thing, Decl(index.mts, 3, 12)) +>ns : Symbol(ns, Decl(index.mts, 2, 6)) + +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 : Symbol("package") +>ns : Symbol(ns, Decl(index.mts, 2, 6)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) + +=== package.json === +{ + "name": "pkg", +>"name" : Symbol("name", Decl(package.json, 0, 1)) + + "version": "0.0.1", +>"version" : Symbol("version", Decl(package.json, 1, 18)) + + "type": "module", +>"type" : Symbol("type", Decl(package.json, 2, 23)) + + "default": "misedirection" +>"default" : Symbol("default", Decl(package.json, 3, 21)) +} diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types new file mode 100644 index 0000000000000..4a3846f3fc72d --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types @@ -0,0 +1,156 @@ +//// [tests/cases/conformance/node/nodeModulesResolveJsonModule.ts] //// + +=== index.ts === +import pkg from "./package.json" with { type: "json" }; +>pkg : string +> : ^^^^^^ +>type : any +> : ^^^ + +export const name = pkg.name; +>name : any +> : ^^^ +>pkg.name : any +> : ^^^ +>pkg : string +> : ^^^^^^ +>name : any +> : ^^^ + +import * as ns from "./package.json" with { type: "json" }; +>ns : { 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; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +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 +> : ^^^ + +=== index.cts === +import pkg from "./package.json"; +>pkg : string +> : ^^^^^^ + +export const name = pkg.name; +>name : any +> : ^^^ +>pkg.name : any +> : ^^^ +>pkg : string +> : ^^^^^^ +>name : any +> : ^^^ + +import * as ns from "./package.json"; +>ns : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +export const thing = ns; +>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 : any +> : ^^^ +>ns.default.name : any +> : ^^^ +>ns.default : string +> : ^^^^^^ +>ns : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>default : string +> : ^^^^^^ +>name : any +> : ^^^ + +=== index.mts === +import pkg from "./package.json" with { type: "json" }; +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>type : any +> : ^^^ + +export const name = pkg.name; +>name : string +> : ^^^^^^ +>pkg.name : string +> : ^^^^^^ +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>name : string +> : ^^^^^^ + +import * as ns from "./package.json" with { type: "json" }; +>ns : { default: { 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; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +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 +> : ^^^^^^ + +=== package.json === +{ +>{ "name": "pkg", "version": "0.0.1", "type": "module", "default": "misedirection"} : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + "name": "pkg", +>"name" : string +> : ^^^^^^ +>"pkg" : "pkg" +> : ^^^^^ + + "version": "0.0.1", +>"version" : string +> : ^^^^^^ +>"0.0.1" : "0.0.1" +> : ^^^^^^^ + + "type": "module", +>"type" : string +> : ^^^^^^ +>"module" : "module" +> : ^^^^^^^^ + + "default": "misedirection" +>"default" : string +> : ^^^^^^ +>"misedirection" : "misedirection" +> : ^^^^^^^^^^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt new file mode 100644 index 0000000000000..d5ff2aa5de6e1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt @@ -0,0 +1,36 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== subfolder/index.ts (0 errors) ==== + // cjs format file + import {h} from "../index.js"; + import mod = require("../index.js"); + 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 (0 errors) ==== + // esm format file + import {h as _h} from "./index.js"; + import mod = require("./index.js"); + 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/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js new file mode 100644 index 0000000000000..0b0f71fc7f5d6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js @@ -0,0 +1,62 @@ +//// [tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts] //// + +//// [index.ts] +// cjs format file +import {h} from "../index.js"; +import mod = require("../index.js"); +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] +// esm format file +import {h as _h} from "./index.js"; +import mod = require("./index.js"); +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] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.h = h; +const index_js_1 = require("./subfolder/index.js"); +async function h() { + const mod3 = await import("./index.js"); + const mod4 = await import("./subfolder/index.js"); + (0, index_js_1.f)(); +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = f; +// cjs format file +const index_js_1 = require("../index.js"); +async function f() { + const mod3 = await import("../index.js"); + const mod4 = await import("./index.js"); + (0, index_js_1.h)(); +} + + +//// [index.d.ts] +export declare function h(): Promise; +//// [index.d.ts] +export declare function f(): Promise; diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).symbols b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).symbols new file mode 100644 index 0000000000000..c6feab94f0b7b --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).symbols @@ -0,0 +1,60 @@ +//// [tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts] //// + +=== subfolder/index.ts === +// cjs format file +import {h} from "../index.js"; +>h : Symbol(h, Decl(index.ts, 1, 8)) + +import mod = require("../index.js"); +>mod : Symbol(mod, Decl(index.ts, 1, 30)) + +import {f as _f} from "./index.js"; +>f : Symbol(f, Decl(index.ts, 4, 36)) +>_f : Symbol(_f, Decl(index.ts, 3, 8)) + +import mod2 = require("./index.js"); +>mod2 : Symbol(mod2, Decl(index.ts, 3, 35)) + +export async function f() { +>f : Symbol(f, Decl(index.ts, 4, 36)) + + const mod3 = await import ("../index.js"); +>mod3 : Symbol(mod3, Decl(index.ts, 6, 9)) +>"../index.js" : Symbol(mod, Decl(index.ts, 0, 0)) + + const mod4 = await import ("./index.js"); +>mod4 : Symbol(mod4, Decl(index.ts, 7, 9)) +>"./index.js" : Symbol(mod2, Decl(index.ts, 0, 0)) + + h(); +>h : Symbol(h, Decl(index.ts, 1, 8)) +} +=== index.ts === +// esm format file +import {h as _h} from "./index.js"; +>h : Symbol(h, Decl(index.ts, 4, 46)) +>_h : Symbol(_h, Decl(index.ts, 1, 8)) + +import mod = require("./index.js"); +>mod : Symbol(mod, Decl(index.ts, 1, 35)) + +import {f} from "./subfolder/index.js"; +>f : Symbol(f, Decl(index.ts, 3, 8)) + +import mod2 = require("./subfolder/index.js"); +>mod2 : Symbol(mod2, Decl(index.ts, 3, 39)) + +export async function h() { +>h : Symbol(h, Decl(index.ts, 4, 46)) + + const mod3 = await import ("./index.js"); +>mod3 : Symbol(mod3, Decl(index.ts, 6, 9)) +>"./index.js" : Symbol(mod, Decl(index.ts, 0, 0)) + + const mod4 = await import ("./subfolder/index.js"); +>mod4 : Symbol(mod4, Decl(index.ts, 7, 9)) +>"./subfolder/index.js" : Symbol(mod2, Decl(index.ts, 0, 0)) + + f(); +>f : Symbol(f, Decl(index.ts, 3, 8)) +} diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types new file mode 100644 index 0000000000000..890bce62e15de --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types @@ -0,0 +1,102 @@ +//// [tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts] //// + +=== subfolder/index.ts === +// cjs format file +import {h} from "../index.js"; +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod = require("../index.js"); +>mod : typeof mod +> : ^^^^^^^^^^ + +import {f as _f} from "./index.js"; +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>_f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod2 = require("./index.js"); +>mod2 : typeof mod2 +> : ^^^^^^^^^^^ + +export async function f() { +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const mod3 = await import ("../index.js"); +>mod3 : typeof mod +> : ^^^^^^^^^^ +>await import ("../index.js") : typeof mod +> : ^^^^^^^^^^ +>import ("../index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"../index.js" : "../index.js" +> : ^^^^^^^^^^^^^ + + const mod4 = await import ("./index.js"); +>mod4 : typeof mod2 +> : ^^^^^^^^^^^ +>await import ("./index.js") : typeof mod2 +> : ^^^^^^^^^^^ +>import ("./index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^^ +>"./index.js" : "./index.js" +> : ^^^^^^^^^^^^ + + h(); +>h() : Promise +> : ^^^^^^^^^^^^^ +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +} +=== index.ts === +// esm format file +import {h as _h} from "./index.js"; +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +>_h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod = require("./index.js"); +>mod : typeof mod +> : ^^^^^^^^^^ + +import {f} from "./subfolder/index.js"; +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + +import mod2 = require("./subfolder/index.js"); +>mod2 : typeof mod2 +> : ^^^^^^^^^^^ + +export async function h() { +>h : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ + + const mod3 = await import ("./index.js"); +>mod3 : typeof mod +> : ^^^^^^^^^^ +>await import ("./index.js") : typeof mod +> : ^^^^^^^^^^ +>import ("./index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^ +>"./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 +> : ^^^^^^^^^^^^^^^^^^^^ +>"./subfolder/index.js" : "./subfolder/index.js" +> : ^^^^^^^^^^^^^^^^^^^^^^ + + f(); +>f() : Promise +> : ^^^^^^^^^^^^^ +>f : () => Promise +> : ^^^^^^^^^^^^^^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt new file mode 100644 index 0000000000000..c4b38653e2066 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt @@ -0,0 +1,36 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== 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. + 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) ==== + // 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", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js new file mode 100644 index 0000000000000..c39cdd61dff4b --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/node/nodeModulesTopLevelAwait.ts] //// + +//// [index.ts] +// cjs format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [index.ts] +// esm format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = await 1; +exports.x = x; +for await (const y of []) { } +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// esm format file +const x = await 1; +exports.x = x; +for await (const y of []) { } + + +//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.ts] +declare const x = 1; +export { x }; diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).symbols b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).symbols new file mode 100644 index 0000000000000..c031a3a84d991 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesTopLevelAwait.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = await 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.ts, 3, 16)) + +=== index.ts === +// esm format file +const x = await 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.ts, 3, 16)) + diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).types b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).types new file mode 100644 index 0000000000000..993c334814568 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).types @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/node/nodeModulesTopLevelAwait.ts] //// + +=== subfolder/index.ts === +// cjs format file +const x = await 1; +>x : 1 +> : ^ +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +for await (const y of []) {} +>y : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + +=== index.ts === +// esm format file +const x = await 1; +>x : 1 +> : ^ +>await 1 : 1 +> : ^ +>1 : 1 +> : ^ + +export {x}; +>x : 1 +> : ^ + +for await (const y of []) {} +>y : any +> : ^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt new file mode 100644 index 0000000000000..800ea564bb92f --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,32 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/index.ts(2,41): error TS2304: Cannot find name 'RequireInterface'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (2 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + export interface LocalInterface extends RequireInterface {} + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name '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 {} + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface {} + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).js new file mode 100644 index 0000000000000..fe56029e4550f --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface {} +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface {} +} +//// [index.ts] +/// +export interface LocalInterface extends RequireInterface {} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// + + +//// [index.d.ts] +/// +export interface LocalInterface extends RequireInterface { +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols new file mode 100644 index 0000000000000..3e24f512d0b9c --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts] //// + +=== /index.ts === +/// +export interface LocalInterface extends RequireInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types new file mode 100644 index 0000000000000..b2607cd389551 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts] //// + +=== /index.ts === + +/// +export interface LocalInterface extends RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt new file mode 100644 index 0000000000000..bd0d87a46409b --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt @@ -0,0 +1,37 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (2 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + 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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js new file mode 100644 index 0000000000000..ae8fe6ec2ab1e --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface {} +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface {} +} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +/// +export interface LocalInterface extends ImportInterface {} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// + + +//// [index.d.ts] +/// +export interface LocalInterface extends ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols new file mode 100644 index 0000000000000..f597f1ce06801 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols @@ -0,0 +1,7 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts] //// + +=== /index.ts === +/// +export interface LocalInterface extends ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types new file mode 100644 index 0000000000000..0507e04d1dac4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts] //// + +=== /index.ts === + +/// +export interface LocalInterface extends ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt new file mode 100644 index 0000000000000..ac63d6536476a --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt @@ -0,0 +1,31 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (0 errors) ==== + /// + export interface LocalInterface extends 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 {} + } +==== /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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js new file mode 100644 index 0000000000000..48b106a94af98 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface {} +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface {} +} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +/// +export interface LocalInterface extends RequireInterface {} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// + + +//// [index.d.ts] +/// +export interface LocalInterface extends RequireInterface { +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).symbols new file mode 100644 index 0000000000000..bfbd450d9dbd0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts] //// + +=== /index.ts === +/// +export interface LocalInterface extends RequireInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) + +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).types new file mode 100644 index 0000000000000..f56da1e5c1cb5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts] //// + +=== /index.ts === + +/// +export interface LocalInterface extends RequireInterface {} +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : any +> : ^^^ + + interface RequireInterface {} +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt new file mode 100644 index 0000000000000..2707a6fc22430 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt @@ -0,0 +1,26 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (0 errors) ==== + /// + export interface LocalInterface extends 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 {} + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).js new file mode 100644 index 0000000000000..db90df830c912 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface {} +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface {} +} +//// [index.ts] +/// +export interface LocalInterface extends ImportInterface {} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// + + +//// [index.d.ts] +/// +export interface LocalInterface extends ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).symbols new file mode 100644 index 0000000000000..e719de58b3b23 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts] //// + +=== /index.ts === +/// +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 === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).types new file mode 100644 index 0000000000000..4335bc3ab76a4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts] //// + +=== /index.ts === + +/// +export interface LocalInterface extends ImportInterface {} +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : any +> : ^^^ + + interface ImportInterface {} +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt new file mode 100644 index 0000000000000..745421bf23b34 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt @@ -0,0 +1,27 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (0 errors) ==== + /// + /// + export interface LocalInterface extends ImportInterface, 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 {} + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface {} + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).js new file mode 100644 index 0000000000000..c493d944dd946 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface {} +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface {} +} +//// [index.ts] +/// +/// +export interface LocalInterface extends ImportInterface, RequireInterface {} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +/// + + +//// [index.d.ts] +/// +/// +export interface LocalInterface extends ImportInterface, RequireInterface { +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).symbols new file mode 100644 index 0000000000000..3508b838ed8fb --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts] //// + +=== /index.ts === +/// +/// +export interface LocalInterface extends ImportInterface, RequireInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) + +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +} +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).types new file mode 100644 index 0000000000000..1b71bbe867818 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts] //// + +=== /index.ts === + +/// +/// +export interface LocalInterface extends ImportInterface, RequireInterface {} +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : any +> : ^^^ + + interface ImportInterface {} +} +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : any +> : ^^^ + + interface RequireInterface {} +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt new file mode 100644 index 0000000000000..02e13245a3b84 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt @@ -0,0 +1,37 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/uses.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/uses.ts(2,16): error TS2304: Cannot find name 'getInterR'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (0 errors) ==== + import obj from "./uses.js" + export default (obj as typeof obj); +==== /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 {} + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface {} + function getInterR(): RequireInterface; + } +==== /uses.ts (2 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + export default getInterR(); + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'getInterR'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js new file mode 100644 index 0000000000000..ec6e8f20408f5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js @@ -0,0 +1,50 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface {} + function getInterI(): ImportInterface; +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface {} + function getInterR(): RequireInterface; +} +//// [uses.ts] +/// +export default getInterR(); +//// [index.ts] +import obj from "./uses.js" +export default (obj as typeof obj); + +//// [uses.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +exports.default = getInterR(); +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const uses_js_1 = require("./uses.js"); +exports.default = uses_js_1.default; + + +//// [uses.d.ts] +/// +declare const _default: any; +export default _default; +//// [index.d.ts] +import obj from "./uses.js"; +declare const _default: typeof obj; +export default _default; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols new file mode 100644 index 0000000000000..ee2567988fca6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts] //// + +=== /index.ts === +import obj from "./uses.js" +>obj : Symbol(obj, Decl(index.ts, 0, 6)) + +export default (obj as typeof obj); +>obj : Symbol(obj, Decl(index.ts, 0, 6)) +>obj : Symbol(obj, Decl(index.ts, 0, 6)) + +=== /uses.ts === + +/// +export default getInterR(); diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types new file mode 100644 index 0000000000000..e303918eaf382 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts] //// + +=== /index.ts === +import obj from "./uses.js" +>obj : any +> : ^^^ + +export default (obj as typeof obj); +>(obj as typeof obj) : any +> : ^^^ +>obj as typeof obj : any +> : ^^^ +>obj : any +> : ^^^ +>obj : any +> : ^^^ + +=== /uses.ts === +/// +export default getInterR(); +>getInterR() : any +> : ^^^ +>getInterR : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt new file mode 100644 index 0000000000000..f12cdc00b0346 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt @@ -0,0 +1,63 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/sub1/uses.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/sub1/uses.ts(2,16): error TS2304: Cannot find name 'getInterI'. +/sub2/uses.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/sub2/uses.ts(2,16): error TS2304: Cannot find name 'getInterR'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (0 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; +==== /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 (2 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + export default getInterI(); + ~~~~~~~~~ +!!! error TS2304: Cannot find name 'getInterI'. +==== /sub1/package.json (0 errors) ==== + { + "private": true, + "type": "module" + } +==== /sub2/uses.ts (2 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + export default getInterR(); + ~~~~~~~~~ +!!! error TS2304: Cannot find name '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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js new file mode 100644 index 0000000000000..221a17c87dec4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + interface ImportInterface { _i: any; } + function getInterI(): ImportInterface; +} +//// [require.d.ts] +export {}; +declare global { + interface RequireInterface { _r: any; } + function getInterR(): RequireInterface; +} +//// [uses.ts] +/// +export default getInterI(); +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [uses.ts] +/// +export default getInterR(); +//// [package.json] +{ + "private": true, + "type": "commonjs" +} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +// 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; + +//// [uses.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +exports.default = getInterI(); +//// [uses.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +exports.default = getInterR(); +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// only an esm file can `import` both kinds of files +const uses_js_1 = require("./sub1/uses.js"); +const uses_js_2 = require("./sub2/uses.js"); +exports.default = [uses_js_1.default, uses_js_2.default.default]; + + +//// [uses.d.ts] +/// +declare const _default: any; +export default _default; +//// [uses.d.ts] +/// +declare const _default: any; +export default _default; +//// [index.d.ts] +declare const _default: readonly [any, any]; +export default _default; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols new file mode 100644 index 0000000000000..24e8de611f10a --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts] //// + +=== /index.ts === +// only an esm file can `import` both kinds of files +import obj1 from "./sub1/uses.js" +>obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) + +import obj2 from "./sub2/uses.js" +>obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) + +export default [obj1, obj2.default] as const; +>obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) +>obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) +>const : Symbol(const) + +=== /sub1/uses.ts === + +/// +export default getInterI(); +=== /sub2/uses.ts === + +/// +export default getInterR(); diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types new file mode 100644 index 0000000000000..a99b9b4cdfd78 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts] //// + +=== /index.ts === +// only an esm file can `import` both kinds of files +import obj1 from "./sub1/uses.js" +>obj1 : any +> : ^^^ + +import obj2 from "./sub2/uses.js" +>obj2 : any +> : ^^^ + +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 : any +> : ^^^ +>default : any +> : ^^^ + +=== /sub1/uses.ts === +/// +export default getInterI(); +>getInterI() : any +> : ^^^ +>getInterI : any +> : ^^^ + +=== /sub2/uses.ts === +/// +export default getInterR(); +>getInterR() : any +> : ^^^ +>getInterR : any +> : ^^^ + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt new file mode 100644 index 0000000000000..01ea79f9da042 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt @@ -0,0 +1,37 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/index.ts(2,1): error TS2304: Cannot find name 'foo'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (3 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + foo; + ~~~ +!!! error TS2304: Cannot find name 'foo'. + bar; // bar should resolve while foo should not, since index.js is cjs + ~~~ +!!! error TS2304: Cannot find name 'bar'. + export {}; +==== /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 { + var foo: number; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + var bar: number; + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).js new file mode 100644 index 0000000000000..df6436da900a7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + var foo: number; +} +//// [require.d.ts] +export {}; +declare global { + var bar: number; +} +//// [index.ts] +/// +foo; +bar; // bar should resolve while foo should not, since index.js is cjs +export {}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +foo; +bar; // bar should resolve while foo should not, since index.js is cjs diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols new file mode 100644 index 0000000000000..cbc34f33743a3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts] //// + +=== /index.ts === + +/// +foo; +bar; // bar should resolve while foo should not, since index.js is cjs +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types new file mode 100644 index 0000000000000..54fe35a973f24 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts] //// + +=== /index.ts === +/// +foo; +>foo : any +> : ^^^ + +bar; // bar should resolve while foo should not, since index.js is cjs +>bar : any +> : ^^^ + +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt new file mode 100644 index 0000000000000..3219d8e3985b1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt @@ -0,0 +1,42 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/index.ts(2,1): error TS2304: Cannot find name 'foo'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (3 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + 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) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + var foo: number; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + var bar: number; + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js new file mode 100644 index 0000000000000..70cf2e6b25892 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + var foo: number; +} +//// [require.d.ts] +export {}; +declare global { + var bar: number; +} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +/// +foo; // foo should resolve while bar should not, since index.js is esm +bar; +export {}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +foo; // foo should resolve while bar should not, since index.js is esm +bar; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols new file mode 100644 index 0000000000000..324227bb5ccb9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts] //// + +=== /index.ts === + +/// +foo; // foo should resolve while bar should not, since index.js is esm +bar; +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types new file mode 100644 index 0000000000000..141c922905c94 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts] //// + +=== /index.ts === +/// +foo; // foo should resolve while bar should not, since index.js is esm +>foo : any +> : ^^^ + +bar; +>bar : any +> : ^^^ + +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt new file mode 100644 index 0000000000000..703862b74dc4a --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt @@ -0,0 +1,36 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(2,1): error TS2304: Cannot find name 'foo'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (1 errors) ==== + /// + foo; + ~~~ +!!! error TS2304: Cannot find name 'foo'. + bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs + export {}; +==== /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 { + var foo: number; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + var bar: number; + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js new file mode 100644 index 0000000000000..7bde651a81183 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + var foo: number; +} +//// [require.d.ts] +export {}; +declare global { + var bar: number; +} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +/// +foo; +bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs +export {}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +foo; +bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).symbols new file mode 100644 index 0000000000000..1c8df0a238567 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).symbols @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts] //// + +=== /index.ts === +/// +foo; +bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) + +export {}; +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + var bar: number; +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).types new file mode 100644 index 0000000000000..a655521043fd9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts] //// + +=== /index.ts === +/// +foo; +>foo : any +> : ^^^ + +bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs +>bar : number +> : ^^^^^^ + +export {}; +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var bar: number; +>bar : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt new file mode 100644 index 0000000000000..192913da3114e --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt @@ -0,0 +1,31 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (1 errors) ==== + /// + foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm + bar; + ~~~ +!!! error TS2304: Cannot find name 'bar'. + export {}; +==== /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 { + var foo: number; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + var bar: number; + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).js new file mode 100644 index 0000000000000..74346916b2641 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + var foo: number; +} +//// [require.d.ts] +export {}; +declare global { + var bar: number; +} +//// [index.ts] +/// +foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm +bar; +export {}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm +bar; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).symbols new file mode 100644 index 0000000000000..9f7867c7dbd5a --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).symbols @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts] //// + +=== /index.ts === +/// +foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) + +bar; +export {}; +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + var foo: number; +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).types new file mode 100644 index 0000000000000..45343b1ac3c7d --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts] //// + +=== /index.ts === +/// +foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm +>foo : number +> : ^^^^^^ + +bar; +>bar : any +> : ^^^ + +export {}; +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var foo: number; +>foo : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt new file mode 100644 index 0000000000000..041c3b1e2a5c6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt @@ -0,0 +1,31 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (0 errors) ==== + /// + /// + // Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two + // references above. + foo; + bar; + export {}; +==== /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 { + var foo: number; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + var bar: number; + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).js new file mode 100644 index 0000000000000..0c37dc00e4deb --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + var foo: number; +} +//// [require.d.ts] +export {}; +declare global { + var bar: number; +} +//// [index.ts] +/// +/// +// Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two +// references above. +foo; +bar; +export {}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +/// +// Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two +// references above. +foo; +bar; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).symbols new file mode 100644 index 0000000000000..1e0a2417e63a0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts] //// + +=== /index.ts === +/// +/// +// Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two +// references above. +foo; +>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 === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + var foo: number; +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) +} +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + var bar: number; +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).types new file mode 100644 index 0000000000000..bb5a09e68df2d --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).types @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts] //// + +=== /index.ts === +/// +/// +// Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two +// references above. +foo; +>foo : number +> : ^^^^^^ + +bar; +>bar : number +> : ^^^^^^ + +export {}; +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var foo: number; +>foo : number +> : ^^^^^^ +} +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var bar: number; +>bar : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt new file mode 100644 index 0000000000000..428ae843b712e --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt @@ -0,0 +1,40 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. +/index.ts(2,1): error TS2304: Cannot find name 'foo'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== /index.ts (4 errors) ==== + /// + ~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + foo; // bad resolution mode, which resolves is arbitrary + ~~~ +!!! error TS2304: Cannot find name 'foo'. + bar; + ~~~ +!!! error TS2304: Cannot find name 'bar'. + export {}; +==== /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 { + var foo: number; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + var bar: number; + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).js new file mode 100644 index 0000000000000..09540ae8aba4a --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export {}; +declare global { + var foo: number; +} +//// [require.d.ts] +export {}; +declare global { + var bar: number; +} +//// [index.ts] +/// +foo; // bad resolution mode, which resolves is arbitrary +bar; +export {}; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +foo; // bad resolution mode, which resolves is arbitrary +bar; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols new file mode 100644 index 0000000000000..3080bff7fcb0d --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts] //// + +=== /index.ts === + +/// +foo; // bad resolution mode, which resolves is arbitrary +bar; +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types new file mode 100644 index 0000000000000..ce00cab1bab39 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts] //// + +=== /index.ts === +/// +foo; // bad resolution mode, which resolves is arbitrary +>foo : any +> : ^^^ + +bar; +>bar : any +> : ^^^ + +export {}; diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt new file mode 100644 index 0000000000000..ef24bc2eb569f --- /dev/null +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt @@ -0,0 +1,63 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,22): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,22): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,22): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + // esm format file + import * as mod from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + mod.correctVersionApplied; + +==== index.mts (1 errors) ==== + // esm format file + import * as mod from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + mod.correctVersionApplied; + +==== index.cts (1 errors) ==== + // cjs format file + import * as mod from "inner"; + ~~~~~~~ +!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + mod.correctVersionApplied; + +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const noConditionsApplied = true; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const importConditionApplied = true; +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const wrongConditionApplied = true; +==== node_modules/inner/old-types.d.ts (0 errors) ==== + export const noVersionApplied = true; +==== node_modules/inner/new-types.d.ts (0 errors) ==== + export const correctVersionApplied = true; +==== node_modules/inner/future-types.d.ts (0 errors) ==== + export const futureVersionApplied = true; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + ".": { + "types@>=10000": "./future-types.d.ts", + "types@>=1": "./new-types.d.ts", + "types": "./old-types.d.ts", + "import": "./index.mjs", + "node": "./index.js" + }, + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js new file mode 100644 index 0000000000000..d2267d06615b2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js @@ -0,0 +1,79 @@ +//// [tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts] //// + +//// [index.ts] +// esm format file +import * as mod from "inner"; +mod.correctVersionApplied; + +//// [index.mts] +// esm format file +import * as mod from "inner"; +mod.correctVersionApplied; + +//// [index.cts] +// cjs format file +import * as mod from "inner"; +mod.correctVersionApplied; + +//// [index.d.ts] +// cjs format file +export const noConditionsApplied = true; +//// [index.d.mts] +// esm format file +export const importConditionApplied = true; +//// [index.d.cts] +// cjs format file +export const wrongConditionApplied = true; +//// [old-types.d.ts] +export const noVersionApplied = true; +//// [new-types.d.ts] +export const correctVersionApplied = true; +//// [future-types.d.ts] +export const futureVersionApplied = true; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", +} +//// [package.json] +{ + "name": "inner", + "private": true, + "exports": { + ".": { + "types@>=10000": "./future-types.d.ts", + "types@>=1": "./new-types.d.ts", + "types": "./old-types.d.ts", + "import": "./index.mjs", + "node": "./index.js" + }, + } +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const mod = require("inner"); +mod.correctVersionApplied; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const mod = require("inner"); +mod.correctVersionApplied; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const mod = require("inner"); +mod.correctVersionApplied; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols new file mode 100644 index 0000000000000..dcb791b8b5908 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols @@ -0,0 +1,53 @@ +//// [tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as mod from "inner"; +>mod : Symbol(mod, Decl(index.ts, 1, 6)) + +mod.correctVersionApplied; +>mod : Symbol(mod, Decl(index.ts, 1, 6)) + +=== index.mts === +// esm format file +import * as mod from "inner"; +>mod : Symbol(mod, Decl(index.mts, 1, 6)) + +mod.correctVersionApplied; +>mod : Symbol(mod, Decl(index.mts, 1, 6)) + +=== index.cts === +// cjs format file +import * as mod from "inner"; +>mod : Symbol(mod, Decl(index.cts, 1, 6)) + +mod.correctVersionApplied; +>mod : Symbol(mod, Decl(index.cts, 1, 6)) + +=== node_modules/inner/index.d.ts === +// cjs format file +export const noConditionsApplied = true; +>noConditionsApplied : Symbol(noConditionsApplied, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/index.d.mts === +// esm format file +export const importConditionApplied = true; +>importConditionApplied : Symbol(importConditionApplied, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/index.d.cts === +// cjs format file +export const wrongConditionApplied = true; +>wrongConditionApplied : Symbol(wrongConditionApplied, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/old-types.d.ts === +export const noVersionApplied = true; +>noVersionApplied : Symbol(noVersionApplied, Decl(old-types.d.ts, 0, 12)) + +=== node_modules/inner/new-types.d.ts === +export const correctVersionApplied = true; +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) + +=== node_modules/inner/future-types.d.ts === +export const futureVersionApplied = true; +>futureVersionApplied : Symbol(futureVersionApplied, Decl(future-types.d.ts, 0, 12)) + diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types new file mode 100644 index 0000000000000..9987e1390da87 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types @@ -0,0 +1,89 @@ +//// [tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts] //// + +=== index.ts === +// esm format file +import * as mod from "inner"; +>mod : any +> : ^^^ + +mod.correctVersionApplied; +>mod.correctVersionApplied : any +> : ^^^ +>mod : any +> : ^^^ +>correctVersionApplied : any +> : ^^^ + +=== index.mts === +// esm format file +import * as mod from "inner"; +>mod : any +> : ^^^ + +mod.correctVersionApplied; +>mod.correctVersionApplied : any +> : ^^^ +>mod : any +> : ^^^ +>correctVersionApplied : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as mod from "inner"; +>mod : any +> : ^^^ + +mod.correctVersionApplied; +>mod.correctVersionApplied : any +> : ^^^ +>mod : any +> : ^^^ +>correctVersionApplied : any +> : ^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +export const noConditionsApplied = true; +>noConditionsApplied : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +export const importConditionApplied = true; +>importConditionApplied : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +export const wrongConditionApplied = true; +>wrongConditionApplied : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/old-types.d.ts === +export const noVersionApplied = true; +>noVersionApplied : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/new-types.d.ts === +export const correctVersionApplied = true; +>correctVersionApplied : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/future-types.d.ts === +export const futureVersionApplied = true; +>futureVersionApplied : true +> : ^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt b/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt new file mode 100644 index 0000000000000..5b3eb8f7d9b05 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt @@ -0,0 +1,32 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== index.mts (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== index.cts (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).js b/tests/baselines/reference/nodePackageSelfName(module=node18).js new file mode 100644 index 0000000000000..808f7208b84fc --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/node/nodePackageSelfName.ts] //// + +//// [index.ts] +// esm format file +import * as self from "package"; +self; +//// [index.mts] +// esm format file +import * as self from "package"; +self; +//// [index.cts] +// esm format file +import * as self from "package"; +self; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("package"); +self; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("package"); +self; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("package"); +self; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).symbols b/tests/baselines/reference/nodePackageSelfName(module=node18).symbols new file mode 100644 index 0000000000000..88b7e3612047e --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodePackageSelfName.ts] //// + +=== index.ts === +// esm format file +import * as self from "package"; +>self : Symbol(self, Decl(index.ts, 1, 6)) + +self; +>self : Symbol(self, Decl(index.ts, 1, 6)) + +=== index.mts === +// esm format file +import * as self from "package"; +>self : Symbol(self, Decl(index.mts, 1, 6)) + +self; +>self : Symbol(self, Decl(index.mts, 1, 6)) + +=== index.cts === +// esm format file +import * as self from "package"; +>self : Symbol(self, Decl(index.cts, 1, 6)) + +self; +>self : Symbol(self, Decl(index.cts, 1, 6)) + diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).types b/tests/baselines/reference/nodePackageSelfName(module=node18).types new file mode 100644 index 0000000000000..5b4e024c6a945 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodePackageSelfName.ts] //// + +=== index.ts === +// esm format file +import * as self from "package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + +=== index.mts === +// esm format file +import * as self from "package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + +=== index.cts === +// esm format file +import * as self from "package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt new file mode 100644 index 0000000000000..84679073941e5 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt @@ -0,0 +1,32 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +index.cts(2,23): error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.mts(2,23): error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== index.ts (1 errors) ==== + // esm format file + import * as self from "@scope/package"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== index.mts (1 errors) ==== + // esm format file + import * as self from "@scope/package"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== index.cts (1 errors) ==== + // cjs format file + import * as self from "@scope/package"; + ~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + self; +==== package.json (0 errors) ==== + { + "name": "@scope/package", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js new file mode 100644 index 0000000000000..0ab838fc3efdb --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/node/nodePackageSelfNameScoped.ts] //// + +//// [index.ts] +// esm format file +import * as self from "@scope/package"; +self; +//// [index.mts] +// esm format file +import * as self from "@scope/package"; +self; +//// [index.cts] +// cjs format file +import * as self from "@scope/package"; +self; +//// [package.json] +{ + "name": "@scope/package", + "private": true, + "type": "module", + "exports": "./index.js" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("@scope/package"); +self; +//// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file +const self = require("@scope/package"); +self; +//// [index.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const self = require("@scope/package"); +self; + + +//// [index.d.ts] +export {}; +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).symbols b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).symbols new file mode 100644 index 0000000000000..3b63ba35050a0 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).symbols @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodePackageSelfNameScoped.ts] //// + +=== index.ts === +// esm format file +import * as self from "@scope/package"; +>self : Symbol(self, Decl(index.ts, 1, 6)) + +self; +>self : Symbol(self, Decl(index.ts, 1, 6)) + +=== index.mts === +// esm format file +import * as self from "@scope/package"; +>self : Symbol(self, Decl(index.mts, 1, 6)) + +self; +>self : Symbol(self, Decl(index.mts, 1, 6)) + +=== index.cts === +// cjs format file +import * as self from "@scope/package"; +>self : Symbol(self, Decl(index.cts, 1, 6)) + +self; +>self : Symbol(self, Decl(index.cts, 1, 6)) + diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types new file mode 100644 index 0000000000000..3ef4dcccbb6b2 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodePackageSelfNameScoped.ts] //// + +=== index.ts === +// esm format file +import * as self from "@scope/package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + +=== index.mts === +// esm format file +import * as self from "@scope/package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + +=== index.cts === +// cjs format file +import * as self from "@scope/package"; +>self : any +> : ^^^ + +self; +>self : any +> : ^^^ + diff --git a/tests/baselines/reference/parser.forAwait.es2018.errors.txt b/tests/baselines/reference/parser.forAwait.es2018.errors.txt index 93133c27df9ec..5ac9587cdb8c5 100644 --- a/tests/baselines/reference/parser.forAwait.es2018.errors.txt +++ b/tests/baselines/reference/parser.forAwait.es2018.errors.txt @@ -8,10 +8,10 @@ inFunctionDeclWithExprIsError.ts(3,9): error TS1103: 'for await' loops are only inGeneratorWithDeclIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules. inGeneratorWithExprIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules. topLevelWithDeclIsError.ts(1,5): error TS1431: '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. -topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +topLevelWithDeclIsError.ts(1,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. topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'. topLevelWithExprIsError.ts(1,5): error TS1431: '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. -topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +topLevelWithExprIsError.ts(1,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. topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'. topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'. @@ -21,7 +21,7 @@ topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'. ~~~~~ !!! error TS1431: '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. ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. ~ !!! error TS2304: Cannot find name 'y'. } @@ -30,7 +30,7 @@ topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'. ~~~~~ !!! error TS1431: '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. ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. ~ !!! error TS2304: Cannot find name 'x'. ~ diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt index 2c3e91ab9f077..deff8ae8b66fc 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt @@ -1,13 +1,13 @@ -index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +index.ts(2,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. +index.ts(46,3): 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(9,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. ==== index.ts (2 errors) ==== export const x = 1; await x; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. // reparse element access as await await [x]; @@ -53,7 +53,7 @@ other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when t declare const dec: any; @(await dec) ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. class C { } @@ -84,7 +84,7 @@ other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when t for await (const item of arr) { ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. item; } \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt index 2c3e91ab9f077..deff8ae8b66fc 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt @@ -1,13 +1,13 @@ -index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +index.ts(2,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. +index.ts(46,3): 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(9,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. ==== index.ts (2 errors) ==== export const x = 1; await x; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. // reparse element access as await await [x]; @@ -53,7 +53,7 @@ other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when t declare const dec: any; @(await dec) ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. class C { } @@ -84,7 +84,7 @@ other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when t for await (const item of arr) { ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. item; } \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt index 2c3e91ab9f077..deff8ae8b66fc 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt @@ -1,13 +1,13 @@ -index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +index.ts(2,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. +index.ts(46,3): 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(9,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. ==== index.ts (2 errors) ==== export const x = 1; await x; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. // reparse element access as await await [x]; @@ -53,7 +53,7 @@ other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when t declare const dec: any; @(await dec) ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. class C { } @@ -84,7 +84,7 @@ other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when t for await (const item of arr) { ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! 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. item; } \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt index cb831b29062be..db2b266576521 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.js b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.js index c7570e811922c..61215bc876f57 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.js +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.js @@ -1 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt index cb831b29062be..db2b266576521 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.js b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.js index c7570e811922c..61215bc876f57 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.js +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.js @@ -1 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt index cb831b29062be..db2b266576521 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.js b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.js index c7570e811922c..61215bc876f57 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.js +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.js @@ -1 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt index cb831b29062be..db2b266576521 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'node18', 'nodenext', 'preserve'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.js b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.js index c7570e811922c..61215bc876f57 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.js +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.js @@ -1 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt new file mode 100644 index 0000000000000..90ba5bc476890 --- /dev/null +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt @@ -0,0 +1,16 @@ +error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +==== node_modules/pkg/index.d.ts (0 errors) ==== + interface GlobalThing { a: number } +==== node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "types": "index.d.ts", + "exports": "some-other-thing.js" + } +==== usage.ts (0 errors) ==== + /// + + const a: GlobalThing = { a: 0 }; \ No newline at end of file diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).js b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).js new file mode 100644 index 0000000000000..7c518b3b9d9cc --- /dev/null +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).js @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts] //// + +//// [index.d.ts] +interface GlobalThing { a: number } +//// [package.json] +{ + "name": "pkg", + "types": "index.d.ts", + "exports": "some-other-thing.js" +} +//// [usage.ts] +/// + +const a: GlobalThing = { a: 0 }; + +//// [usage.js] +"use strict"; +/// +Object.defineProperty(exports, "__esModule", { value: true }); +const a = { a: 0 }; diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).symbols b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).symbols new file mode 100644 index 0000000000000..a98af671f5982 --- /dev/null +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).symbols @@ -0,0 +1,15 @@ +//// [tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts] //// + +=== node_modules/pkg/index.d.ts === +interface GlobalThing { a: number } +>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) +>a : Symbol(GlobalThing.a, Decl(index.d.ts, 0, 23)) + +=== usage.ts === +/// + +const a: GlobalThing = { a: 0 }; +>a : Symbol(a, Decl(usage.ts, 2, 5)) +>GlobalThing : Symbol(GlobalThing, Decl(index.d.ts, 0, 0)) +>a : Symbol(a, Decl(usage.ts, 2, 24)) + diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).types b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).types new file mode 100644 index 0000000000000..fb8b260b07e8b --- /dev/null +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).types @@ -0,0 +1,20 @@ +//// [tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts] //// + +=== node_modules/pkg/index.d.ts === +interface GlobalThing { a: number } +>a : number +> : ^^^^^^ + +=== usage.ts === +/// + +const a: GlobalThing = { a: 0 }; +>a : GlobalThing +> : ^^^^^^^^^^^ +>{ a: 0 } : { a: number; } +> : ^^^^^^^^^^^^^^ +>a : number +> : ^^^^^^ +>0 : 0 +> : ^ + diff --git a/tests/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js index 18074462bfebd..1d8a51da65d81 100644 --- a/tests/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js @@ -110,7 +110,7 @@ default: es5 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, node18, nodenext, preserve default: undefined --lib diff --git a/tests/baselines/reference/tsc/commandLine/help-all.js b/tests/baselines/reference/tsc/commandLine/help-all.js index 7f2aced1096ea..a758fb9b2102a 100644 --- a/tests/baselines/reference/tsc/commandLine/help-all.js +++ b/tests/baselines/reference/tsc/commandLine/help-all.js @@ -82,7 +82,7 @@ Conditions to set in addition to the resolver-specific defaults when resolving i --module, -m Specify what module code is generated. -one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, node18, nodenext, preserve default: undefined --moduleResolution diff --git a/tests/baselines/reference/tsc/commandLine/help.js b/tests/baselines/reference/tsc/commandLine/help.js index 7832007b209a2..63bb49ab2d7dd 100644 --- a/tests/baselines/reference/tsc/commandLine/help.js +++ b/tests/baselines/reference/tsc/commandLine/help.js @@ -109,7 +109,7 @@ default: es5 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, node18, nodenext, preserve default: undefined --lib diff --git a/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 3c47dc1ebc6d3..f872bbc376d6e 100644 --- a/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -110,7 +110,7 @@ default: es5 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, node18, nodenext, preserve default: undefined --lib diff --git a/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 3c47dc1ebc6d3..f872bbc376d6e 100644 --- a/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -110,7 +110,7 @@ default: es5 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, node18, nodenext, preserve default: undefined --lib diff --git a/tests/cases/compiler/moduleNodeDefaultImports.ts b/tests/cases/compiler/moduleNodeDefaultImports.ts index 906de682bd610..a784dcddb6824 100644 --- a/tests/cases/compiler/moduleNodeDefaultImports.ts +++ b/tests/cases/compiler/moduleNodeDefaultImports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @filename: mod.cts declare function fun(): void; export default fun; diff --git a/tests/cases/compiler/moduleResolutionWithModule.ts b/tests/cases/compiler/moduleResolutionWithModule.ts index 74601d43da250..c271d212bc05f 100644 --- a/tests/cases/compiler/moduleResolutionWithModule.ts +++ b/tests/cases/compiler/moduleResolutionWithModule.ts @@ -1,5 +1,5 @@ -// @moduleResolution: node16,nodenext -// @module: commonjs,node16,nodenext +// @moduleResolution: node16,node18,nodenext +// @module: commonjs,node16,node18,nodenext // @filename: node_modules/pkg/package.json { "name": "pkg", diff --git a/tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts b/tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts index fe80146389c63..70e1754726f8a 100644 --- a/tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts +++ b/tests/cases/compiler/tripleSlashTypesReferenceWithMissingExports.ts @@ -1,4 +1,4 @@ -// @module: commonjs,node16,nodenext +// @module: commonjs,node16,node18,nodenext // @filename: node_modules/pkg/index.d.ts interface GlobalThing { a: number } // @filename: node_modules/pkg/package.json diff --git a/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts b/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts index 96d0786d0344b..b522226019b83 100644 --- a/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts +++ b/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts @@ -1,6 +1,6 @@ // @allowImportingTsExtensions: true // @noEmit: true -// @moduleResolution: classic,node10,node16,nodenext,bundler +// @moduleResolution: classic,node10,node16,node18,nodenext,bundler // @jsx: preserve // @noTypesAndSymbols: true diff --git a/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts b/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts index dc43f91e63d1a..47201fdaf3d5c 100644 --- a/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts +++ b/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts @@ -1,6 +1,6 @@ // @allowImportingTsExtensions: true,false // @noEmit: true -// @moduleResolution: classic,node10,node16,nodenext +// @moduleResolution: classic,node10,node16,node18,nodenext // @noTypesAndSymbols: true // @Filename: /types.d.ts diff --git a/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts b/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts index 26fe08e88fb11..592847dcda9d0 100644 --- a/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts +++ b/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts @@ -1,5 +1,5 @@ // @module: esnext -// @moduleResolution: node16,nodenext,bundler +// @moduleResolution: node16,node18,nodenext,bundler // @traceResolution: true // @allowJs: true // @noTypesAndSymbols: true diff --git a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts index c3a06a36b52aa..101285c352a5b 100644 --- a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts +++ b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic,node,node16,nodenext,bundler +// @moduleResolution: classic,node,node16,node18,nodenext,bundler // @allowJs: true // @checkJs: true // @noEmit: true diff --git a/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts b/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts index 8d5804c1fd010..f3f69a968f9be 100644 --- a/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts +++ b/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts @@ -1,4 +1,4 @@ -// @moduleResolution: node16,nodenext,bundler +// @moduleResolution: node16,node18,nodenext,bundler // @noEmit: true // @noTypesAndSymbols: true // @traceResolution: true diff --git a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts index b1bf3811d6e64..efbe50a532aa5 100644 --- a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts +++ b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic, node, node16, nodenext, bundler +// @moduleResolution: classic, node, node16, node18, nodenext, bundler // @resolvePackageJsonImports: true // @resolvePackageJsonExports: true // @noTypesAndSymbols: true diff --git a/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts b/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts index bf4718d847a54..4e3788f8338d9 100644 --- a/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts +++ b/tests/cases/conformance/node/allowJs/nodeAllowJsPackageSelfName.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts index f790752053fc2..d5834ca8d7da6 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJs1.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts index 74143dcefaa66..665c180e48b74 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsCjsFromJs.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @allowJs: true // @noEmit: true // @filename: foo.cjs diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts index f6f62444a6162..4624489191369 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts index 5da3c3e542526..a004f5d596027 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsDynamicImport.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts index 0457ce4cb6237..9d180b21ff55d 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportAssignment.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts index 24037e466bafa..825ec48c1fdc0 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @allowJs: true // @outDir: ./out // @moduleDetection: auto diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts index 7cb94da8f6026..7109501c97ad9 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsGeneratedNameCollisions.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts index 2688b07fb9996..bff55957be3bf 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportAssignment.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts index 26874896143b7..ddc1c7aee61b1 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions1.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @importHelpers: true // @allowJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts index af20a16ba76fa..352dec8d0d056 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions2.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @importHelpers: true // @allowJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts index c634df34ee75e..c333e89ae2b69 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportHelpersCollisions3.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @target: es5 // @declaration: true // @importHelpers: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts index 43fdf016c4361..6052da8ae6090 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsImportMeta.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts index 23de392ed7ead..b0cafc753aa38 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts index 84d0f650abcb9..f7d1e1fbfeb36 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageImports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts index eab5792b8fbac..8579530d1959d 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts index f402a08f65144..c6906f952d101 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsExclude.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts index b8ea4f9cbd89e..9fd48761935cb 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts index 78025e25074e7..28880b0bb1513 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsSynchronousCallErrors.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts index e18c50fef7a64..85e9dbd027549 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsTopLevelAwait.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/node/nodeModules1.ts b/tests/cases/conformance/node/nodeModules1.ts index 32c83b4525bcd..9f5c7c34cf347 100644 --- a/tests/cases/conformance/node/nodeModules1.ts +++ b/tests/cases/conformance/node/nodeModules1.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts b/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts index 31051b3a18be0..a3383412a6325 100644 --- a/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts +++ b/tests/cases/conformance/node/nodeModulesCjsFormatFileAlwaysHasDefault.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts index a0240cdef4ecf..1ccd7940cd011 100644 --- a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts b/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts index 9b4eb3ec9f8c6..b27afe6264f1b 100644 --- a/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesDeclarationEmitWithPackageExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodeModulesDynamicImport.ts b/tests/cases/conformance/node/nodeModulesDynamicImport.ts index 0864b42bbaf37..adb95b880d1d1 100644 --- a/tests/cases/conformance/node/nodeModulesDynamicImport.ts +++ b/tests/cases/conformance/node/nodeModulesDynamicImport.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesExportAssignments.ts b/tests/cases/conformance/node/nodeModulesExportAssignments.ts index efc867fa1c659..89edf8fd865de 100644 --- a/tests/cases/conformance/node/nodeModulesExportAssignments.ts +++ b/tests/cases/conformance/node/nodeModulesExportAssignments.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts b/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts index ee6587b5ea073..0872690b12d92 100644 --- a/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts +++ b/tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts b/tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts index 2eedbe682cdd5..ffbf85544cb97 100644 --- a/tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts +++ b/tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @traceResolution: true // @noImplicitAny: true diff --git a/tests/cases/conformance/node/nodeModulesExportsSourceTs.ts b/tests/cases/conformance/node/nodeModulesExportsSourceTs.ts index 5ca23c1526a0e..085f46664d32a 100644 --- a/tests/cases/conformance/node/nodeModulesExportsSourceTs.ts +++ b/tests/cases/conformance/node/nodeModulesExportsSourceTs.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts index 92c686f1c2303..cbf71e6946549 100644 --- a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts +++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationConditions.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts index 684cb5588fc74..48fde3a47d4a4 100644 --- a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts +++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationDirectory.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts index a325a2dfe6c63..2c38bb643dcf6 100644 --- a/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts +++ b/tests/cases/conformance/node/nodeModulesExportsSpecifierGenerationPattern.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts index ca9ff3cf41311..11c31e1911514 100644 --- a/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts +++ b/tests/cases/conformance/node/nodeModulesForbidenSyntax.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts index 6f6fa8acb0763..280cbf6a1034c 100644 --- a/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts +++ b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesImportAssertions.ts b/tests/cases/conformance/node/nodeModulesImportAssertions.ts index ae941bd003b3f..6a07e4b6fa791 100644 --- a/tests/cases/conformance/node/nodeModulesImportAssertions.ts +++ b/tests/cases/conformance/node/nodeModulesImportAssertions.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @resolveJsonModule: true // @filename: index.ts import json from "./package.json" assert { type: "json" }; diff --git a/tests/cases/conformance/node/nodeModulesImportAssignments.ts b/tests/cases/conformance/node/nodeModulesImportAssignments.ts index cce29eb0d7583..c1a7755672624 100644 --- a/tests/cases/conformance/node/nodeModulesImportAssignments.ts +++ b/tests/cases/conformance/node/nodeModulesImportAssignments.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesImportAttributes.ts b/tests/cases/conformance/node/nodeModulesImportAttributes.ts index 9e2a3271c0218..df1d41da30f6a 100644 --- a/tests/cases/conformance/node/nodeModulesImportAttributes.ts +++ b/tests/cases/conformance/node/nodeModulesImportAttributes.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @resolveJsonModule: true // @filename: index.ts import json from "./package.json" with { type: "json" }; diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts index 181853d1fa02d..c96ff4ec18e1f 100644 --- a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts +++ b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts index b8cc7f112fda3..2303ab5b990c2 100644 --- a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts +++ b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts index 2aee1dfac573a..7b0936775e3bd 100644 --- a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts +++ b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts index 45bf0f409e569..ad94d514c6004 100644 --- a/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts +++ b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts index e5c7c1420f314..62d901221c95b 100644 --- a/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts +++ b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts index 0a4698a95fba3..4ddca84f106fc 100644 --- a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts +++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @importHelpers: true // @filename: subfolder/index.ts diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts index 58e65723cbc1b..6c962f5f17db8 100644 --- a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts +++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @importHelpers: true // @filename: subfolder/index.ts diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts index 7fb02dad355e5..574a04790c4b6 100644 --- a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts +++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @target: es5 // @declaration: true // @importHelpers: true diff --git a/tests/cases/conformance/node/nodeModulesImportMeta.ts b/tests/cases/conformance/node/nodeModulesImportMeta.ts index cc8bdcce9da1e..e7f1e79c2f21d 100644 --- a/tests/cases/conformance/node/nodeModulesImportMeta.ts +++ b/tests/cases/conformance/node/nodeModulesImportMeta.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts index c1c0c57cf9d64..81a81cc0bcd4e 100644 --- a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts +++ b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts index 06a9b226b2192..2fbee45ab1d7a 100644 --- a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts +++ b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts index 01907185636c6..4d4331be3ddc3 100644 --- a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts +++ b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts b/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts index 58a8adbf9b0a2..f55158f2f827c 100644 --- a/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts +++ b/tests/cases/conformance/node/nodeModulesImportResolutionIntoExport.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts b/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts index b3a4139a00c9e..6381ae8ccdb42 100644 --- a/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts +++ b/tests/cases/conformance/node/nodeModulesImportResolutionNoCycle.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts b/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts index c6ca4e2f13f97..b79826e7400ed 100644 --- a/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts +++ b/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts b/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts index d118bc6da2931..e8266d8eb1e0b 100644 --- a/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts +++ b/tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmitErrors1.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesJson.ts b/tests/cases/conformance/node/nodeModulesJson.ts index e231ec9b0aa1d..6159dfd23a185 100644 --- a/tests/cases/conformance/node/nodeModulesJson.ts +++ b/tests/cases/conformance/node/nodeModulesJson.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @resolveJsonModule: true // @noEmit: true diff --git a/tests/cases/conformance/node/nodeModulesPackageExports.ts b/tests/cases/conformance/node/nodeModulesPackageExports.ts index 6433e49270feb..32f28261195a5 100644 --- a/tests/cases/conformance/node/nodeModulesPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesPackageExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodeModulesPackageImports.ts b/tests/cases/conformance/node/nodeModulesPackageImports.ts index e4ff6bba86428..4e0e34587aa35 100644 --- a/tests/cases/conformance/node/nodeModulesPackageImports.ts +++ b/tests/cases/conformance/node/nodeModulesPackageImports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // @traceResolution: true diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts index 4a4af53809a92..66cc8dcb5076a 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts index a12b1dab20dc0..0704894872974 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts index 59fe617e4c312..e367cc8e25d96 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts b/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts index c9d8204623642..566b36a8be0a6 100644 --- a/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts +++ b/tests/cases/conformance/node/nodeModulesResolveJsonModule.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @resolveJsonModule: true // @outDir: ./out // @declaration: true diff --git a/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts index 203760b4e5d1a..5894ec9fa5993 100644 --- a/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts +++ b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts index 0e532ced3bac6..1e408948ca25d 100644 --- a/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts +++ b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: subfolder/index.ts // cjs format file diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts index 023aeb10babd6..720b542cdf57c 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts index 3760a6b3796bc..26fb155089585 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts index 6e86a567a469d..e495af61693e2 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit3.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts index 02e104118c14c..206b8ac8971b2 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit4.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts index c2aa67228d4a6..146966b663e8f 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit5.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts index 91cba073a931a..a7bfaee6077cc 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts index c48ad0128f162..9021d10b2cf46 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit7.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: /node_modules/pkg/package.json diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts index c488964766d47..06176bf7496e0 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @outDir: out // @filename: /node_modules/pkg/package.json { diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts index 79eeba94abf00..638148fccaf2e 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @outDir: out // @filename: /node_modules/pkg/package.json { diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts index 74a9d2fffe59a..07c712e255ada 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @outDir: out // @filename: /node_modules/pkg/package.json { diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts index 26bc3c8f393c8..d7b0d88c26dab 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride4.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @outDir: out // @filename: /node_modules/pkg/package.json { diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts index 2174f95923752..993f10822bd21 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride5.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @outDir: out // @filename: /node_modules/pkg/package.json { diff --git a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts index 84828c5dabb8e..87a671e2e11ae 100644 --- a/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts +++ b/tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts @@ -1,5 +1,5 @@ // @noImplicitReferences: true -// @module: node16,nodenext +// @module: node16,node18,nodenext // @outDir: out // @filename: /node_modules/pkg/package.json { diff --git a/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts b/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts index 1cdaef53f2462..f562c69ba0681 100644 --- a/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesTypesVersionPackageExports.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @outDir: out // @filename: index.ts diff --git a/tests/cases/conformance/node/nodePackageSelfName.ts b/tests/cases/conformance/node/nodePackageSelfName.ts index ec9dd150591ea..344f1eef2dc2f 100644 --- a/tests/cases/conformance/node/nodePackageSelfName.ts +++ b/tests/cases/conformance/node/nodePackageSelfName.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file diff --git a/tests/cases/conformance/node/nodePackageSelfNameScoped.ts b/tests/cases/conformance/node/nodePackageSelfNameScoped.ts index 9e9eef3849610..4a9e534e2ef31 100644 --- a/tests/cases/conformance/node/nodePackageSelfNameScoped.ts +++ b/tests/cases/conformance/node/nodePackageSelfNameScoped.ts @@ -1,4 +1,4 @@ -// @module: node16,nodenext +// @module: node16,node18,nodenext // @declaration: true // @filename: index.ts // esm format file From 6dcad20a530ec226577edd6e05c3169883b9cee9 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 9 Dec 2024 12:06:03 -0800 Subject: [PATCH 3/7] Revert package.json test change --- package-lock.json | 16 +++++++--------- package.json | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 263435ebf9c74..b089dc3b035a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,7 +54,7 @@ "playwright": "^1.47.2", "source-map-support": "^0.5.21", "tslib": "^2.7.0", - "typescript": "npm:@typescript-deploys/pr-build@5.8.0-pr-60039-24", + "typescript": "^5.6.2", "typescript-eslint": "^8.8.0", "which": "^3.0.1" }, @@ -4369,12 +4369,10 @@ } }, "node_modules/typescript": { - "name": "@typescript-deploys/pr-build", - "version": "5.8.0-pr-60039-24", - "resolved": "https://registry.npmjs.org/@typescript-deploys/pr-build/-/pr-build-5.8.0-pr-60039-24.tgz", - "integrity": "sha512-GqEecrr0K3+4mkNnkh/l7I1sBaDGmVRrHiKP/+YgcPbB0c6K8gFt31sK4hfcq6Oai5y0vmc9wMwfR0NYFbi23g==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, - "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -7674,9 +7672,9 @@ } }, "typescript": { - "version": "npm:@typescript-deploys/pr-build@5.8.0-pr-60039-24", - "resolved": "https://registry.npmjs.org/@typescript-deploys/pr-build/-/pr-build-5.8.0-pr-60039-24.tgz", - "integrity": "sha512-GqEecrr0K3+4mkNnkh/l7I1sBaDGmVRrHiKP/+YgcPbB0c6K8gFt31sK4hfcq6Oai5y0vmc9wMwfR0NYFbi23g==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true }, "typescript-eslint": { diff --git a/package.json b/package.json index e272fa7c04915..4ddb7a53a7146 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "playwright": "^1.47.2", "source-map-support": "^0.5.21", "tslib": "^2.7.0", - "typescript": "npm:@typescript-deploys/pr-build@5.8.0-pr-60039-24", + "typescript": "^5.6.2", "typescript-eslint": "^8.8.0", "which": "^3.0.1" }, From cbe271cfac04659db44906c2ed69429f8aaf4278 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 9 Dec 2024 13:16:42 -0800 Subject: [PATCH 4/7] Undo bad test changes --- tests/cases/compiler/moduleResolutionWithModule.ts | 2 +- .../conformance/moduleResolution/allowImportingTsExtensions.ts | 2 +- .../moduleResolution/allowImportingTypesDtsExtension.ts | 2 +- .../moduleResolution/conditionalExportsResolutionFallback.ts | 2 +- .../conformance/moduleResolution/extensionLoadingPriority.ts | 2 +- .../conformance/moduleResolution/nestedPackageJsonRedirect.ts | 2 +- .../moduleResolution/packageJsonImportsExportsOptionCompat.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/cases/compiler/moduleResolutionWithModule.ts b/tests/cases/compiler/moduleResolutionWithModule.ts index c271d212bc05f..df96cce680e38 100644 --- a/tests/cases/compiler/moduleResolutionWithModule.ts +++ b/tests/cases/compiler/moduleResolutionWithModule.ts @@ -1,4 +1,4 @@ -// @moduleResolution: node16,node18,nodenext +// @moduleResolution: node16,nodenext // @module: commonjs,node16,node18,nodenext // @filename: node_modules/pkg/package.json { diff --git a/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts b/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts index b522226019b83..96d0786d0344b 100644 --- a/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts +++ b/tests/cases/conformance/moduleResolution/allowImportingTsExtensions.ts @@ -1,6 +1,6 @@ // @allowImportingTsExtensions: true // @noEmit: true -// @moduleResolution: classic,node10,node16,node18,nodenext,bundler +// @moduleResolution: classic,node10,node16,nodenext,bundler // @jsx: preserve // @noTypesAndSymbols: true diff --git a/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts b/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts index 47201fdaf3d5c..dc43f91e63d1a 100644 --- a/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts +++ b/tests/cases/conformance/moduleResolution/allowImportingTypesDtsExtension.ts @@ -1,6 +1,6 @@ // @allowImportingTsExtensions: true,false // @noEmit: true -// @moduleResolution: classic,node10,node16,node18,nodenext +// @moduleResolution: classic,node10,node16,nodenext // @noTypesAndSymbols: true // @Filename: /types.d.ts diff --git a/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts b/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts index 592847dcda9d0..26fe08e88fb11 100644 --- a/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts +++ b/tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts @@ -1,5 +1,5 @@ // @module: esnext -// @moduleResolution: node16,node18,nodenext,bundler +// @moduleResolution: node16,nodenext,bundler // @traceResolution: true // @allowJs: true // @noTypesAndSymbols: true diff --git a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts index 101285c352a5b..c3a06a36b52aa 100644 --- a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts +++ b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic,node,node16,node18,nodenext,bundler +// @moduleResolution: classic,node,node16,nodenext,bundler // @allowJs: true // @checkJs: true // @noEmit: true diff --git a/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts b/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts index f3f69a968f9be..8d5804c1fd010 100644 --- a/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts +++ b/tests/cases/conformance/moduleResolution/nestedPackageJsonRedirect.ts @@ -1,4 +1,4 @@ -// @moduleResolution: node16,node18,nodenext,bundler +// @moduleResolution: node16,nodenext,bundler // @noEmit: true // @noTypesAndSymbols: true // @traceResolution: true diff --git a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts index efbe50a532aa5..e7826a31c5e54 100644 --- a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts +++ b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic, node, node16, node18, nodenext, bundler +// @moduleResolution: classic, node, node16, nodenext, bundler // @resolvePackageJsonImports: true // @resolvePackageJsonExports: true // @noTypesAndSymbols: true From 08d63979e0775764698982526a8aa202075f6c6f Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 9 Dec 2024 14:07:01 -0800 Subject: [PATCH 5/7] Search for "case: ModuleKind" and update --- src/compiler/checker.ts | 2 + src/compiler/transformer.ts | 1 + src/compiler/utilities.ts | 2 + ...entifiers_module(module=node18).errors.txt | 2 - ...espaceIdentifiers_module(module=node18).js | 35 +- ...lpersWithLocalCollisions(module=node18).js | 7 +- ...deDefaultImports(module=node18).errors.txt | 2 - ...moduleNodeDefaultImports(module=node18).js | 41 +- ...(module=node18,moduleresolution=node16).js | 35 +- ...odule=node18,moduleresolution=nodenext).js | 35 +- ...sPackageSelfName(module=node18).errors.txt | 18 +- ...deAllowJsPackageSelfName(module=node18).js | 43 +- ...llowJsPackageSelfName(module=node18).types | 24 +- .../nodeModules1(module=node18).errors.txt | 346 ++++++++------- .../reference/nodeModules1(module=node18).js | 249 ++++++----- .../nodeModules1(module=node18).symbols | 12 - .../nodeModules1(module=node18).types | 416 +++++++++--------- ...eModulesAllowJs1(module=node18).errors.txt | 346 ++++++++------- .../nodeModulesAllowJs1(module=node18).js | 249 ++++++----- ...nodeModulesAllowJs1(module=node18).symbols | 12 - .../nodeModulesAllowJs1(module=node18).types | 416 +++++++++--------- ...AllowJsCjsFromJs(module=node18).errors.txt | 12 - ...lesAllowJsCjsFromJs(module=node18).symbols | 2 + ...dulesAllowJsCjsFromJs(module=node18).types | 16 +- ...alPackageExports(module=node18).errors.txt | 123 +----- ...onditionalPackageExports(module=node18).js | 101 +++-- ...ionalPackageExports(module=node18).symbols | 54 ++- ...itionalPackageExports(module=node18).types | 344 +++++++-------- ...wJsDynamicImport(module=node18).errors.txt | 26 -- ...ulesAllowJsDynamicImport(module=node18).js | 5 +- ...sAllowJsDynamicImport(module=node18).types | 3 - ...ExportAssignment(module=node18).errors.txt | 7 +- ...sAllowJsExportAssignment(module=node18).js | 7 +- ...uleDetectionAuto(module=node18).errors.txt | 8 - ...edNameCollisions(module=node18).errors.txt | 16 +- ...sGeneratedNameCollisions(module=node18).js | 9 +- ...ImportAssignment(module=node18).errors.txt | 2 - ...sAllowJsImportAssignment(module=node18).js | 18 +- ...lpersCollisions1(module=node18).errors.txt | 10 +- ...ImportHelpersCollisions1(module=node18).js | 13 +- ...lpersCollisions2(module=node18).errors.txt | 10 +- ...ImportHelpersCollisions2(module=node18).js | 40 +- ...lpersCollisions3(module=node18).errors.txt | 7 +- ...ImportHelpersCollisions3(module=node18).js | 17 +- ...llowJsImportMeta(module=node18).errors.txt | 7 +- ...ModulesAllowJsImportMeta(module=node18).js | 5 +- ...JsPackageExports(module=node18).errors.txt | 105 +---- ...lesAllowJsPackageExports(module=node18).js | 87 ++-- ...lowJsPackageExports(module=node18).symbols | 18 +- ...AllowJsPackageExports(module=node18).types | 208 ++++----- ...JsPackageImports(module=node18).errors.txt | 39 +- ...lesAllowJsPackageImports(module=node18).js | 65 ++- ...AllowJsPackageImports(module=node18).types | 72 +-- ...gePatternExports(module=node18).errors.txt | 74 +--- ...wJsPackagePatternExports(module=node18).js | 55 ++- ...ckagePatternExports(module=node18).symbols | 18 +- ...PackagePatternExports(module=node18).types | 136 +++--- ...rnExportsExclude(module=node18).errors.txt | 74 ++-- ...agePatternExportsExclude(module=node18).js | 55 ++- ...nExportsTrailers(module=node18).errors.txt | 74 +--- ...gePatternExportsTrailers(module=node18).js | 55 ++- ...ternExportsTrailers(module=node18).symbols | 18 +- ...atternExportsTrailers(module=node18).types | 136 +++--- ...ronousCallErrors(module=node18).errors.txt | 17 +- ...wJsSynchronousCallErrors(module=node18).js | 17 +- ...SynchronousCallErrors(module=node18).types | 24 +- ...wJsTopLevelAwait(module=node18).errors.txt | 18 +- ...ulesAllowJsTopLevelAwait(module=node18).js | 5 +- ...AlwaysHasDefault(module=node18).errors.txt | 24 - ...rmatFileAlwaysHasDefault(module=node18).js | 6 +- ...tFileAlwaysHasDefault(module=node18).types | 8 +- ...alPackageExports(module=node18).errors.txt | 123 +----- ...onditionalPackageExports(module=node18).js | 101 +++-- ...ionalPackageExports(module=node18).symbols | 54 ++- ...itionalPackageExports(module=node18).types | 344 +++++++-------- ...thPackageExports(module=node18).errors.txt | 102 +---- ...onEmitWithPackageExports(module=node18).js | 159 ++++--- ...tWithPackageExports(module=node18).symbols | 42 +- ...mitWithPackageExports(module=node18).types | 288 ++++++------ ...lesDynamicImport(module=node18).errors.txt | 26 -- ...nodeModulesDynamicImport(module=node18).js | 5 +- ...eModulesDynamicImport(module=node18).types | 3 - ...xportAssignments(module=node18).errors.txt | 7 +- ...ModulesExportAssignments(module=node18).js | 3 +- ...cifierResolution(module=node18).errors.txt | 17 +- ...locksSpecifierResolution(module=node18).js | 9 +- ...SpecifierResolution(module=node18).symbols | 3 + ...ksSpecifierResolution(module=node18).types | 28 +- ...cksTypesVersions(module=node18).errors.txt | 52 +-- ...portsBlocksTypesVersions(module=node18).js | 3 +- ...cksTypesVersions(module=node18).trace.json | 342 ++++++++++++-- ...sExportsSourceTs(module=node18).errors.txt | 20 +- ...deModulesExportsSourceTs(module=node18).js | 20 +- ...ulesExportsSourceTs(module=node18).symbols | 4 + ...odulesExportsSourceTs(module=node18).types | 36 +- ...rationConditions(module=node18).errors.txt | 14 +- ...fierGenerationConditions(module=node18).js | 7 +- ...enerationConditions(module=node18).symbols | 3 + ...rGenerationConditions(module=node18).types | 28 +- ...erationDirectory(module=node18).errors.txt | 14 +- ...ifierGenerationDirectory(module=node18).js | 7 +- ...GenerationDirectory(module=node18).symbols | 3 + ...erGenerationDirectory(module=node18).types | 28 +- ...enerationPattern(module=node18).errors.txt | 14 +- ...ecifierGenerationPattern(module=node18).js | 7 +- ...erGenerationPattern(module=node18).symbols | 3 + ...fierGenerationPattern(module=node18).types | 28 +- ...esForbidenSyntax(module=node18).errors.txt | 2 - ...odeModulesForbidenSyntax(module=node18).js | 30 +- ...edNameCollisions(module=node18).errors.txt | 16 +- ...sGeneratedNameCollisions(module=node18).js | 9 +- ...ImportAssertions(module=node18).errors.txt | 16 +- ...eModulesImportAssertions(module=node18).js | 3 +- ...dulesImportAssertions(module=node18).types | 8 +- ...mportAssignments(module=node18).errors.txt | 33 -- ...ModulesImportAssignments(module=node18).js | 18 +- ...ulesImportAssignments(module=node18).types | 6 - ...ImportAttributes(module=node18).errors.txt | 16 +- ...eModulesImportAttributes(module=node18).js | 3 +- ...dulesImportAttributes(module=node18).types | 8 +- ...DeclarationEmit1(module=node18).errors.txt | 33 +- ...odeDeclarationEmit1(module=node18).symbols | 9 + ...sModeDeclarationEmit1(module=node18).types | 22 +- ...DeclarationEmit2(module=node18).errors.txt | 25 +- ...utesModeDeclarationEmit2(module=node18).js | 3 +- ...odeDeclarationEmit2(module=node18).symbols | 9 + ...sModeDeclarationEmit2(module=node18).types | 22 +- ...rationEmitErrors(module=node18).errors.txt | 28 +- ...clarationEmitErrors(module=node18).symbols | 6 + ...DeclarationEmitErrors(module=node18).types | 7 +- ...eDeclarationEmit(module=node18).errors.txt | 37 -- ...ModeDeclarationEmit(module=node18).symbols | 13 + ...peModeDeclarationEmit(module=node18).types | 36 +- ...rationEmitErrors(module=node18).errors.txt | 139 +++--- ...clarationEmitErrors(module=node18).symbols | 14 + ...DeclarationEmitErrors(module=node18).types | 64 +-- ...elpersCollisions(module=node18).errors.txt | 10 +- ...sImportHelpersCollisions(module=node18).js | 13 +- ...lpersCollisions2(module=node18).errors.txt | 10 +- ...ImportHelpersCollisions2(module=node18).js | 40 +- ...lpersCollisions3(module=node18).errors.txt | 7 +- ...ImportHelpersCollisions3(module=node18).js | 9 +- ...odulesImportMeta(module=node18).errors.txt | 7 +- .../nodeModulesImportMeta(module=node18).js | 5 +- ...DeclarationEmit1(module=node18).errors.txt | 33 +- ...odeDeclarationEmit1(module=node18).symbols | 9 + ...tModeDeclarationEmit1(module=node18).types | 22 +- ...DeclarationEmit2(module=node18).errors.txt | 25 +- ...portModeDeclarationEmit2(module=node18).js | 3 +- ...odeDeclarationEmit2(module=node18).symbols | 9 + ...tModeDeclarationEmit2(module=node18).types | 22 +- ...ationEmitErrors1(module=node18).errors.txt | 28 +- ...larationEmitErrors1(module=node18).symbols | 6 + ...eclarationEmitErrors1(module=node18).types | 7 +- ...lutionIntoExport(module=node18).errors.txt | 35 -- ...portResolutionIntoExport(module=node18).js | 53 ++- ...tResolutionIntoExport(module=node18).types | 24 +- ...esolutionNoCycle(module=node18).errors.txt | 14 +- ...sImportResolutionNoCycle(module=node18).js | 43 +- ...DeclarationEmit1(module=node18).errors.txt | 37 -- ...TypeModeDeclarationEmit1(module=node18).js | 4 +- ...odeDeclarationEmit1(module=node18).symbols | 13 + ...eModeDeclarationEmit1(module=node18).types | 36 +- ...ationEmitErrors1(module=node18).errors.txt | 137 +++--- ...deDeclarationEmitErrors1(module=node18).js | 8 +- ...larationEmitErrors1(module=node18).symbols | 14 + ...eclarationEmitErrors1(module=node18).types | 64 +-- .../nodeModulesJson(module=node18).errors.txt | 27 +- .../nodeModulesJson(module=node18).symbols | 4 + .../nodeModulesJson(module=node18).types | 25 +- ...esPackageExports(module=node18).errors.txt | 105 +---- ...odeModulesPackageExports(module=node18).js | 87 ++-- ...dulesPackageExports(module=node18).symbols | 18 +- ...ModulesPackageExports(module=node18).types | 208 ++++----- ...esPackageImports(module=node18).errors.txt | 37 +- ...odeModulesPackageImports(module=node18).js | 65 ++- ...esPackageImports(module=node18).trace.json | 234 +++++++--- ...ModulesPackageImports(module=node18).types | 72 +-- ...gePatternExports(module=node18).errors.txt | 74 +--- ...lesPackagePatternExports(module=node18).js | 55 ++- ...ckagePatternExports(module=node18).symbols | 18 +- ...PackagePatternExports(module=node18).types | 136 +++--- ...rnExportsExclude(module=node18).errors.txt | 146 +++--- ...agePatternExportsExclude(module=node18).js | 73 ++- ...tternExportsExclude(module=node18).symbols | 18 +- ...PatternExportsExclude(module=node18).types | 136 +++--- ...nExportsTrailers(module=node18).errors.txt | 74 +--- ...gePatternExportsTrailers(module=node18).js | 55 ++- ...ternExportsTrailers(module=node18).symbols | 18 +- ...nExportsTrailers(module=node18).trace.json | 358 ++++++++++++--- ...atternExportsTrailers(module=node18).types | 136 +++--- ...esolveJsonModule(module=node18).errors.txt | 43 -- ...ModulesResolveJsonModule(module=node18).js | 91 ++-- ...esResolveJsonModule(module=node18).symbols | 16 +- ...ulesResolveJsonModule(module=node18).types | 124 +++--- ...ronousCallErrors(module=node18).errors.txt | 17 +- ...lesSynchronousCallErrors(module=node18).js | 9 +- ...SynchronousCallErrors(module=node18).types | 24 +- ...lesTopLevelAwait(module=node18).errors.txt | 18 +- ...nodeModulesTopLevelAwait(module=node18).js | 5 +- ...DeclarationEmit1(module=node18).errors.txt | 32 -- ...odeDeclarationEmit1(module=node18).symbols | 9 + ...eModeDeclarationEmit1(module=node18).types | 8 + ...DeclarationEmit2(module=node18).errors.txt | 37 -- ...enceModeDeclarationEmit2(module=node18).js | 3 +- ...odeDeclarationEmit2(module=node18).symbols | 9 + ...eModeDeclarationEmit2(module=node18).types | 8 + ...DeclarationEmit3(module=node18).errors.txt | 31 -- ...enceModeDeclarationEmit3(module=node18).js | 3 +- ...DeclarationEmit4(module=node18).errors.txt | 26 -- ...DeclarationEmit5(module=node18).errors.txt | 27 -- ...DeclarationEmit6(module=node18).errors.txt | 37 -- ...enceModeDeclarationEmit6(module=node18).js | 7 +- ...odeDeclarationEmit6(module=node18).symbols | 15 +- ...eModeDeclarationEmit6(module=node18).types | 39 +- ...DeclarationEmit7(module=node18).errors.txt | 63 --- ...enceModeDeclarationEmit7(module=node18).js | 81 +++- ...odeDeclarationEmit7(module=node18).symbols | 34 +- ...eModeDeclarationEmit7(module=node18).types | 74 +++- ...nceModeOverride1(module=node18).errors.txt | 10 +- ...erenceModeOverride1(module=node18).symbols | 11 +- ...eferenceModeOverride1(module=node18).types | 14 +- ...nceModeOverride2(module=node18).errors.txt | 10 +- ...shReferenceModeOverride2(module=node18).js | 3 +- ...erenceModeOverride2(module=node18).symbols | 11 +- ...eferenceModeOverride2(module=node18).types | 14 +- ...nceModeOverride3(module=node18).errors.txt | 2 - ...shReferenceModeOverride3(module=node18).js | 3 +- ...nceModeOverride4(module=node18).errors.txt | 2 - ...nceModeOverride5(module=node18).errors.txt | 31 -- ...verrideModeError(module=node18).errors.txt | 10 +- ...deOverrideModeError(module=node18).symbols | 11 +- ...ModeOverrideModeError(module=node18).types | 14 +- ...onPackageExports(module=node18).errors.txt | 63 --- ...pesVersionPackageExports(module=node18).js | 43 +- ...rsionPackageExports(module=node18).symbols | 6 + ...VersionPackageExports(module=node18).types | 48 +- ...ePackageSelfName(module=node18).errors.txt | 16 +- .../nodePackageSelfName(module=node18).js | 43 +- .../nodePackageSelfName(module=node18).types | 24 +- ...geSelfNameScoped(module=node18).errors.txt | 16 +- ...odePackageSelfNameScoped(module=node18).js | 43 +- ...PackageSelfNameScoped(module=node18).types | 24 +- ...thMissingExports(module=node18).errors.txt | 7 +- 244 files changed, 5809 insertions(+), 5631 deletions(-) delete mode 100644 tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 179860bd80ed5..554ad15b989d1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -39209,6 +39209,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } switch (moduleKind) { case ModuleKind.Node16: + case ModuleKind.Node18: case ModuleKind.NodeNext: if (sourceFile.impliedNodeFormat === ModuleKind.CommonJS) { span ??= getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -52065,6 +52066,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } switch (moduleKind) { case ModuleKind.Node16: + case ModuleKind.Node18: case ModuleKind.NodeNext: if (sourceFile.impliedNodeFormat === ModuleKind.CommonJS) { diagnostics.add( diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 0d499f3a08298..8c19f33600649 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -86,6 +86,7 @@ function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory"] = exports[""] = exports[""] = void 0; const someValue = "someValue"; @@ -46,7 +79,7 @@ Object.defineProperty(exports, "", { enumerable: true, get: function () { ret const arbitraryModuleNamespaceIdentifiers_module_3 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") throw "should be someValue"; -exports[""] = require("./arbitraryModuleNamespaceIdentifiers_module"); +exports[""] = __importStar(require("./arbitraryModuleNamespaceIdentifiers_module")); const arbitraryModuleNamespaceIdentifiers_module_4 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") throw "should be someValue"; diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js index 2bf5641f43b50..47204b7a76f30 100644 --- a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js @@ -10,20 +10,17 @@ const y = { ...o }; //// [a.js] -"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; let A = class A { }; -exports.A = A; -exports.A = A = __decorate([ +A = __decorate([ dec ], A); +export { A }; const o = { a: 1 }; const y = Object.assign({}, o); diff --git a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt index 5be321ec2b3a1..2fd1d68ba8d00 100644 --- a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. 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. @@ -13,7 +12,6 @@ b.mts(20,6): error TS2349: This expression is not callable. Type 'typeof import("mod")' has no call signatures. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== mod.cts (0 errors) ==== declare function fun(): void; export default fun; diff --git a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js index c3a488cf11aee..1d6e31ec0afb2 100644 --- a/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js @@ -38,33 +38,28 @@ self.def.default(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = fun; //// [b.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.def = exports.default = void 0; -const mod_cjs_1 = require("./mod.cjs"); -const mod_cjs_2 = require("./mod.cjs"); -const mod_cjs_3 = require("./mod.cjs"); -const self = require("./b.mjs"); -var mod_cjs_4 = require("./mod.cjs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mod_cjs_4.default; } }); -var mod_cjs_5 = require("./mod.cjs"); -Object.defineProperty(exports, "def", { enumerable: true, get: function () { return mod_cjs_5.default; } }); -mod_cjs_1.default === mod_cjs_2.default; -mod_cjs_2.default === mod_cjs_3.default; -mod_cjs_3.default === mod_cjs_3.default; -mod_cjs_3.default === self.default; +import a from "./mod.cjs"; +import { default as b } from "./mod.cjs"; +import c, { default as d } from "./mod.cjs"; +import * as self from "./b.mjs"; +export { default } from "./mod.cjs"; +export { default as def } from "./mod.cjs"; +a === b; +b === c; +c === d; +d === self.default; self.default === self.def; // should all fail -(0, mod_cjs_1.default)(); -(0, mod_cjs_2.default)(); -(0, mod_cjs_3.default)(); -(0, mod_cjs_3.default)(); +a(); +b(); +c(); +d(); self.default(); self.def(); // should all work -mod_cjs_1.default.default(); -mod_cjs_2.default.default(); -mod_cjs_3.default.default(); -mod_cjs_3.default.default(); +a.default(); +b.default(); +c.default(); +d.default(); self.default.default(); self.def.default(); diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js index 92b7e88696b42..2d0c7b4607ea5 100644 --- a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js @@ -14,6 +14,39 @@ p.thing(); //// [index.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const p = require("pkg"); +const p = __importStar(require("pkg")); p.thing(); diff --git a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js index 92b7e88696b42..2d0c7b4607ea5 100644 --- a/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js @@ -14,6 +14,39 @@ p.thing(); //// [index.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const p = require("pkg"); +const p = __importStar(require("pkg")); p.thing(); diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt index 714e82005ef23..fe6d0aa7e42be 100644 --- a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt @@ -1,27 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.js (1 errors) ==== +!!! 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"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? self; -==== index.mjs (1 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as self from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? self; ==== index.cjs (1 errors) ==== // esm format file import * as self from "package"; ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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) ==== { diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js index b7f552a39e545..1498e98d79602 100644 --- a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +const self = __importStar(require("package")); self; diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types index 435e86a52159a..f8e06c7c53e1c 100644 --- a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).types @@ -3,30 +3,30 @@ === index.js === // esm format file import * as self from "package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ === index.mjs === // esm format file import * as self from "package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ === index.cjs === // esm format file import * as self from "package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModules1(module=node18).errors.txt b/tests/baselines/reference/nodeModules1(module=node18).errors.txt index 29851dcc9eb75..acd3f749846d5 100644 --- a/tests/baselines/reference/nodeModules1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModules1(module=node18).errors.txt @@ -1,70 +1,86 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(15,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(17,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(18,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(20,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(21,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(23,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(24,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(51,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(53,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(54,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(56,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(57,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(59,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(60,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(75,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(77,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(78,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(80,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(81,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(83,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(84,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(58,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(59,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(58,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(59,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = 1; @@ -101,7 +117,7 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // cjs format file const x = 1; export {x}; -==== index.mts (21 errors) ==== +==== index.mts (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -117,29 +133,37 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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; @@ -167,29 +191,25 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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"); - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m27 = require("./subfolder/"); - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m28 = require("./subfolder/index"); import m29 = require("./subfolder2"); - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m30 = require("./subfolder2/"); - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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; @@ -205,73 +225,89 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module './' or its corresponding type declarations. 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'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 (21 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m16 from "./subfolder/"; - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m17 from "./subfolder/index"; import * as m18 from "./subfolder2"; - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m19 from "./subfolder2/"; - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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; @@ -299,29 +335,25 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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"); - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m27 = require("./subfolder/"); - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m28 = require("./subfolder/index"); import m29 = require("./subfolder2"); - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m30 = require("./subfolder2/"); - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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; @@ -337,33 +369,41 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module './' or its corresponding type declarations. 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'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 (21 errors) ==== +==== index.ts (27 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -379,29 +419,37 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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; @@ -429,29 +477,25 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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"); - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m27 = require("./subfolder/"); - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m28 = require("./subfolder/index"); import m29 = require("./subfolder2"); - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m30 = require("./subfolder2/"); - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m31 = require("./subfolder2/index"); import m32 = require("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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; @@ -467,29 +511,37 @@ index.ts(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did y // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module './' or its corresponding type declarations. 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'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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/tests/baselines/reference/nodeModules1(module=node18).js b/tests/baselines/reference/nodeModules1(module=node18).js index c4d68e41d7081..bfebc4d12e830 100644 --- a/tests/baselines/reference/nodeModules1(module=node18).js +++ b/tests/baselines/reference/nodeModules1(module=node18).js @@ -335,12 +335,9 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -356,26 +353,17 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -385,33 +373,66 @@ const x = 1; exports.x = x; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; // ESM-format imports below should issue errors -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +const m1 = __importStar(require("./index.js")); +const m2 = __importStar(require("./index.mjs")); +const m3 = __importStar(require("./index.cjs")); +const m4 = __importStar(require("./subfolder/index.js")); +const m5 = __importStar(require("./subfolder/index.mjs")); +const m6 = __importStar(require("./subfolder/index.cjs")); +const m7 = __importStar(require("./subfolder2/index.js")); +const m8 = __importStar(require("./subfolder2/index.mjs")); +const m9 = __importStar(require("./subfolder2/index.cjs")); +const m10 = __importStar(require("./subfolder2/another/index.js")); +const m11 = __importStar(require("./subfolder2/another/index.mjs")); +const m12 = __importStar(require("./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) -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +const m13 = __importStar(require("./")); +const m14 = __importStar(require("./index")); +const m15 = __importStar(require("./subfolder")); +const m16 = __importStar(require("./subfolder/")); +const m17 = __importStar(require("./subfolder/index")); +const m18 = __importStar(require("./subfolder2")); +const m19 = __importStar(require("./subfolder2/")); +const m20 = __importStar(require("./subfolder2/index")); +const m21 = __importStar(require("./subfolder2/another")); +const m22 = __importStar(require("./subfolder2/another/")); +const m23 = __importStar(require("./subfolder2/another/index")); void m1; void m2; void m3; @@ -474,33 +495,32 @@ const _m45 = import("./subfolder2/another/index"); const x = 1; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -525,17 +545,17 @@ void m21; void m22; void m23; // 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!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -561,35 +581,34 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -614,17 +633,17 @@ void m21; void m22; void m23; // 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!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -650,7 +669,7 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModules1(module=node18).symbols b/tests/baselines/reference/nodeModules1(module=node18).symbols index 5a37ad42d71a0..cf80f6db97d80 100644 --- a/tests/baselines/reference/nodeModules1(module=node18).symbols +++ b/tests/baselines/reference/nodeModules1(module=node18).symbols @@ -285,7 +285,6 @@ const _m35 = import("./"); const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.mts, 74, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.mts, 75, 5)) @@ -295,7 +294,6 @@ const _m38 = import("./subfolder/"); const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.mts, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.mts, 78, 5)) @@ -305,7 +303,6 @@ const _m41 = import("./subfolder2/"); const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.mts, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.mts, 81, 5)) @@ -315,7 +312,6 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.mts, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // esm format file const x = 1; @@ -538,7 +534,6 @@ const _m35 = import("./"); const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.cts, 75, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.cts, 76, 5)) @@ -548,7 +543,6 @@ const _m38 = import("./subfolder/"); const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.cts, 78, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.cts, 79, 5)) @@ -558,7 +552,6 @@ const _m41 = import("./subfolder2/"); const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.cts, 81, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.cts, 82, 5)) @@ -568,7 +561,6 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.cts, 84, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // cjs format file const x = 1; @@ -790,7 +782,6 @@ const _m35 = import("./"); const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.ts, 74, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.ts, 75, 5)) @@ -800,7 +791,6 @@ const _m38 = import("./subfolder/"); const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.ts, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.ts, 78, 5)) @@ -810,7 +800,6 @@ const _m41 = import("./subfolder2/"); const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.ts, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.ts, 81, 5)) @@ -820,7 +809,6 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.ts, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // esm format file const x = 1; diff --git a/tests/baselines/reference/nodeModules1(module=node18).types b/tests/baselines/reference/nodeModules1(module=node18).types index 5c08ff59e38b1..49631af15a8e8 100644 --- a/tests/baselines/reference/nodeModules1(module=node18).types +++ b/tests/baselines/reference/nodeModules1(module=node18).types @@ -163,8 +163,8 @@ import * as m13 from "./"; > : ^^^ import * as m14 from "./index"; ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ import * as m15 from "./subfolder"; >m15 : any @@ -175,8 +175,8 @@ import * as m16 from "./subfolder/"; > : ^^^ import * as m17 from "./subfolder/index"; ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ import * as m18 from "./subfolder2"; >m18 : any @@ -187,8 +187,8 @@ import * as m19 from "./subfolder2/"; > : ^^^ import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ import * as m21 from "./subfolder2/another"; >m21 : any @@ -199,8 +199,8 @@ import * as m22 from "./subfolder2/another/"; > : ^^^ import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 -> : ^^^^^^^^^^ +>m23 : any +> : ^^^ void m1; >void m1 : undefined @@ -283,8 +283,8 @@ void m13; void m14; >void m14 : undefined > : ^^^^^^^^^ ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ void m15; >void m15 : undefined @@ -301,8 +301,8 @@ void m16; void m17; >void m17 : undefined > : ^^^^^^^^^ ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ void m18; >void m18 : undefined @@ -319,8 +319,8 @@ void m19; void m20; >void m20 : undefined > : ^^^^^^^^^ ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ void m21; >void m21 : undefined @@ -337,49 +337,49 @@ void m22; 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("./"); ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ import m25 = require("./index"); >m25 : typeof m1 > : ^^^^^^^^^ import m26 = require("./subfolder"); ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ import m27 = require("./subfolder/"); ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ import m28 = require("./subfolder/index"); ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ import m29 = require("./subfolder2"); ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ import m30 = require("./subfolder2/"); ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ import m31 = require("./subfolder2/index"); ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ import m32 = require("./subfolder2/another"); ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ import m33 = require("./subfolder2/another/"); ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ import m34 = require("./subfolder2/another/index"); >m34 : typeof m10 @@ -388,8 +388,8 @@ import m34 = require("./subfolder2/another/index"); void m24; >void m24 : undefined > : ^^^^^^^^^ ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ void m25; >void m25 : undefined @@ -400,50 +400,50 @@ void m25; void m26; >void m26 : undefined > : ^^^^^^^^^ ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ void m27; >void m27 : undefined > : ^^^^^^^^^ ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ void m28; >void m28 : undefined > : ^^^^^^^^^ ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ void m29; >void m29 : undefined > : ^^^^^^^^^ ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ void m30; >void m30 : undefined > : ^^^^^^^^^ ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ void m31; >void m31 : undefined > : ^^^^^^^^^ ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ void m32; >void m32 : undefined > : ^^^^^^^^^ ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ void m33; >void m33 : undefined > : ^^^^^^^^^ ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ void m34; >void m34 : undefined @@ -461,10 +461,10 @@ const _m35 = import("./"); > : ^^^^ const _m36 = import("./index"); ->_m36 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m36 : Promise +> : ^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^ >"./index" : "./index" > : ^^^^^^^^^ @@ -485,10 +485,10 @@ const _m38 = import("./subfolder/"); > : ^^^^^^^^^^^^^^ const _m39 = import("./subfolder/index"); ->_m39 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m39 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder/index" : "./subfolder/index" > : ^^^^^^^^^^^^^^^^^^^ @@ -509,10 +509,10 @@ const _m41 = import("./subfolder2/"); > : ^^^^^^^^^^^^^^^ const _m42 = import("./subfolder2/index"); ->_m42 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder2/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m42 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder2/index" : "./subfolder2/index" > : ^^^^^^^^^^^^^^^^^^^^ @@ -533,10 +533,10 @@ const _m44 = import("./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" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -603,44 +603,44 @@ 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 "./"; ->m13 : any -> : ^^^ +>m13 : typeof m1 +> : ^^^^^^^^^ import * as m14 from "./index"; >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 : 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 : 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 : typeof m10 @@ -721,8 +721,8 @@ void m12; void m13; >void m13 : undefined > : ^^^^^^^^^ ->m13 : any -> : ^^^ +>m13 : typeof m1 +> : ^^^^^^^^^ void m14; >void m14 : undefined @@ -733,14 +733,14 @@ void m14; 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 @@ -751,14 +751,14 @@ void m17; 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 @@ -769,14 +769,14 @@ void m20; 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 @@ -786,44 +786,44 @@ void m23; // 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("./"); ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ import m25 = require("./index"); >m25 : typeof m1 > : ^^^^^^^^^ import m26 = require("./subfolder"); ->m26 : any -> : ^^^ +>m26 : typeof m4 +> : ^^^^^^^^^ import m27 = require("./subfolder/"); ->m27 : any -> : ^^^ +>m27 : typeof m4 +> : ^^^^^^^^^ import m28 = require("./subfolder/index"); >m28 : typeof m4 > : ^^^^^^^^^ import m29 = require("./subfolder2"); ->m29 : any -> : ^^^ +>m29 : typeof m7 +> : ^^^^^^^^^ import m30 = require("./subfolder2/"); ->m30 : any -> : ^^^ +>m30 : typeof m7 +> : ^^^^^^^^^ import m31 = require("./subfolder2/index"); >m31 : typeof m7 > : ^^^^^^^^^ import m32 = require("./subfolder2/another"); ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ import m33 = require("./subfolder2/another/"); ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ import m34 = require("./subfolder2/another/index"); >m34 : typeof m10 @@ -832,8 +832,8 @@ import m34 = require("./subfolder2/another/index"); void m24; >void m24 : undefined > : ^^^^^^^^^ ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ void m25; >void m25 : undefined @@ -844,14 +844,14 @@ void m25; void m26; >void m26 : undefined > : ^^^^^^^^^ ->m26 : any -> : ^^^ +>m26 : typeof m4 +> : ^^^^^^^^^ void m27; >void m27 : undefined > : ^^^^^^^^^ ->m27 : any -> : ^^^ +>m27 : typeof m4 +> : ^^^^^^^^^ void m28; >void m28 : undefined @@ -862,14 +862,14 @@ void m28; void m29; >void m29 : undefined > : ^^^^^^^^^ ->m29 : any -> : ^^^ +>m29 : typeof m7 +> : ^^^^^^^^^ void m30; >void m30 : undefined > : ^^^^^^^^^ ->m30 : any -> : ^^^ +>m30 : typeof m7 +> : ^^^^^^^^^ void m31; >void m31 : undefined @@ -880,14 +880,14 @@ void m31; void m32; >void m32 : undefined > : ^^^^^^^^^ ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ void m33; >void m33 : undefined > : ^^^^^^^^^ ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ void m34; >void m34 : undefined @@ -905,10 +905,10 @@ const _m35 = import("./"); > : ^^^^ const _m36 = import("./index"); ->_m36 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m36 : Promise +> : ^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^ >"./index" : "./index" > : ^^^^^^^^^ @@ -929,10 +929,10 @@ const _m38 = import("./subfolder/"); > : ^^^^^^^^^^^^^^ const _m39 = import("./subfolder/index"); ->_m39 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m39 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder/index" : "./subfolder/index" > : ^^^^^^^^^^^^^^^^^^^ @@ -953,10 +953,10 @@ const _m41 = import("./subfolder2/"); > : ^^^^^^^^^^^^^^^ const _m42 = import("./subfolder2/index"); ->_m42 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder2/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m42 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder2/index" : "./subfolder2/index" > : ^^^^^^^^^^^^^^^^^^^^ @@ -977,10 +977,10 @@ const _m44 = import("./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" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1050,8 +1050,8 @@ import * as m13 from "./"; > : ^^^ import * as m14 from "./index"; ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ import * as m15 from "./subfolder"; >m15 : any @@ -1062,8 +1062,8 @@ import * as m16 from "./subfolder/"; > : ^^^ import * as m17 from "./subfolder/index"; ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ import * as m18 from "./subfolder2"; >m18 : any @@ -1074,8 +1074,8 @@ import * as m19 from "./subfolder2/"; > : ^^^ import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ import * as m21 from "./subfolder2/another"; >m21 : any @@ -1086,8 +1086,8 @@ import * as m22 from "./subfolder2/another/"; > : ^^^ import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 -> : ^^^^^^^^^^ +>m23 : any +> : ^^^ void m1; >void m1 : undefined @@ -1170,8 +1170,8 @@ void m13; void m14; >void m14 : undefined > : ^^^^^^^^^ ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ void m15; >void m15 : undefined @@ -1188,8 +1188,8 @@ void m16; void m17; >void m17 : undefined > : ^^^^^^^^^ ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ void m18; >void m18 : undefined @@ -1206,8 +1206,8 @@ void m19; void m20; >void m20 : undefined > : ^^^^^^^^^ ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ void m21; >void m21 : undefined @@ -1224,49 +1224,49 @@ void m22; 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("./"); ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ import m25 = require("./index"); >m25 : typeof m1 > : ^^^^^^^^^ import m26 = require("./subfolder"); ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ import m27 = require("./subfolder/"); ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ import m28 = require("./subfolder/index"); ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ import m29 = require("./subfolder2"); ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ import m30 = require("./subfolder2/"); ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ import m31 = require("./subfolder2/index"); ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ import m32 = require("./subfolder2/another"); ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ import m33 = require("./subfolder2/another/"); ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ import m34 = require("./subfolder2/another/index"); >m34 : typeof m10 @@ -1275,8 +1275,8 @@ import m34 = require("./subfolder2/another/index"); void m24; >void m24 : undefined > : ^^^^^^^^^ ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ void m25; >void m25 : undefined @@ -1287,50 +1287,50 @@ void m25; void m26; >void m26 : undefined > : ^^^^^^^^^ ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ void m27; >void m27 : undefined > : ^^^^^^^^^ ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ void m28; >void m28 : undefined > : ^^^^^^^^^ ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ void m29; >void m29 : undefined > : ^^^^^^^^^ ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ void m30; >void m30 : undefined > : ^^^^^^^^^ ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ void m31; >void m31 : undefined > : ^^^^^^^^^ ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ void m32; >void m32 : undefined > : ^^^^^^^^^ ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ void m33; >void m33 : undefined > : ^^^^^^^^^ ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ void m34; >void m34 : undefined @@ -1348,10 +1348,10 @@ const _m35 = import("./"); > : ^^^^ const _m36 = import("./index"); ->_m36 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m36 : Promise +> : ^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^ >"./index" : "./index" > : ^^^^^^^^^ @@ -1372,10 +1372,10 @@ const _m38 = import("./subfolder/"); > : ^^^^^^^^^^^^^^ const _m39 = import("./subfolder/index"); ->_m39 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m39 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder/index" : "./subfolder/index" > : ^^^^^^^^^^^^^^^^^^^ @@ -1396,10 +1396,10 @@ const _m41 = import("./subfolder2/"); > : ^^^^^^^^^^^^^^^ const _m42 = import("./subfolder2/index"); ->_m42 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder2/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m42 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder2/index" : "./subfolder2/index" > : ^^^^^^^^^^^^^^^^^^^^ @@ -1420,10 +1420,10 @@ const _m44 = import("./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" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt index 5c7ecc38491f1..13ade2052e398 100644 --- a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt @@ -1,103 +1,119 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(15,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(17,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(18,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(20,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(21,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(23,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(24,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(51,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(53,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.cjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(54,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.cjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(56,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.cjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(57,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(75,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(77,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(78,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(80,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(81,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(83,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(84,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.js(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.js(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.js(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(14,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(16,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(17,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(19,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(20,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(22,22): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(23,22): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(50,22): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(52,22): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.mjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(53,22): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.mjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(55,22): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? index.mjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(56,22): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(74,21): error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(76,21): error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(77,21): error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(79,21): error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(80,21): error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(82,21): error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== subfolder/index.js (0 errors) ==== // cjs format file const x = 1; @@ -134,7 +150,7 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did // esm format file const x = 1; export {x}; -==== index.js (32 errors) ==== +==== index.js (38 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -150,29 +166,37 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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; @@ -202,33 +226,27 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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. - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m27 = require("./subfolder/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m28 = require("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m29 = require("./subfolder2"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m30 = require("./subfolder2/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m31 = require("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -236,15 +254,17 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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; @@ -260,72 +280,88 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module './' or its corresponding type declarations. 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'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 (32 errors) ==== +==== index.cjs (38 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 TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m16 from "./subfolder/"; - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m17 from "./subfolder/index"; import * as m18 from "./subfolder2"; - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m19 from "./subfolder2/"; - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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; @@ -355,33 +391,27 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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. - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m27 = require("./subfolder/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m28 = require("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m29 = require("./subfolder2"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m30 = require("./subfolder2/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m31 = require("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -389,15 +419,17 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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; @@ -413,33 +445,41 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module './' or its corresponding type declarations. 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'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 (32 errors) ==== +==== index.mjs (38 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -455,29 +495,37 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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. 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; @@ -507,33 +555,27 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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. - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m27 = require("./subfolder/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m28 = require("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m29 = require("./subfolder2"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m30 = require("./subfolder2/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. - ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import m31 = require("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. @@ -541,15 +583,17 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! 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; @@ -565,29 +609,37 @@ index.mjs(83,21): error TS2792: Cannot find module './subfolder2/another/'. Did // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ -!!! error TS2792: Cannot find module './'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module './' or its corresponding type declarations. 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'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module './subfolder'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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 TS2792: Cannot find module './subfolder2/another'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 TS2792: Cannot find module './subfolder2/another/'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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 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/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js index 3b2d339f3aefb..4a63449d26383 100644 --- a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js @@ -335,12 +335,9 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -356,19 +353,13 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -377,41 +368,71 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; // ESM-format imports below should issue errors -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +const m1 = __importStar(require("./index.js")); +const m2 = __importStar(require("./index.mjs")); +const m3 = __importStar(require("./index.cjs")); +const m4 = __importStar(require("./subfolder/index.js")); +const m5 = __importStar(require("./subfolder/index.mjs")); +const m6 = __importStar(require("./subfolder/index.cjs")); +const m7 = __importStar(require("./subfolder2/index.js")); +const m8 = __importStar(require("./subfolder2/index.mjs")); +const m9 = __importStar(require("./subfolder2/index.cjs")); +const m10 = __importStar(require("./subfolder2/another/index.js")); +const m11 = __importStar(require("./subfolder2/another/index.mjs")); +const m12 = __importStar(require("./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) -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +const m13 = __importStar(require("./")); +const m14 = __importStar(require("./index")); +const m15 = __importStar(require("./subfolder")); +const m16 = __importStar(require("./subfolder/")); +const m17 = __importStar(require("./subfolder/index")); +const m18 = __importStar(require("./subfolder2")); +const m19 = __importStar(require("./subfolder2/")); +const m20 = __importStar(require("./subfolder2/index")); +const m21 = __importStar(require("./subfolder2/another")); +const m22 = __importStar(require("./subfolder2/another/")); +const m23 = __importStar(require("./subfolder2/another/index")); void m1; void m2; void m3; @@ -474,33 +495,32 @@ const _m45 = import("./subfolder2/another/index"); const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -525,17 +545,17 @@ void m21; void m22; void m23; // 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!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -561,35 +581,34 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +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 -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -614,17 +633,17 @@ void m21; void m22; void m23; // 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!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -650,7 +669,7 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols index eb2533cdf8e1d..1d24c14a43ea7 100644 --- a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols @@ -285,7 +285,6 @@ const _m35 = import("./"); const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.js, 74, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.js, 75, 5)) @@ -295,7 +294,6 @@ const _m38 = import("./subfolder/"); const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.js, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.js, 78, 5)) @@ -305,7 +303,6 @@ const _m41 = import("./subfolder2/"); const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.js, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.js, 81, 5)) @@ -315,7 +312,6 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.js, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // esm format file const x = 1; @@ -538,7 +534,6 @@ const _m35 = import("./"); const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.cjs, 75, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.cjs, 76, 5)) @@ -548,7 +543,6 @@ const _m38 = import("./subfolder/"); const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.cjs, 78, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.cjs, 79, 5)) @@ -558,7 +552,6 @@ const _m41 = import("./subfolder2/"); const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.cjs, 81, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.cjs, 82, 5)) @@ -568,7 +561,6 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.cjs, 84, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // cjs format file const x = 1; @@ -790,7 +782,6 @@ const _m35 = import("./"); const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.mjs, 74, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.mjs, 75, 5)) @@ -800,7 +791,6 @@ const _m38 = import("./subfolder/"); const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.mjs, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.mjs, 78, 5)) @@ -810,7 +800,6 @@ const _m41 = import("./subfolder2/"); const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.mjs, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.mjs, 81, 5)) @@ -820,7 +809,6 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.mjs, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // esm format file const x = 1; diff --git a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types index 15420c10fe1e8..672e1a9c81b16 100644 --- a/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).types @@ -163,8 +163,8 @@ import * as m13 from "./"; > : ^^^ import * as m14 from "./index"; ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ import * as m15 from "./subfolder"; >m15 : any @@ -175,8 +175,8 @@ import * as m16 from "./subfolder/"; > : ^^^ import * as m17 from "./subfolder/index"; ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ import * as m18 from "./subfolder2"; >m18 : any @@ -187,8 +187,8 @@ import * as m19 from "./subfolder2/"; > : ^^^ import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ import * as m21 from "./subfolder2/another"; >m21 : any @@ -199,8 +199,8 @@ import * as m22 from "./subfolder2/another/"; > : ^^^ import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 -> : ^^^^^^^^^^ +>m23 : any +> : ^^^ void m1; >void m1 : undefined @@ -283,8 +283,8 @@ void m13; void m14; >void m14 : undefined > : ^^^^^^^^^ ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ void m15; >void m15 : undefined @@ -301,8 +301,8 @@ void m16; void m17; >void m17 : undefined > : ^^^^^^^^^ ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ void m18; >void m18 : undefined @@ -319,8 +319,8 @@ void m19; void m20; >void m20 : undefined > : ^^^^^^^^^ ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ void m21; >void m21 : undefined @@ -337,49 +337,49 @@ void m22; 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("./"); ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ import m25 = require("./index"); >m25 : typeof m1 > : ^^^^^^^^^ import m26 = require("./subfolder"); ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ import m27 = require("./subfolder/"); ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ import m28 = require("./subfolder/index"); ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ import m29 = require("./subfolder2"); ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ import m30 = require("./subfolder2/"); ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ import m31 = require("./subfolder2/index"); ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ import m32 = require("./subfolder2/another"); ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ import m33 = require("./subfolder2/another/"); ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ import m34 = require("./subfolder2/another/index"); >m34 : typeof m10 @@ -388,8 +388,8 @@ import m34 = require("./subfolder2/another/index"); void m24; >void m24 : undefined > : ^^^^^^^^^ ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ void m25; >void m25 : undefined @@ -400,50 +400,50 @@ void m25; void m26; >void m26 : undefined > : ^^^^^^^^^ ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ void m27; >void m27 : undefined > : ^^^^^^^^^ ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ void m28; >void m28 : undefined > : ^^^^^^^^^ ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ void m29; >void m29 : undefined > : ^^^^^^^^^ ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ void m30; >void m30 : undefined > : ^^^^^^^^^ ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ void m31; >void m31 : undefined > : ^^^^^^^^^ ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ void m32; >void m32 : undefined > : ^^^^^^^^^ ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ void m33; >void m33 : undefined > : ^^^^^^^^^ ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ void m34; >void m34 : undefined @@ -461,10 +461,10 @@ const _m35 = import("./"); > : ^^^^ const _m36 = import("./index"); ->_m36 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m36 : Promise +> : ^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^ >"./index" : "./index" > : ^^^^^^^^^ @@ -485,10 +485,10 @@ const _m38 = import("./subfolder/"); > : ^^^^^^^^^^^^^^ const _m39 = import("./subfolder/index"); ->_m39 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m39 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder/index" : "./subfolder/index" > : ^^^^^^^^^^^^^^^^^^^ @@ -509,10 +509,10 @@ const _m41 = import("./subfolder2/"); > : ^^^^^^^^^^^^^^^ const _m42 = import("./subfolder2/index"); ->_m42 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder2/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m42 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder2/index" : "./subfolder2/index" > : ^^^^^^^^^^^^^^^^^^^^ @@ -533,10 +533,10 @@ const _m44 = import("./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" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -603,44 +603,44 @@ 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 "./"; ->m13 : any -> : ^^^ +>m13 : typeof m1 +> : ^^^^^^^^^ import * as m14 from "./index"; >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 : 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 : 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 : typeof m10 @@ -721,8 +721,8 @@ void m12; void m13; >void m13 : undefined > : ^^^^^^^^^ ->m13 : any -> : ^^^ +>m13 : typeof m1 +> : ^^^^^^^^^ void m14; >void m14 : undefined @@ -733,14 +733,14 @@ void m14; 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 @@ -751,14 +751,14 @@ void m17; 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 @@ -769,14 +769,14 @@ void m20; 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 @@ -786,44 +786,44 @@ void m23; // 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("./"); ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ import m25 = require("./index"); >m25 : typeof m1 > : ^^^^^^^^^ import m26 = require("./subfolder"); ->m26 : any -> : ^^^ +>m26 : typeof m4 +> : ^^^^^^^^^ import m27 = require("./subfolder/"); ->m27 : any -> : ^^^ +>m27 : typeof m4 +> : ^^^^^^^^^ import m28 = require("./subfolder/index"); >m28 : typeof m4 > : ^^^^^^^^^ import m29 = require("./subfolder2"); ->m29 : any -> : ^^^ +>m29 : typeof m7 +> : ^^^^^^^^^ import m30 = require("./subfolder2/"); ->m30 : any -> : ^^^ +>m30 : typeof m7 +> : ^^^^^^^^^ import m31 = require("./subfolder2/index"); >m31 : typeof m7 > : ^^^^^^^^^ import m32 = require("./subfolder2/another"); ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ import m33 = require("./subfolder2/another/"); ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ import m34 = require("./subfolder2/another/index"); >m34 : typeof m10 @@ -832,8 +832,8 @@ import m34 = require("./subfolder2/another/index"); void m24; >void m24 : undefined > : ^^^^^^^^^ ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ void m25; >void m25 : undefined @@ -844,14 +844,14 @@ void m25; void m26; >void m26 : undefined > : ^^^^^^^^^ ->m26 : any -> : ^^^ +>m26 : typeof m4 +> : ^^^^^^^^^ void m27; >void m27 : undefined > : ^^^^^^^^^ ->m27 : any -> : ^^^ +>m27 : typeof m4 +> : ^^^^^^^^^ void m28; >void m28 : undefined @@ -862,14 +862,14 @@ void m28; void m29; >void m29 : undefined > : ^^^^^^^^^ ->m29 : any -> : ^^^ +>m29 : typeof m7 +> : ^^^^^^^^^ void m30; >void m30 : undefined > : ^^^^^^^^^ ->m30 : any -> : ^^^ +>m30 : typeof m7 +> : ^^^^^^^^^ void m31; >void m31 : undefined @@ -880,14 +880,14 @@ void m31; void m32; >void m32 : undefined > : ^^^^^^^^^ ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ void m33; >void m33 : undefined > : ^^^^^^^^^ ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ void m34; >void m34 : undefined @@ -905,10 +905,10 @@ const _m35 = import("./"); > : ^^^^ const _m36 = import("./index"); ->_m36 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m36 : Promise +> : ^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^ >"./index" : "./index" > : ^^^^^^^^^ @@ -929,10 +929,10 @@ const _m38 = import("./subfolder/"); > : ^^^^^^^^^^^^^^ const _m39 = import("./subfolder/index"); ->_m39 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m39 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder/index" : "./subfolder/index" > : ^^^^^^^^^^^^^^^^^^^ @@ -953,10 +953,10 @@ const _m41 = import("./subfolder2/"); > : ^^^^^^^^^^^^^^^ const _m42 = import("./subfolder2/index"); ->_m42 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder2/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m42 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder2/index" : "./subfolder2/index" > : ^^^^^^^^^^^^^^^^^^^^ @@ -977,10 +977,10 @@ const _m44 = import("./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" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1050,8 +1050,8 @@ import * as m13 from "./"; > : ^^^ import * as m14 from "./index"; ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ import * as m15 from "./subfolder"; >m15 : any @@ -1062,8 +1062,8 @@ import * as m16 from "./subfolder/"; > : ^^^ import * as m17 from "./subfolder/index"; ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ import * as m18 from "./subfolder2"; >m18 : any @@ -1074,8 +1074,8 @@ import * as m19 from "./subfolder2/"; > : ^^^ import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ import * as m21 from "./subfolder2/another"; >m21 : any @@ -1086,8 +1086,8 @@ import * as m22 from "./subfolder2/another/"; > : ^^^ import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 -> : ^^^^^^^^^^ +>m23 : any +> : ^^^ void m1; >void m1 : undefined @@ -1170,8 +1170,8 @@ void m13; void m14; >void m14 : undefined > : ^^^^^^^^^ ->m14 : typeof m1 -> : ^^^^^^^^^ +>m14 : any +> : ^^^ void m15; >void m15 : undefined @@ -1188,8 +1188,8 @@ void m16; void m17; >void m17 : undefined > : ^^^^^^^^^ ->m17 : typeof m4 -> : ^^^^^^^^^ +>m17 : any +> : ^^^ void m18; >void m18 : undefined @@ -1206,8 +1206,8 @@ void m19; void m20; >void m20 : undefined > : ^^^^^^^^^ ->m20 : typeof m7 -> : ^^^^^^^^^ +>m20 : any +> : ^^^ void m21; >void m21 : undefined @@ -1224,49 +1224,49 @@ void m22; 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("./"); ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ import m25 = require("./index"); >m25 : typeof m1 > : ^^^^^^^^^ import m26 = require("./subfolder"); ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ import m27 = require("./subfolder/"); ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ import m28 = require("./subfolder/index"); ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ import m29 = require("./subfolder2"); ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ import m30 = require("./subfolder2/"); ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ import m31 = require("./subfolder2/index"); ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ import m32 = require("./subfolder2/another"); ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ import m33 = require("./subfolder2/another/"); ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ import m34 = require("./subfolder2/another/index"); >m34 : typeof m10 @@ -1275,8 +1275,8 @@ import m34 = require("./subfolder2/another/index"); void m24; >void m24 : undefined > : ^^^^^^^^^ ->m24 : any -> : ^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ void m25; >void m25 : undefined @@ -1287,50 +1287,50 @@ void m25; void m26; >void m26 : undefined > : ^^^^^^^^^ ->m26 : any -> : ^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ void m27; >void m27 : undefined > : ^^^^^^^^^ ->m27 : any -> : ^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ void m28; >void m28 : undefined > : ^^^^^^^^^ ->m28 : typeof m4 -> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ void m29; >void m29 : undefined > : ^^^^^^^^^ ->m29 : any -> : ^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ void m30; >void m30 : undefined > : ^^^^^^^^^ ->m30 : any -> : ^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ void m31; >void m31 : undefined > : ^^^^^^^^^ ->m31 : typeof m7 -> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ void m32; >void m32 : undefined > : ^^^^^^^^^ ->m32 : any -> : ^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ void m33; >void m33 : undefined > : ^^^^^^^^^ ->m33 : any -> : ^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ void m34; >void m34 : undefined @@ -1348,10 +1348,10 @@ const _m35 = import("./"); > : ^^^^ const _m36 = import("./index"); ->_m36 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m36 : Promise +> : ^^^^^^^^^^^^ +>import("./index") : Promise +> : ^^^^^^^^^^^^ >"./index" : "./index" > : ^^^^^^^^^ @@ -1372,10 +1372,10 @@ const _m38 = import("./subfolder/"); > : ^^^^^^^^^^^^^^ const _m39 = import("./subfolder/index"); ->_m39 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m39 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder/index" : "./subfolder/index" > : ^^^^^^^^^^^^^^^^^^^ @@ -1396,10 +1396,10 @@ const _m41 = import("./subfolder2/"); > : ^^^^^^^^^^^^^^^ const _m42 = import("./subfolder2/index"); ->_m42 : Promise -> : ^^^^^^^^^^^^^^^^^^ ->import("./subfolder2/index") : Promise -> : ^^^^^^^^^^^^^^^^^^ +>_m42 : Promise +> : ^^^^^^^^^^^^ +>import("./subfolder2/index") : Promise +> : ^^^^^^^^^^^^ >"./subfolder2/index" : "./subfolder2/index" > : ^^^^^^^^^^^^^^^^^^^^ @@ -1420,10 +1420,10 @@ const _m44 = import("./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" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt deleted file mode 100644 index 41929261d778f..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== foo.cjs (0 errors) ==== - exports.foo = "foo" -==== bar.ts (1 errors) ==== - import foo from "./foo.cjs" - ~~~ -!!! error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? - foo.foo; \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols index 823a7964f337e..b855f772f99f4 100644 --- a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols @@ -11,5 +11,7 @@ import foo from "./foo.cjs" >foo : Symbol(foo, Decl(bar.ts, 0, 6)) foo.foo; +>foo.foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) >foo : Symbol(foo, Decl(bar.ts, 0, 6)) +>foo : Symbol(foo.foo, Decl(foo.cjs, 0, 0)) diff --git a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types index e56fb703b18d2..ec9c59e5c8a9b 100644 --- a/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).types @@ -15,14 +15,14 @@ exports.foo = "foo" === bar.ts === import foo from "./foo.cjs" ->foo : any -> : ^^^ +>foo : typeof foo +> : ^^^^^^^^^^ foo.foo; ->foo.foo : any -> : ^^^ ->foo : any -> : ^^^ ->foo : any -> : ^^^ +>foo.foo : "foo" +> : ^^^^^ +>foo : typeof foo +> : ^^^^^^^^^^ +>foo : "foo" +> : ^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index 5398523e2bcdc..af5e14950e1c9 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,182 +1,95 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. +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'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.js (7 errors) ==== +!!! 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (7 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (7 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; -==== node_modules/inner/index.d.ts (4 errors) ==== +==== node_modules/inner/index.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; export { ts }; export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (4 errors) ==== +==== node_modules/inner/index.d.mts (1 errors) ==== // esm format file import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; export { ts }; export const mjsSource = true; -==== node_modules/inner/index.d.cts (4 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js index 7090dc9eb4a60..89094051db9df 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js @@ -122,65 +122,94 @@ export const cjsSource = true; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -cjs; -mjs; -type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +const cjsi = __importStar(require("inner/a")); +const mjsi = __importStar(require("inner/b")); +const typei = __importStar(require("inner")); +const ts = __importStar(require("inner/types")); cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols index cabaaecaec289..6ac785d10279f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols @@ -33,16 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) === index.mjs === // esm format file @@ -77,16 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) === index.cjs === // cjs format file @@ -121,16 +137,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) mjsi.cjsSource; +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) typei.implicitCjsSource; +>typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) +>implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) ts.cjsSource; +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) === node_modules/inner/index.d.ts === // cjs format file @@ -147,19 +171,19 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) +>ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) === node_modules/inner/index.d.mts === // esm format file @@ -176,19 +200,19 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 7, 8)) +>type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.mts, 8, 8)) +>ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) === node_modules/inner/index.d.cts === // cjs format file @@ -205,17 +229,17 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 7, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.cts, 8, 8)) +>ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types index afec0a932a933..bfa4914e21fe9 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types @@ -3,224 +3,224 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/a"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/b"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ cjsi.mjsSource; ->cjsi.mjsSource : any -> : ^^^ ->cjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ mjsi.mjsSource; ->mjsi.mjsSource : any -> : ^^^ ->mjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ typei.mjsSource; ->typei.mjsSource : any -> : ^^^ ->typei : any -> : ^^^ ->mjsSource : any -> : ^^^ +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ ts.mjsSource; ->ts.mjsSource : any -> : ^^^ ->ts : any -> : ^^^ ->mjsSource : any -> : ^^^ +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/a"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/b"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ cjsi.mjsSource; ->cjsi.mjsSource : any -> : ^^^ ->cjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ mjsi.mjsSource; ->mjsi.mjsSource : any -> : ^^^ ->mjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ typei.mjsSource; ->typei.mjsSource : any -> : ^^^ ->typei : any -> : ^^^ ->mjsSource : any -> : ^^^ +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ ts.mjsSource; ->ts.mjsSource : any -> : ^^^ ->ts : any -> : ^^^ ->mjsSource : any -> : ^^^ +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/a"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/b"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ cjsi.cjsSource; ->cjsi.cjsSource : any -> : ^^^ ->cjsi : any -> : ^^^ ->cjsSource : any -> : ^^^ +>cjsi.cjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ mjsi.cjsSource; ->mjsi.cjsSource : any -> : ^^^ ->mjsi : any -> : ^^^ ->cjsSource : any -> : ^^^ +>mjsi.cjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ typei.implicitCjsSource; ->typei.implicitCjsSource : any -> : ^^^ ->typei : any -> : ^^^ ->implicitCjsSource : any -> : ^^^ +>typei.implicitCjsSource : true +> : ^^^^ +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ +>implicitCjsSource : true +> : ^^^^ ts.cjsSource; ->ts.cjsSource : any -> : ^^^ ->ts : any -> : ^^^ ->cjsSource : any -> : ^^^ +>ts.cjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -229,32 +229,32 @@ import * as cjs from "inner/a"; > : ^^^ import * as mjs from "inner/b"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ export { ts }; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export const implicitCjsSource = true; >implicitCjsSource : true @@ -269,32 +269,32 @@ import * as cjs from "inner/a"; > : ^^^ import * as mjs from "inner/b"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof mjs +> : ^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs +> : ^^^^^^^^^^ export { ts }; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export const mjsSource = true; >mjsSource : true @@ -305,36 +305,36 @@ export const mjsSource = true; === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/a"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/b"; ->mjs : any -> : ^^^ +>mjs : typeof cjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjs +> : ^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ export { ts }; ->ts : any -> : ^^^ +>ts : typeof cjs +> : ^^^^^^^^^^ export const cjsSource = true; >cjsSource : true diff --git a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt deleted file mode 100644 index ddd61ba43b672..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.js (0 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - } -==== index.js (0 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - } -==== 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/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js index 8214d98c428a7..ac43e11733d77 100644 --- a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js @@ -32,11 +32,8 @@ async function main() { const { readFile } = await import("fs"); } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; // esm format file -async function main() { +export async function main() { const { readFile } = await import("fs"); } diff --git a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types index fd7e480880512..8689b18a720f7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types @@ -10,7 +10,6 @@ export async function main() { >readFile : any > : ^^^ >await import("fs") : any -> : ^^^ >import("fs") : Promise > : ^^^^^^^^^^^^ >"fs" : "fs" @@ -26,7 +25,6 @@ export async function main() { >readFile : any > : ^^^ >await import("fs") : any -> : ^^^ >import("fs") : Promise > : ^^^^^^^^^^^^ >"fs" : "fs" @@ -35,5 +33,4 @@ export async function main() { === types.d.ts === declare module "fs"; >"fs" : any -> : ^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt index ec30d1cf8adc7..15bd70e4c2e9d 100644 --- a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt @@ -1,19 +1,14 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. 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. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -subfolder/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(3,1): error TS8003: 'export =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.js (2 errors) ==== +==== subfolder/index.js (1 errors) ==== // cjs 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. ==== subfolder/file.js (0 errors) ==== // cjs format file diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js index 738816e9d16d2..92ecb7eacddd7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js @@ -39,15 +39,12 @@ module.exports = a; const a = {}; module.exports = a; //// [index.js] -"use strict"; // esm format file const a = {}; -module.exports = a; +export {}; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -require("fs"); +import "fs"; const a = {}; module.exports = a; diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt deleted file mode 100644 index ef2cf1fb69bed..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node18).errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== foo.cjs (0 errors) ==== - // this file is a module despite having no imports -==== bar.js (0 errors) ==== - // however this file is _not_ a module \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt index 1c5d02077e80c..e54f9b0f94ca4 100644 --- a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt @@ -1,13 +1,23 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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. +subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.js (0 errors) ==== +==== subfolder/index.js (4 errors) ==== // cjs 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 {} + ~~~~~~ +!!! 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) ==== // esm format file diff --git a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js index 63bc1238be293..30926a25ccde1 100644 --- a/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js @@ -39,18 +39,13 @@ class Object { exports.Object = Object; exports.__esModule = false; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Object = exports.exports = exports.__esModule = void 0; -exports.require = require; // esm format file function require() { } const exports = {}; -exports.exports = exports; class Object { } -exports.Object = Object; -exports.__esModule = false; +export const __esModule = false; +export { require, exports, Object }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt index fa7517650f495..476c47f703e37 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. file.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. file.js(6,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -7,7 +6,6 @@ subfolder/index.js(2,1): error TS8002: 'import ... =' can only be used in TypeSc subfolder/index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== subfolder/index.js (2 errors) ==== // cjs format file import fs = require("fs"); diff --git a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js index b7f92cf813f02..ee161c309e871 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js @@ -38,21 +38,23 @@ const fs = require("fs"); fs.readFile; exports.fs2 = require("fs"); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const fs = require("fs"); +const fs = __require("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require("fs"); +export { fs2 }; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire_1 } from "module"; +const __require_1 = _createRequire_1(import.meta.url); // esm format file const __require = null; const _createRequire = null; -const fs = require("fs"); +const fs = __require_1("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require_1("fs"); +export { fs2 }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt index e7cfe79e31a52..17c99081b2e70 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt @@ -1,12 +1,16 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +subfolder/index.js(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +subfolder/index.js(4,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.js (0 errors) ==== +==== subfolder/index.js (2 errors) ==== // cjs format file import {default as _fs} from "fs"; + ~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. _fs.readFile; import * as fs from "fs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. fs.readFile; ==== index.js (0 errors) ==== // esm format file diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js index 1210148c3a7b9..a30d220227f20 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js @@ -32,18 +32,17 @@ declare module "tslib" { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); // cjs format file -const fs_1 = require("fs"); +const fs_1 = tslib_1.__importDefault(require("fs")); fs_1.default.readFile; -const fs = require("fs"); +const fs = tslib_1.__importStar(require("fs")); fs.readFile; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const fs_1 = require("fs"); -fs_1.default.readFile; -const fs = require("fs"); +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; fs.readFile; diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt index 85fba739c6b44..78bd927d81fe8 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt @@ -1,11 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +subfolder/index.ts(2,1): error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +subfolder/index.ts(3,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== +==== subfolder/index.ts (2 errors) ==== // cjs format file export * from "fs"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. export * as fs from "fs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. ==== index.js (0 errors) ==== // esm format file export * from "fs"; diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js index bc79f13e7fa21..1960ba0103e95 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js @@ -27,46 +27,16 @@ declare module "tslib" { //// [index.js] "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.fs = void 0; +const tslib_1 = require("tslib"); // cjs format file -__exportStar(require("fs"), exports); -exports.fs = require("fs"); +tslib_1.__exportStar(require("fs"), exports); +exports.fs = tslib_1.__importStar(require("fs")); //// [index.js] -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; // esm format file -__exportStar(require("fs"), exports); -exports.fs = require("fs"); +export * from "fs"; +export * as fs from "fs"; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt index ee0f262effc3c..f1e751aeb0f1f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt @@ -1,10 +1,11 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +subfolder/index.js(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.js (0 errors) ==== +==== subfolder/index.js (1 errors) ==== // cjs format file export {default} from "fs"; + ~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. export {default as foo} from "fs"; export {bar as baz} from "fs"; ==== index.js (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js index 4a6f4b906ee92..8fefc3d2d6b56 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js @@ -31,24 +31,19 @@ declare module "tslib" { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.baz = exports.foo = exports.default = void 0; +var tslib_1 = require("tslib"); // cjs format file var fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); var fs_2 = require("fs"); -Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); +Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); var fs_3 = require("fs"); Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.baz = exports.foo = exports.default = void 0; // esm format file -var fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); -var fs_2 = require("fs"); -Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); -var fs_3 = require("fs"); -Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt index a7955aad00341..28110ed339d18 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -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(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== 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 (1 errors) ==== +==== index.js (0 errors) ==== // esm 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}; ==== package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js index e2ef275a52a12..7e6d01b7daf2a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js @@ -27,12 +27,9 @@ exports.x = void 0; const x = import.meta.url; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = import.meta.url; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt index eb90cf53bdb1a..f5736b5998181 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -1,151 +1,88 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.js (6 errors) ==== +!!! 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.mjs (6 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.cjs (6 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js index 05f5e0949ee77..208b7a1a36fde 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js @@ -88,59 +88,88 @@ export { type }; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.mjs] // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +// cjs format file +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); cjsi; mjsi; typei; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols index 4da1db5bae890..9fe0e570a7061 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols @@ -126,13 +126,13 @@ import * as type from "inner"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -146,13 +146,13 @@ import * as type from "inner"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -166,11 +166,11 @@ import * as type from "inner"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types index 871405e728153..4a54afca62898 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types @@ -3,152 +3,152 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -157,74 +157,74 @@ import * as cjs from "inner/cjs"; > : ^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt index afa529c804ad5..e845dc72f0284 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt @@ -1,55 +1,34 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.js (3 errors) ==== +!!! 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"; - ~~~~~~ -!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "#mjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "#cjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "#mjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // esm format file import * as cjs from "#cjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "#mjs"; ~~~~~~ -!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js index 4e8df6368cca6..510e6b7128c79 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js @@ -37,41 +37,70 @@ type; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.mjs] // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +const cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); cjs; mjs; type; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.js] // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types index 7d87c22467c97..4557791be394f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).types @@ -3,78 +3,78 @@ === index.js === // esm format file import * as cjs from "#cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "#mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ === index.mjs === // esm format file import * as cjs from "#cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "#mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ === index.cjs === // esm format file import * as cjs from "#cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "#mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt index 03fdafb9ecb97..37254a32db001 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -1,106 +1,62 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.cjs (3 errors) ==== +==== index.cjs (1 errors) ==== // cjs format file import * as cjsi from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js index 066c2c6afb461..79669dc7d4da8 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js @@ -66,32 +66,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +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] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +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] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +const cjsi = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(require("inner/js/index")); cjsi; mjsi; typei; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols index 98b3fb4849073..d6dea7356d738 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols @@ -72,13 +72,13 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -92,13 +92,13 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -112,11 +112,11 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types index 8782e1209c94b..ab36a515a18bd 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types @@ -3,80 +3,80 @@ === index.js === // esm format file import * as cjsi from "inner/cjs/index"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mjs === // esm format file import * as cjsi from "inner/cjs/index"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cjs === // cjs format file import * as cjsi from "inner/cjs/index"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ import * as typei from "inner/js/index"; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -85,74 +85,74 @@ import * as cjs from "inner/cjs/index"; > : ^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs/index"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs/index"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt index ee560de1ebabe..44e51033d1cc7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt @@ -1,36 +1,34 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cjs(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +index.cjs(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +index.cjs(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +index.js(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +index.js(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +index.js(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +index.mjs(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +index.mjs(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +index.mjs(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== index.js (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjsi from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as typei from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. cjsi; mjsi; typei; @@ -38,13 +36,13 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'i // esm format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjsi from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as typei from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. cjsi; mjsi; typei; @@ -52,13 +50,13 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'i // cjs format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjsi from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as typei from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. cjsi; mjsi; typei; @@ -66,13 +64,13 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'i // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjs from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as type from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. export { cjs }; export { mjs }; export { type }; @@ -80,13 +78,13 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'i // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjs from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as type from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. export { cjs }; export { mjs }; export { type }; @@ -94,13 +92,13 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'i // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjs from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as type from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js index 6e380318eb8ce..3ba5fbbce0406 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js @@ -69,32 +69,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +const cjsi = __importStar(require("inner/cjs/exclude/index")); +const mjsi = __importStar(require("inner/mjs/exclude/index")); +const typei = __importStar(require("inner/js/exclude/index")); cjsi; mjsi; typei; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt index f2b6c5a1fdb97..dbaadfd82f599 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,106 +1,62 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cjs(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cjs(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.js(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mjs(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index.js"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index.js"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.cjs (3 errors) ==== +==== index.cjs (1 errors) ==== // cjs format file import * as cjsi from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner/js/index.js"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js index d269d9f4830d3..b23d73a88c0e9 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js @@ -66,32 +66,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +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] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +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] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +const cjsi = __importStar(require("inner/cjs/index.cjs")); +const mjsi = __importStar(require("inner/mjs/index.mjs")); +const typei = __importStar(require("inner/js/index.js")); cjsi; mjsi; typei; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols index 8775c6fa39016..5dd3851cacbbc 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols @@ -72,13 +72,13 @@ import * as type from "inner/js/index.js"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -92,13 +92,13 @@ import * as type from "inner/js/index.js"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -112,11 +112,11 @@ import * as type from "inner/js/index.js"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types index 2f810966848df..8aec22f2cab84 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types @@ -3,80 +3,80 @@ === index.js === // esm format file import * as cjsi from "inner/cjs/index.cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index.mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index.js"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mjs === // esm format file import * as cjsi from "inner/cjs/index.cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index.mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index.js"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cjs === // cjs format file import * as cjsi from "inner/cjs/index.cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index.mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ import * as typei from "inner/js/index.js"; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -85,74 +85,74 @@ import * as cjs from "inner/cjs/index.cjs"; > : ^^^ import * as mjs from "inner/mjs/index.mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner/js/index.js"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index.mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner/js/index.js"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index.mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner/js/index.js"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt index a59232c3bc594..a4ba6ab81a73f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt @@ -1,17 +1,24 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. 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(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(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(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.js (2 errors) ==== +==== subfolder/index.js (4 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 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"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -21,12 +28,14 @@ subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeSc const mod4 = await import ("./index.js"); h(); } -==== index.js (2 errors) ==== +==== index.js (3 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. import {f} from "./subfolder/index.js"; import mod2 = require("./subfolder/index.js"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js index 7d90a57a5ad81..bb91ae6ef3a60 100644 --- a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js @@ -34,18 +34,17 @@ export async function h() { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.h = h; +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const index_js_1 = require("./index.js"); -const mod = require("./index.js"); -const index_js_2 = require("./subfolder/index.js"); -const mod2 = require("./subfolder/index.js"); -async function h() { +import { h as _h } from "./index.js"; +const mod = __require("./index.js"); +import { f } from "./subfolder/index.js"; +const mod2 = __require("./subfolder/index.js"); +export async function h() { const mod3 = await import("./index.js"); const mod4 = await import("./subfolder/index.js"); - (0, index_js_2.f)(); + f(); } //// [index.js] "use strict"; diff --git a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types index df756555cade2..e10d1bf1c8370 100644 --- a/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).types @@ -35,12 +35,12 @@ export async function f() { > : ^^^^^^^^^^^^^ const mod4 = await import ("./index.js"); ->mod4 : typeof mod2 -> : ^^^^^^^^^^^ ->await import ("./index.js") : typeof mod2 -> : ^^^^^^^^^^^ ->import ("./index.js") : Promise -> : ^^^^^^^^^^^^^^^^^^^^ +>mod4 : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import ("./index.js") : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import ("./index.js") : Promise<{ default: typeof mod2; f(): Promise; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./index.js" : "./index.js" > : ^^^^^^^^^^^^ @@ -85,12 +85,12 @@ export async function h() { > : ^^^^^^^^^^^^ const mod4 = await import ("./subfolder/index.js"); ->mod4 : typeof mod2 -> : ^^^^^^^^^^^ ->await import ("./subfolder/index.js") : typeof mod2 -> : ^^^^^^^^^^^ ->import ("./subfolder/index.js") : Promise -> : ^^^^^^^^^^^^^^^^^^^^ +>mod4 : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import ("./subfolder/index.js") : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import ("./subfolder/index.js") : Promise<{ default: typeof mod2; f(): Promise; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./subfolder/index.js" : "./subfolder/index.js" > : ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt index 6ed5c8455eb78..78c93edaa0624 100644 --- a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt @@ -1,29 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== 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/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js index 0ef93181fc6ed..354fe725f0960 100644 --- a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js @@ -30,12 +30,9 @@ const x = await 1; exports.x = x; for await (const y of []) { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = await 1; -exports.x = x; +export { x }; for await (const y of []) { } diff --git a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt deleted file mode 100644 index 9692b5b736f78..0000000000000 --- a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== 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/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js index b766039383966..f0c9198a51305 100644 --- a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js @@ -25,11 +25,9 @@ exports.a = void 0; // cjs format file exports.a = 1; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const index_js_1 = require("./subfolder/index.js"); -index_js_1.default; +import mod from "./subfolder/index.js"; +mod; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types index de096c908cfe0..1ae92add000d0 100644 --- a/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).types @@ -11,10 +11,10 @@ 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/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt index cfc42c3d5013f..41703e1cf0cc1 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,182 +1,95 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(8,23): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(9,23): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(11,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(5,21): error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. +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'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (7 errors) ==== +!!! 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (7 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (7 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; -==== node_modules/inner/index.d.ts (4 errors) ==== +==== node_modules/inner/index.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; export { ts }; export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (4 errors) ==== +==== node_modules/inner/index.d.mts (1 errors) ==== // esm format file import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; export { ts }; export const mjsSource = true; -==== node_modules/inner/index.d.cts (4 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/a'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/b'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as ts from "inner/types"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/types'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js index 7c9b662518c41..8bf4f316a59ff 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js @@ -122,65 +122,94 @@ export const cjsSource = true; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -cjs; -mjs; -type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +const cjsi = __importStar(require("inner/a")); +const mjsi = __importStar(require("inner/b")); +const typei = __importStar(require("inner")); +const ts = __importStar(require("inner/types")); cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// 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/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols index 62ae82c15d2e4..07c60903e55eb 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols @@ -33,16 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) === index.mts === // esm format file @@ -77,16 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) === index.cts === // cjs format file @@ -121,16 +137,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) mjsi.cjsSource; +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) typei.implicitCjsSource; +>typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) +>implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) ts.cjsSource; +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) === node_modules/inner/index.d.ts === // cjs format file @@ -147,19 +171,19 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) +>ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) === node_modules/inner/index.d.mts === // esm format file @@ -176,19 +200,19 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 7, 8)) +>type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.mts, 8, 8)) +>ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) === node_modules/inner/index.d.cts === // cjs format file @@ -205,17 +229,17 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 7, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.cts, 8, 8)) +>ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types index 2e8fe4bc82700..a7cb6f45bf8e8 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types @@ -3,224 +3,224 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/a"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/b"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ cjsi.mjsSource; ->cjsi.mjsSource : any -> : ^^^ ->cjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ mjsi.mjsSource; ->mjsi.mjsSource : any -> : ^^^ ->mjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ typei.mjsSource; ->typei.mjsSource : any -> : ^^^ ->typei : any -> : ^^^ ->mjsSource : any -> : ^^^ +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ ts.mjsSource; ->ts.mjsSource : any -> : ^^^ ->ts : any -> : ^^^ ->mjsSource : any -> : ^^^ +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/a"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/b"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ cjsi.mjsSource; ->cjsi.mjsSource : any -> : ^^^ ->cjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ mjsi.mjsSource; ->mjsi.mjsSource : any -> : ^^^ ->mjsi : any -> : ^^^ ->mjsSource : any -> : ^^^ +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ typei.mjsSource; ->typei.mjsSource : any -> : ^^^ ->typei : any -> : ^^^ ->mjsSource : any -> : ^^^ +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ ts.mjsSource; ->ts.mjsSource : any -> : ^^^ ->ts : any -> : ^^^ ->mjsSource : any -> : ^^^ +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/a"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/b"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ cjsi.cjsSource; ->cjsi.cjsSource : any -> : ^^^ ->cjsi : any -> : ^^^ ->cjsSource : any -> : ^^^ +>cjsi.cjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ mjsi.cjsSource; ->mjsi.cjsSource : any -> : ^^^ ->mjsi : any -> : ^^^ ->cjsSource : any -> : ^^^ +>mjsi.cjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ typei.implicitCjsSource; ->typei.implicitCjsSource : any -> : ^^^ ->typei : any -> : ^^^ ->implicitCjsSource : any -> : ^^^ +>typei.implicitCjsSource : true +> : ^^^^ +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ +>implicitCjsSource : true +> : ^^^^ ts.cjsSource; ->ts.cjsSource : any -> : ^^^ ->ts : any -> : ^^^ ->cjsSource : any -> : ^^^ +>ts.cjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -229,32 +229,32 @@ import * as cjs from "inner/a"; > : ^^^ import * as mjs from "inner/b"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ export { ts }; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export const implicitCjsSource = true; >implicitCjsSource : true @@ -269,32 +269,32 @@ import * as cjs from "inner/a"; > : ^^^ import * as mjs from "inner/b"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof mjs +> : ^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs +> : ^^^^^^^^^^ export { ts }; ->ts : any -> : ^^^ +>ts : typeof mjs +> : ^^^^^^^^^^ export const mjsSource = true; >mjsSource : true @@ -305,36 +305,36 @@ export const mjsSource = true; === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/a"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/b"; ->mjs : any -> : ^^^ +>mjs : typeof cjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ import * as ts from "inner/types"; ->ts : any -> : ^^^ +>ts : typeof cjs +> : ^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ export { ts }; ->ts : any -> : ^^^ +>ts : typeof cjs +> : ^^^^^^^^^^ export const cjsSource = true; >cjsSource : true diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt index 8e8a5346eb6c4..f2737ac29f32f 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt @@ -1,160 +1,94 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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 TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (6 errors) ==== +!!! 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const a = cjs; export const b = mjs; export const c = type; import * as cjsi from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const d = cjsi; export const e = mjsi; export const f = typei; -==== index.mts (6 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const a = cjs; export const b = mjs; export const c = type; import * as cjsi from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const d = cjsi; export const e = mjsi; export const f = typei; -==== index.cts (6 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const d = cjsi; export const e = mjsi; export const f = typei; -==== node_modules/inner/index.d.ts (4 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; ~~~ !!! error TS1036: Statements are not allowed in ambient contexts. mjs; type; export const cjsMain = true; -==== node_modules/inner/index.d.mts (4 errors) ==== +==== node_modules/inner/index.d.mts (1 errors) ==== // esm format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; ~~~ !!! error TS1036: Statements are not allowed in ambient contexts. mjs; type; export const esm = true; -==== node_modules/inner/index.d.cts (4 errors) ==== +==== node_modules/inner/index.d.cts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; ~~~ !!! error TS1036: Statements are not allowed in ambient contexts. diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js index fae2ab5dae7a8..58d736d2641fe 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js @@ -91,77 +91,122 @@ export const cjsNonmain = true; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -exports.a = cjs; -exports.b = mjs; -exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); -exports.d = cjsi; -exports.e = mjsi; -exports.f = typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -exports.a = cjs; -exports.b = mjs; -exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); -exports.d = cjsi; -exports.e = mjsi; -exports.f = typei; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); exports.a = cjs; exports.b = mjs; exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); exports.d = cjsi; exports.e = mjsi; exports.f = typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; -//// [index.d.ts] -export declare const a: any; -export declare const b: any; -export declare const c: any; -export declare const d: any; -export declare const e: any; -export declare const f: any; //// [index.d.mts] -export declare const a: any; -export declare const b: any; -export declare const c: any; -export declare const d: any; -export declare const e: any; -export declare const f: any; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export declare const a: typeof cjs; +export declare const b: typeof mjs; +export declare const c: typeof type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export declare const d: typeof cjsi; +export declare const e: typeof mjsi; +export declare const f: typeof typei; //// [index.d.cts] -export declare const a: any; -export declare const b: any; -export declare const c: any; -export declare const d: any; -export declare const e: any; -export declare const f: any; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export declare const a: typeof cjs; +export declare const b: typeof mjs; +export declare const c: typeof type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export declare const d: typeof cjsi; +export declare const e: typeof mjsi; +export declare const f: typeof typei; +//// [index.d.ts] +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export declare const a: typeof cjs; +export declare const b: typeof mjs; +export declare const c: typeof type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export declare const d: typeof cjsi; +export declare const e: typeof mjsi; +export declare const f: typeof typei; diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols index 2c1139d74c80b..93d7af061919a 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).symbols @@ -12,15 +12,15 @@ import * as type from "package"; >type : Symbol(type, Decl(index.ts, 3, 6)) export const a = cjs; ->a : Symbol(a, Decl(index.ts, 4, 12)) +>a : Symbol(type.a, Decl(index.ts, 4, 12)) >cjs : Symbol(cjs, Decl(index.ts, 1, 6)) export const b = mjs; ->b : Symbol(b, Decl(index.ts, 5, 12)) +>b : Symbol(type.b, Decl(index.ts, 5, 12)) >mjs : Symbol(mjs, Decl(index.ts, 2, 6)) export const c = type; ->c : Symbol(c, Decl(index.ts, 6, 12)) +>c : Symbol(type.c, Decl(index.ts, 6, 12)) >type : Symbol(type, Decl(index.ts, 3, 6)) import * as cjsi from "inner/cjs"; @@ -33,15 +33,15 @@ import * as typei from "inner"; >typei : Symbol(typei, Decl(index.ts, 9, 6)) export const d = cjsi; ->d : Symbol(d, Decl(index.ts, 10, 12)) +>d : Symbol(type.d, Decl(index.ts, 10, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) export const e = mjsi; ->e : Symbol(e, Decl(index.ts, 11, 12)) +>e : Symbol(type.e, Decl(index.ts, 11, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) export const f = typei; ->f : Symbol(f, Decl(index.ts, 12, 12)) +>f : Symbol(type.f, Decl(index.ts, 12, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) === index.mts === @@ -56,15 +56,15 @@ import * as type from "package"; >type : Symbol(type, Decl(index.mts, 3, 6)) export const a = cjs; ->a : Symbol(a, Decl(index.mts, 4, 12)) +>a : Symbol(mjs.a, Decl(index.mts, 4, 12)) >cjs : Symbol(cjs, Decl(index.mts, 1, 6)) export const b = mjs; ->b : Symbol(b, Decl(index.mts, 5, 12)) +>b : Symbol(mjs.b, Decl(index.mts, 5, 12)) >mjs : Symbol(mjs, Decl(index.mts, 2, 6)) export const c = type; ->c : Symbol(c, Decl(index.mts, 6, 12)) +>c : Symbol(mjs.c, Decl(index.mts, 6, 12)) >type : Symbol(type, Decl(index.mts, 3, 6)) import * as cjsi from "inner/cjs"; @@ -77,15 +77,15 @@ import * as typei from "inner"; >typei : Symbol(typei, Decl(index.mts, 9, 6)) export const d = cjsi; ->d : Symbol(d, Decl(index.mts, 10, 12)) +>d : Symbol(mjs.d, Decl(index.mts, 10, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) export const e = mjsi; ->e : Symbol(e, Decl(index.mts, 11, 12)) +>e : Symbol(mjs.e, Decl(index.mts, 11, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) export const f = typei; ->f : Symbol(f, Decl(index.mts, 12, 12)) +>f : Symbol(mjs.f, Decl(index.mts, 12, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) === index.cts === @@ -100,15 +100,15 @@ import * as type from "package"; >type : Symbol(type, Decl(index.cts, 3, 6)) export const a = cjs; ->a : Symbol(a, Decl(index.cts, 4, 12)) +>a : Symbol(cjs.a, Decl(index.cts, 4, 12)) >cjs : Symbol(cjs, Decl(index.cts, 1, 6)) export const b = mjs; ->b : Symbol(b, Decl(index.cts, 5, 12)) +>b : Symbol(cjs.b, Decl(index.cts, 5, 12)) >mjs : Symbol(mjs, Decl(index.cts, 2, 6)) export const c = type; ->c : Symbol(c, Decl(index.cts, 6, 12)) +>c : Symbol(cjs.c, Decl(index.cts, 6, 12)) >type : Symbol(type, Decl(index.cts, 3, 6)) import * as cjsi from "inner/cjs"; @@ -121,15 +121,15 @@ import * as typei from "inner"; >typei : Symbol(typei, Decl(index.cts, 9, 6)) export const d = cjsi; ->d : Symbol(d, Decl(index.cts, 10, 12)) +>d : Symbol(cjs.d, Decl(index.cts, 10, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) export const e = mjsi; ->e : Symbol(e, Decl(index.cts, 11, 12)) +>e : Symbol(cjs.e, Decl(index.cts, 11, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) export const f = typei; ->f : Symbol(f, Decl(index.cts, 12, 12)) +>f : Symbol(cjs.f, Decl(index.cts, 12, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) === node_modules/inner/index.d.ts === @@ -153,7 +153,7 @@ type; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export const cjsMain = true; ->cjsMain : Symbol(cjsMain, Decl(index.d.ts, 7, 12)) +>cjsMain : Symbol(type.cjsMain, Decl(index.d.ts, 7, 12)) === node_modules/inner/index.d.mts === // esm format file @@ -176,7 +176,7 @@ type; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export const esm = true; ->esm : Symbol(esm, Decl(index.d.mts, 7, 12)) +>esm : Symbol(mjs.esm, Decl(index.d.mts, 7, 12)) === node_modules/inner/index.d.cts === // cjs format file @@ -199,5 +199,5 @@ type; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export const cjsNonmain = true; ->cjsNonmain : Symbol(cjsNonmain, Decl(index.d.cts, 7, 12)) +>cjsNonmain : Symbol(cjs.cjsNonmain, Decl(index.d.cts, 7, 12)) diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types index 25b24bedba1be..9921b0e1f5183 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).types @@ -3,214 +3,214 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ export const a = cjs; ->a : any -> : ^^^ ->cjs : any -> : ^^^ +>a : typeof cjs +> : ^^^^^^^^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export const b = mjs; ->b : any -> : ^^^ ->mjs : any -> : ^^^ +>b : typeof mjs +> : ^^^^^^^^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export const c = type; ->c : any -> : ^^^ ->type : any -> : ^^^ +>c : typeof type +> : ^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ export const d = cjsi; ->d : any -> : ^^^ ->cjsi : any -> : ^^^ +>d : typeof cjsi +> : ^^^^^^^^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ export const e = mjsi; ->e : any -> : ^^^ ->mjsi : any -> : ^^^ +>e : typeof mjsi +> : ^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ export const f = typei; ->f : any -> : ^^^ ->typei : any -> : ^^^ +>f : typeof typei +> : ^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ export const a = cjs; ->a : any -> : ^^^ ->cjs : any -> : ^^^ +>a : typeof cjs +> : ^^^^^^^^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export const b = mjs; ->b : any -> : ^^^ ->mjs : any -> : ^^^ +>b : typeof mjs +> : ^^^^^^^^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export const c = type; ->c : any -> : ^^^ ->type : any -> : ^^^ +>c : typeof type +> : ^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ export const d = cjsi; ->d : any -> : ^^^ ->cjsi : any -> : ^^^ +>d : typeof cjsi +> : ^^^^^^^^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ export const e = mjsi; ->e : any -> : ^^^ ->mjsi : any -> : ^^^ +>e : typeof mjsi +> : ^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ export const f = typei; ->f : any -> : ^^^ ->typei : any -> : ^^^ +>f : typeof typei +> : ^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ export const a = cjs; ->a : any -> : ^^^ ->cjs : any -> : ^^^ +>a : typeof cjs +> : ^^^^^^^^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export const b = mjs; ->b : any -> : ^^^ ->mjs : any -> : ^^^ +>b : typeof mjs +> : ^^^^^^^^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export const c = type; ->c : any -> : ^^^ ->type : any -> : ^^^ +>c : typeof type +> : ^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ export const d = cjsi; ->d : any -> : ^^^ ->cjsi : any -> : ^^^ +>d : typeof cjsi +> : ^^^^^^^^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ export const e = mjsi; ->e : any -> : ^^^ ->mjsi : any -> : ^^^ +>e : typeof mjsi +> : ^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ export const f = typei; ->f : any -> : ^^^ ->typei : any -> : ^^^ +>f : typeof typei +> : ^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ export const cjsMain = true; >cjsMain : true @@ -221,28 +221,28 @@ export const cjsMain = true; === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ export const esm = true; >esm : true @@ -253,28 +253,28 @@ export const esm = true; === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ export const cjsNonmain = true; >cjsNonmain : true diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt deleted file mode 100644 index f86859a1c6931..0000000000000 --- a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - } -==== index.ts (0 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - } -==== 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/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js index bf08c0a12b4ee..378a054d25109 100644 --- a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js @@ -32,11 +32,8 @@ async function main() { const { readFile } = await import("fs"); } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; // esm format file -async function main() { +export async function main() { const { readFile } = await import("fs"); } diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types index 3e896f6a93e0e..18249dadabb9c 100644 --- a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types @@ -10,7 +10,6 @@ export async function main() { >readFile : any > : ^^^ >await import("fs") : any -> : ^^^ >import("fs") : Promise > : ^^^^^^^^^^^^ >"fs" : "fs" @@ -26,7 +25,6 @@ export async function main() { >readFile : any > : ^^^ >await import("fs") : any -> : ^^^ >import("fs") : Promise > : ^^^^^^^^^^^^ >"fs" : "fs" @@ -35,5 +33,4 @@ export async function main() { === types.d.ts === declare module "fs"; >"fs" : any -> : ^^^ diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt index 31618d3c6664b..edb49c7a61f05 100644 --- a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt @@ -1,15 +1,10 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. 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(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (1 errors) ==== +==== subfolder/index.ts (0 errors) ==== // cjs 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.ts (1 errors) ==== // esm format file const a = {}; diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js index 9154d21a05c18..2d09438ae7cd8 100644 --- a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js @@ -25,10 +25,9 @@ export = a; const a = {}; module.exports = a; //// [index.js] -"use strict"; // esm format file const a = {}; -module.exports = a; +export {}; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt index 5cd14e9edd0a0..7e86097227b3b 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -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,32): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); - ~~~~~ -!!! 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 TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js index f558b624beffd..da6fe0fc80095 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js @@ -27,11 +27,4 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); - - -//// [index.d.ts] -export declare const a: any; +export const a = (await import("inner")).x(); diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols index 75e2efd7ffcf9..91fce59692fb1 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols @@ -7,6 +7,9 @@ import { Thing } from "inner/other"; export const a = (await import("inner")).x(); >a : Symbol(a, Decl(index.ts, 2, 12)) +>(await import("inner")).x : Symbol(x, Decl(index.d.ts, 1, 8)) +>"inner" : Symbol("node_modules/inner/index", Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(index.d.ts, 1, 8)) === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types index 98230aff8c096..dc944e2b96ae6 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).types @@ -7,22 +7,22 @@ import { Thing } from "inner/other"; > : ^^^ export const a = (await import("inner")).x(); ->a : any -> : ^^^ ->(await import("inner")).x() : any -> : ^^^ ->(await import("inner")).x : any -> : ^^^ ->(await import("inner")) : any -> : ^^^ ->await import("inner") : any -> : ^^^ ->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/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import("inner") : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("inner") : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"inner" : "inner" > : ^^^^^^^ ->x : any -> : ^^^ +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt index ce7aeb8c680f6..a0ed330173ed8 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt @@ -1,22 +1,16 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? The file is in the program because: Root file specified for compilation -/main.cts(1,16): error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.cts(2,16): error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.cts(3,16): error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.cts(4,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.cts(5,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.cts(6,16): error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(1,16): error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(2,16): error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(3,16): error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(4,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(5,16): error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(6,16): error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. + If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';` +/main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. +/main.cts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. +/main.mts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. + There are types at '/node_modules/exports-and-types-versions/types/foo.d.ts', but this result could not be resolved when respecting package.json "exports". The 'exports-and-types-versions' library may need to update its package.json or typings. +/main.mts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. +/main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. !!! error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? !!! error TS6504: The file is in the program because: !!! error TS6504: Root file specified for compilation @@ -66,43 +60,33 @@ error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a J ==== /node_modules/just-types-versions/types/foo.d.ts (0 errors) ==== export {}; -==== /main.cts (6 errors) ==== +==== /main.cts (3 errors) ==== import {} from "exports-and-types-versions/foo"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. +!!! error TS7016: If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';` import {} from "exports-and-types-versions/nope"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. import {} from "exports-and-types-versions/yep"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import {} from "exports-and-types-versions/versioned-yep"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import {} from "exports-and-types-versions/versioned-nah"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. import {} from "just-types-versions/foo"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -==== /main.mts (6 errors) ==== +==== /main.mts (3 errors) ==== import {} from "exports-and-types-versions/foo"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. +!!! error TS7016: There are types at '/node_modules/exports-and-types-versions/types/foo.d.ts', but this result could not be resolved when respecting package.json "exports". The 'exports-and-types-versions' library may need to update its package.json or typings. import {} from "exports-and-types-versions/nope"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/nope'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. import {} from "exports-and-types-versions/yep"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import {} from "exports-and-types-versions/versioned-yep"; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-yep'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import {} from "exports-and-types-versions/versioned-nah"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'exports-and-types-versions/versioned-nah'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. import {} from "just-types-versions/foo"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'just-types-versions/foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js index f7796d030e151..396ca2dfc4bcc 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js @@ -67,5 +67,4 @@ import {} from "just-types-versions/foo"; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //// [main.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json index 50a86bfd3e992..b75c764ff9c7c 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json @@ -4,53 +4,211 @@ "File '/node_modules/just-types-versions/types/package.json' does not exist.", "Found 'package.json' at '/node_modules/just-types-versions/package.json'.", "======== Resolving module 'exports-and-types-versions/foo' from '/main.cts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/package.json' does not exist.", + "Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './foo' with target './dist/foo.js'.", + "File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.", + "File '/node_modules/exports-and-types-versions/dist/foo.ts' does not exist.", + "File '/node_modules/exports-and-types-versions/dist/foo.tsx' does not exist.", + "File '/node_modules/exports-and-types-versions/dist/foo.d.ts' does not exist.", + "Export specifier './foo' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", - "======== Module name 'exports-and-types-versions/foo' was not resolved. ========", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './foo' with target './dist/foo.js'.", + "File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.", + "File '/node_modules/exports-and-types-versions/dist/foo.js' exists - use it as a name resolution result.", + "'package.json' does not have a 'peerDependencies' field.", + "Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.", + "======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ========", "======== Resolving module 'exports-and-types-versions/nope' from '/main.cts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "======== Module name 'exports-and-types-versions/nope' was not resolved. ========", "======== Resolving module 'exports-and-types-versions/yep' from '/main.cts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", - "======== Module name 'exports-and-types-versions/yep' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Matched 'exports' condition 'types'.", + "Using 'exports' subpath './yep' with target './types/foo.d.ts'.", + "File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'types'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.", + "======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========", "======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.cts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", - "======== Module name 'exports-and-types-versions/versioned-yep' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Matched 'exports' condition 'types@>=4'.", + "Using 'exports' subpath './versioned-yep' with target './types/foo.d.ts'.", + "File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'types@>=4'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.", + "======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========", "======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.cts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Saw non-matching condition 'types@<4'.", + "Exiting conditional exports.", + "Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Saw non-matching condition 'types@<4'.", + "Exiting conditional exports.", + "Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========", "======== Resolving module 'just-types-versions/foo' from '/main.cts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", - "======== Module name 'just-types-versions/foo' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'just-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/just-types-versions/package.json' exists according to earlier cached lookups.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.", + "Module name 'foo', matched pattern 'foo'.", + "Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.", + "File '/node_modules/just-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'.", + "======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ========", "======== Resolving module 'exports-and-types-versions/foo' from '/main.mts'. ========", - "Resolution for module 'exports-and-types-versions/foo' was found in cache from location '/'.", - "======== Module name 'exports-and-types-versions/foo' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './foo' with target './dist/foo.js'.", + "File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.", + "File '/node_modules/exports-and-types-versions/dist/foo.ts' does not exist.", + "File '/node_modules/exports-and-types-versions/dist/foo.tsx' does not exist.", + "File '/node_modules/exports-and-types-versions/dist/foo.d.ts' does not exist.", + "Export specifier './foo' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './foo' with target './dist/foo.js'.", + "File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.", + "File '/node_modules/exports-and-types-versions/dist/foo.js' exists - use it as a name resolution result.", + "Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.", + "Module name 'foo', matched pattern 'foo'.", + "Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.", + "File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.", + "======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ========", "======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ========", - "Resolution for module 'exports-and-types-versions/nope' was found in cache from location '/'.", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "======== Module name 'exports-and-types-versions/nope' was not resolved. ========", "======== Resolving module 'exports-and-types-versions/yep' from '/main.mts'. ========", - "Resolution for module 'exports-and-types-versions/yep' was found in cache from location '/'.", - "======== Module name 'exports-and-types-versions/yep' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Matched 'exports' condition 'types'.", + "Using 'exports' subpath './yep' with target './types/foo.d.ts'.", + "File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'types'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.", + "======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========", "======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.mts'. ========", - "Resolution for module 'exports-and-types-versions/versioned-yep' was found in cache from location '/'.", - "======== Module name 'exports-and-types-versions/versioned-yep' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Matched 'exports' condition 'types@>=4'.", + "Using 'exports' subpath './versioned-yep' with target './types/foo.d.ts'.", + "File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'types@>=4'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.", + "======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========", "======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.mts'. ========", - "Resolution for module 'exports-and-types-versions/versioned-nah' was found in cache from location '/'.", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Saw non-matching condition 'types@<4'.", + "Exiting conditional exports.", + "Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Saw non-matching condition 'types@<4'.", + "Exiting conditional exports.", + "Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.", "======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========", "======== Resolving module 'just-types-versions/foo' from '/main.mts'. ========", - "Resolution for module 'just-types-versions/foo' was found in cache from location '/'.", - "======== Module name 'just-types-versions/foo' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'just-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/just-types-versions/package.json' exists according to earlier cached lookups.", + "'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.", + "Module name 'foo', matched pattern 'foo'.", + "Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.", + "File '/node_modules/just-types-versions/types/foo.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'.", + "======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ========", + "File '/.ts/package.json' does not exist.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -63,6 +221,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -75,6 +235,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -87,6 +249,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -99,6 +263,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -111,6 +277,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -123,6 +291,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -135,6 +305,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -147,6 +319,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -159,6 +333,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es5' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -171,6 +347,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -183,6 +361,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -195,6 +375,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -207,6 +389,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -219,6 +403,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -231,6 +417,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -243,6 +431,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -255,6 +445,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -267,6 +459,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -279,6 +473,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -291,6 +487,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -303,6 +501,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -315,6 +515,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/arraybuffer' from '/.src/__lib_node_modules_lookup_lib.es2017.arraybuffer.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -327,6 +529,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/arraybuffer' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -339,6 +543,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -351,6 +557,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -363,6 +571,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -375,6 +585,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -387,6 +599,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -399,6 +613,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -411,6 +627,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -423,6 +641,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -435,6 +655,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -447,6 +669,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -459,6 +683,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -471,6 +697,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -483,6 +711,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -495,6 +725,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -507,6 +739,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -519,6 +753,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -531,6 +767,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -543,6 +781,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -555,6 +795,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -567,6 +809,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -579,6 +823,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -591,6 +837,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -603,6 +851,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -615,6 +865,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -627,6 +879,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -639,6 +893,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -651,6 +907,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -663,6 +921,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -675,6 +935,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -687,6 +949,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -699,6 +963,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -711,6 +977,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -723,6 +991,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -735,6 +1005,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -747,6 +1019,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-dom' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -759,6 +1033,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -771,6 +1047,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -783,6 +1061,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -794,5 +1074,7 @@ "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt index 3f951c05a6887..358a0e61437a1 100644 --- a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt @@ -1,24 +1,16 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -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,32): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); - ~~~~~ -!!! 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 TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== node_modules/inner/index.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js index 62adf646cdc89..b6f1adda8d33c 100644 --- a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js @@ -27,27 +27,15 @@ export const x: () => Thing = null as any; "exports": "./index.ts" } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); //// [other.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -exports.x = null; +export const x = null; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file -var other_js_1 = require("./other.js"); -Object.defineProperty(exports, "x", { enumerable: true, get: function () { return other_js_1.x; } }); +export { x } from "./other.js"; +//// [index.js] +export const a = (await import("inner")).x(); -//// [index.d.ts] -export declare const a: any; //// [other.d.ts] export interface Thing { } diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols index b504d78ebc50e..182723309687c 100644 --- a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols @@ -7,8 +7,12 @@ import { Thing } from "inner/other"; export const a = (await import("inner")).x(); >a : Symbol(a, Decl(index.ts, 2, 12)) +>(await import("inner")).x : Symbol(x, Decl(index.ts, 1, 8)) +>"inner" : Symbol("node_modules/inner/index", Decl(index.ts, 0, 0)) +>x : Symbol(x, Decl(index.ts, 1, 8)) import {a as a2} from "package"; +>a : Symbol(a, Decl(index.ts, 2, 12)) >a2 : Symbol(a2, Decl(index.ts, 3, 8)) === node_modules/inner/index.ts === diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types index b61b7853174c4..880b84aad2d77 100644 --- a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).types @@ -7,28 +7,28 @@ import { Thing } from "inner/other"; > : ^^^ export const a = (await import("inner")).x(); ->a : any -> : ^^^ ->(await import("inner")).x() : any -> : ^^^ ->(await import("inner")).x : any -> : ^^^ ->(await import("inner")) : any -> : ^^^ ->await import("inner") : any -> : ^^^ ->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/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import("inner") : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("inner") : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"inner" : "inner" > : ^^^^^^^ ->x : any -> : ^^^ +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ import {a as a2} from "package"; ->a : any -> : ^^^ ->a2 : any -> : ^^^ +>a : import("node_modules/inner/other").Thing +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>a2 : import("node_modules/inner/other").Thing +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt index 7bec6ced03161..08ce05322d3bc 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt @@ -1,20 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(2,23): error TS2792: Cannot find module 'inner/other.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -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,32): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other.js"; // should fail ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/other.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); - ~~~~~ -!!! 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 TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js index bf2286847a188..5db58ae2f7bfa 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js @@ -34,11 +34,8 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [index.d.ts] -export declare const a: any; +export declare const a: import("inner/other").Thing; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols index c874e53a47a24..d429eab9b497f 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols @@ -7,6 +7,9 @@ import { Thing } from "inner/other.js"; // should fail export const a = (await import("inner")).x(); >a : Symbol(a, Decl(index.ts, 2, 12)) +>(await import("inner")).x : Symbol(x, Decl(index.d.ts, 1, 8)) +>"inner" : Symbol("node_modules/inner/index", Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(index.d.ts, 1, 8)) === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types index 89388ff0accb3..d62dfd1155d03 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).types @@ -7,22 +7,22 @@ import { Thing } from "inner/other.js"; // should fail > : ^^^ export const a = (await import("inner")).x(); ->a : any -> : ^^^ ->(await import("inner")).x() : any -> : ^^^ ->(await import("inner")).x : any -> : ^^^ ->(await import("inner")) : any -> : ^^^ ->await import("inner") : any -> : ^^^ ->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/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import("inner") : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("inner") : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"inner" : "inner" > : ^^^^^^^ ->x : any -> : ^^^ +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt index 8408257a3cfd9..f7015dbf604c1 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt @@ -1,20 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -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,32): error TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); - ~~~~~ -!!! 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 TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js index df37c54ae36de..c0d6b006b33cf 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js @@ -29,11 +29,8 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner/index.js")).x(); +export const a = (await import("inner/index.js")).x(); //// [index.d.ts] -export declare const a: any; +export declare const a: import("inner/other.js").Thing; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols index 8473640f2b0bd..6fd6d1a29cedd 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols @@ -7,6 +7,9 @@ import { Thing } from "inner/other"; export const a = (await import("inner/index.js")).x(); >a : Symbol(a, Decl(index.ts, 2, 12)) +>(await import("inner/index.js")).x : Symbol(x, Decl(index.d.ts, 1, 8)) +>"inner/index.js" : Symbol("node_modules/inner/index", Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(index.d.ts, 1, 8)) === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types index 417344f0b9857..034994f0ff8bb 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).types @@ -7,22 +7,22 @@ import { Thing } from "inner/other"; > : ^^^ export const a = (await import("inner/index.js")).x(); ->a : any -> : ^^^ ->(await import("inner/index.js")).x() : any -> : ^^^ ->(await import("inner/index.js")).x : any -> : ^^^ ->(await import("inner/index.js")) : any -> : ^^^ ->await import("inner/index.js") : any -> : ^^^ ->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")) : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import("inner/index.js") : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("inner/index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"inner/index.js" : "inner/index.js" > : ^^^^^^^^^^^^^^^^ ->x : any -> : ^^^ +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt index 79c2c8a224d51..002881ca1c0e7 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt @@ -1,20 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(2,23): error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -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,32): error TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/other'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); - ~~~~~ -!!! 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 TS2792: Cannot find module 'inner/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js index 7f44af7646402..dcdd62bed698d 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js @@ -29,11 +29,8 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner/index.js")).x(); +export const a = (await import("inner/index.js")).x(); //// [index.d.ts] -export declare const a: any; +export declare const a: import("inner/other.js").Thing; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols index 0e7bf123351dd..7429733b3c4f6 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols @@ -7,6 +7,9 @@ import { Thing } from "inner/other"; export const a = (await import("inner/index.js")).x(); >a : Symbol(a, Decl(index.ts, 2, 12)) +>(await import("inner/index.js")).x : Symbol(x, Decl(index.d.ts, 1, 8)) +>"inner/index.js" : Symbol("node_modules/inner/index", Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(index.d.ts, 1, 8)) === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types index 5588e878db70c..78367ad6e9714 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).types @@ -7,22 +7,22 @@ import { Thing } from "inner/other"; > : ^^^ export const a = (await import("inner/index.js")).x(); ->a : any -> : ^^^ ->(await import("inner/index.js")).x() : any -> : ^^^ ->(await import("inner/index.js")).x : any -> : ^^^ ->(await import("inner/index.js")) : any -> : ^^^ ->await import("inner/index.js") : any -> : ^^^ ->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")) : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import("inner/index.js") : typeof import("node_modules/inner/index") +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("inner/index.js") : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"inner/index.js" : "inner/index.js" > : ^^^^^^^^^^^^^^^^ ->x : any -> : ^^^ +>x : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ === node_modules/inner/index.d.ts === // esm format file diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt index 59e005b0d5ece..e338028b93522 100644 --- a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. @@ -25,7 +24,6 @@ subfolder2/index.mts(2,20): error TS7059: This syntax is reserved in files with subfolder2/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = () => (void 0); diff --git a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js index 43e30cd2d231c..4cca6af5a58d7 100644 --- a/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js @@ -81,12 +81,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -102,26 +99,17 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -130,12 +118,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -144,12 +129,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt index ecc8bf326aafc..fe89fc2f3863b 100644 --- a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt @@ -1,13 +1,23 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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. +subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== +==== subfolder/index.ts (4 errors) ==== // cjs 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 {} + ~~~~~~ +!!! 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) ==== // esm format file diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js index d399ccc45b2db..3b196cd32c98b 100644 --- a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js @@ -39,18 +39,13 @@ class Object { exports.Object = Object; exports.__esModule = false; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Object = exports.exports = exports.__esModule = void 0; -exports.require = require; // esm format file function require() { } const exports = {}; -exports.exports = exports; class Object { } -exports.Object = Object; -exports.__esModule = false; +export const __esModule = false; +export { require, exports, Object }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt index 77ffcab23e63a..b1d54f8e2145b 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt @@ -1,22 +1,10 @@ -error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag -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. -!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~ -!!! 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. -==== otherc.cts (2 errors) ==== +==== otherc.cts (1 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. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js index e8d43f0ad3e91..091166d523cd1 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js @@ -13,8 +13,7 @@ const json2 = import("./package.json", { assert: { type: "json" } }); // should } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types index a6cd7496f4a01..9780c35bba0cc 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types @@ -2,15 +2,15 @@ === index.ts === import json from "./package.json" assert { type: "json" }; ->json : any -> : ^^^ +>json : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === otherc.cts === import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ->json : any -> : ^^^ +>json : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt deleted file mode 100644 index 46e611660c7d4..0000000000000 --- a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== index.ts (0 errors) ==== - // esm format file - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== file.ts (0 errors) ==== - // esm format file - const __require = null; - const _createRequire = null; - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== 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/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js index 4a8f44fd00b87..c73ff1177a58e 100644 --- a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js @@ -38,21 +38,23 @@ const fs = require("fs"); fs.readFile; exports.fs2 = require("fs"); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const fs = require("fs"); +const fs = __require("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require("fs"); +export { fs2 }; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire_1 } from "module"; +const __require_1 = _createRequire_1(import.meta.url); // esm format file const __require = null; const _createRequire = null; -const fs = require("fs"); +const fs = __require_1("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require_1("fs"); +export { fs2 }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types index 029cf6d415bed..f73668aaa7a8f 100644 --- a/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types @@ -8,7 +8,6 @@ import fs = require("fs"); fs.readFile; >fs.readFile : any -> : ^^^ >fs : any > : ^^^ >readFile : any @@ -26,7 +25,6 @@ import fs = require("fs"); fs.readFile; >fs.readFile : any -> : ^^^ >fs : any > : ^^^ >readFile : any @@ -40,11 +38,9 @@ export import fs2 = require("fs"); // esm format file const __require = null; >__require : any -> : ^^^ const _createRequire = null; >_createRequire : any -> : ^^^ import fs = require("fs"); >fs : any @@ -52,7 +48,6 @@ import fs = require("fs"); fs.readFile; >fs.readFile : any -> : ^^^ >fs : any > : ^^^ >readFile : any @@ -65,5 +60,4 @@ export import fs2 = require("fs"); === types.d.ts === declare module "fs"; >"fs" : any -> : ^^^ diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt index 02fb2e9fd2c2c..8f85517984cb6 100644 --- a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt @@ -1,22 +1,10 @@ -error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.ts(1,8): error TS1259: Module '"package"' can only be default-imported using the 'allowSyntheticDefaultImports' flag -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. -!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; - ~~~~ -!!! 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. -==== otherc.cts (2 errors) ==== +==== otherc.cts (1 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. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js index 9653caaf24529..fb3984fd32c68 100644 --- a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js @@ -14,8 +14,7 @@ const json2 = import("./package.json", { with: { type: "json" } }); // should be //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types index a0e3595e7e20f..6f07805d83b53 100644 --- a/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).types @@ -2,15 +2,15 @@ === index.ts === import json from "./package.json" with { type: "json" }; ->json : any -> : ^^^ +>json : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === otherc.cts === import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ->json : any -> : ^^^ +>json : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt index e911db19854b7..bf4698ad28e95 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt @@ -1,43 +1,26 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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 TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (8 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols index b357f147d0ee5..b2c93c67d55e4 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols @@ -13,6 +13,7 @@ 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" }; @@ -29,3 +30,11 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types index be8fc085f344a..107dc1327d766 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types @@ -2,12 +2,12 @@ === /index.ts === import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -26,10 +26,16 @@ import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "impor export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt index d3661fe11f6cf..5c93150f88f13 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt @@ -1,43 +1,26 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (8 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! 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" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js index 69c5d82a5505a..afe399f85b0ad 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js @@ -33,8 +33,7 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols index 5c9e6a993205d..d76777ff60b36 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols @@ -16,6 +16,7 @@ import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "requ >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 {} @@ -29,3 +30,11 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types index e42317e6535f5..79bd80a1c7f46 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types @@ -2,12 +2,12 @@ === /index.ts === import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -26,10 +26,16 @@ import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "impor export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt index 20c6846fdafc9..c45ca1322b3a8 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt @@ -1,35 +1,27 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(2,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(2,45): error TS2857: Import attributes cannot be used with type-only imports or exports. +/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,33): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(4,39): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(6,70): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,76): error TS1454: `resolution-mode` can only be set for type-only imports. +/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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (7 errors) ==== +==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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 TS1453: `resolution-mode` should be either `require` or `import`. // not type-only import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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 LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols index 3783b14c2c0ba..33a5f17944412 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols @@ -11,7 +11,9 @@ import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -22,3 +24,7 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types index d2b4d085b2124..d432212769fe8 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types @@ -3,8 +3,8 @@ === /index.ts === // incorrect mode import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ // not type-only import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; @@ -27,3 +27,6 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt deleted file mode 100644 index e35f7c579f05d..0000000000000 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - -==== /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/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols index 389f152423bba..1f0e1652f5505 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols @@ -5,11 +5,24 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types index c2151818ca3b0..1c9297e238011 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types @@ -2,29 +2,33 @@ === /index.ts === export type LocalInterface = ->LocalInterface : any -> : ^^^ +>LocalInterface : 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); ->a : any -> : ^^^ ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any -> : ^^^ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); ->b : any -> : ^^^ ->(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any -> : ^^^ ->null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any -> : ^^^ +>b : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any -> : ^^^ +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt index 27e68167e1f1f..2d2f2c5b8ffbb 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt @@ -1,21 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/other.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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. /other.ts(3,50): error TS1128: Declaration or statement expected. /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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. -/other.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/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. /other.ts(6,77): error TS1128: Declaration or statement expected. @@ -24,7 +18,7 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci /other.ts(6,80): error TS1434: Unexpected keyword or identifier. /other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. /other.ts(6,96): error TS1128: Declaration or statement expected. -/other.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(7,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(7,49): error TS1005: 'with' expected. /other.ts(7,66): error TS1005: ';' expected. /other.ts(7,76): error TS1128: Declaration or statement expected. @@ -33,61 +27,54 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. -/other2.ts(4,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. -/other2.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. -/other2.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. -/other3.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other3.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')'? /other3.ts(3,21): error TS1005: '{' expected. /other3.ts(3,23): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. /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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. -/other3.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/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. /other3.ts(6,100): error TS1005: ',' expected. -/other3.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(7,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(7,48): error TS1005: '{' expected. /other3.ts(7,50): error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. /other3.ts(7,98): error TS1005: ',' expected. -/other4.ts(6,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(6,7): 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(6,21): error TS1005: '{' expected. /other4.ts(6,21): error TS2448: Block-scoped variable 'Attribute1' used before its declaration. /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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. -/other4.ts(9,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/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. /other4.ts(9,59): error TS1134: Variable declaration expected. /other4.ts(9,76): error TS1005: ',' expected. -/other4.ts(10,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(10,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(10,48): error TS1005: '{' expected. /other4.ts(10,58): error TS1005: ',' expected. /other4.ts(10,59): error TS1134: Variable declaration expected. /other4.ts(10,75): error TS1005: ',' expected. -/other5.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. -/other5.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. -/other5.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. -/other5.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -103,32 +90,24 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (6 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~ !!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing with: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ !!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. @@ -143,16 +122,14 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ !!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. @@ -171,8 +148,8 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1128: Declaration or statement expected. export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ !!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. @@ -191,37 +168,33 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (8 errors) ==== +==== /other2.ts (6 errors) ==== // wrong attribute key export type LocalInterface = & import("pkg", { with: {"bad": "require"} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. & import("pkg", { with: {"bad": "import"} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + ~~~~~~~~~~~~~~~ +!!! 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 - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~ !!! error TS1005: '{' expected. !!! related TS1007 /other3.ts:3:21: The parser expected to find a '}' to match the '{' token here. @@ -234,16 +207,14 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~ !!! error TS1005: '{' expected. !!! related TS1007 /other3.ts:6:48: The parser expected to find a '}' to match the '{' token here. @@ -252,8 +223,8 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1005: ',' expected. export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~ !!! error TS1005: '{' expected. !!! related TS1007 /other3.ts:7:48: The parser expected to find a '}' to match the '{' token here. @@ -262,15 +233,15 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! 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"} }; export type LocalInterface = & import("pkg", Attribute1).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~ !!! error TS1005: '{' expected. !!! related TS1007 /other4.ts:6:21: The parser expected to find a '}' to match the '{' token here. @@ -285,17 +256,15 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci !!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", Attribute1).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~ !!! error TS1005: '{' expected. !!! related TS1007 /other4.ts:9:48: The parser expected to find a '}' to match the '{' token here. @@ -306,8 +275,8 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1005: ',' expected. export const b = (null as any as import("pkg", Attribute2).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~ !!! error TS1005: '{' expected. !!! related TS1007 /other4.ts:10:48: The parser expected to find a '}' to match the '{' token here. @@ -318,26 +287,22 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1005: ',' expected. -==== /other5.ts (8 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { with: {} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. & import("pkg", { with: {} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. export const b = (null as any as import("pkg", { with: {} }).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ -!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. \ No newline at end of file +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols index e2d5fe2f4b60a..8a23a85dd4673 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols @@ -13,13 +13,18 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) === /other.ts === // missing with: @@ -28,6 +33,7 @@ export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) >"resolution-mode" : Symbol("resolution-mode", Decl(other.ts, 3, 21)) export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); @@ -42,10 +48,13 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(other2.ts, 0, 0)) & import("pkg", { with: {"bad": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { with: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); >a : Symbol(a, Decl(other2.ts, 5, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); >b : Symbol(b, Decl(other2.ts, 6, 12)) @@ -59,6 +68,7 @@ export type LocalInterface = >"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 2, 23)) & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) >"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 3, 23)) export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); @@ -89,6 +99,7 @@ export type LocalInterface = >RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) & import("pkg", Attribute2).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) >Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) export const a = (null as any as import("pkg", Attribute1).RequireInterface); @@ -106,10 +117,13 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(other5.ts, 0, 0)) & import("pkg", { with: {} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { with: {} }).ImportInterface; export const a = (null as any as import("pkg", { with: {} }).RequireInterface); >a : Symbol(a, Decl(other5.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { with: {} }).ImportInterface); >b : Symbol(b, Decl(other5.ts, 5, 12)) diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types index 99d04a1deec8a..c1e5b7e23e6a1 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types @@ -10,29 +10,29 @@ export interface RequireInterface {} === /index.ts === export type LocalInterface = ->LocalInterface : any -> : ^^^ +>LocalInterface : LocalInterface +> : ^^^^^^^^^^^^^^ & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); ->a : any -> : ^^^ ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); ->b : any -> : ^^^ ->(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any -> : ^^^ ->null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any -> : ^^^ +>b : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ @@ -55,8 +55,8 @@ export type LocalInterface = & import("pkg", {"resolution-mode": "import"}).ImportInterface; >import("pkg", {"resolution-mode": "import"}).ImportInterface : any > : ^^^ ->import("pkg", {"resolution-mode": "import"}) : Promise -> : ^^^^^^^^^^^^ +>import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"pkg" : "pkg" > : ^^^^^ >{"resolution-mode": "import"} : { "resolution-mode": string; } @@ -110,12 +110,12 @@ export type LocalInterface = & import("pkg", { with: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); ->a : any -> : ^^^ ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ @@ -146,8 +146,8 @@ export type LocalInterface = & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; >import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any > : ^^^ ->import("pkg", [ {"resolution-mode": "import"} ]) : Promise -> : ^^^^^^^^^^^^ +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"pkg" : "pkg" > : ^^^^^ >[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] @@ -226,8 +226,8 @@ export type LocalInterface = & import("pkg", Attribute2).ImportInterface; >import("pkg", Attribute2).ImportInterface : any > : ^^^ ->import("pkg", Attribute2) : Promise -> : ^^^^^^^^^^^^ +>import("pkg", Attribute2) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"pkg" : "pkg" > : ^^^^^ >Attribute2 : any @@ -272,12 +272,12 @@ export type LocalInterface = & import("pkg", { with: {} }).ImportInterface; export const a = (null as any as import("pkg", { with: {} }).RequireInterface); ->a : any -> : ^^^ ->(null as any as import("pkg", { with: {} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { with: {} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { with: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { with: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt index 5ea35cf935593..05c2a81067dde 100644 --- a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt @@ -1,12 +1,16 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +subfolder/index.ts(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +subfolder/index.ts(4,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== +==== subfolder/index.ts (2 errors) ==== // cjs format file import {default as _fs} from "fs"; + ~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. _fs.readFile; import * as fs from "fs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. fs.readFile; ==== index.ts (0 errors) ==== // esm format file diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js index aab681b9dbd4f..4712d65a0999e 100644 --- a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js @@ -32,18 +32,17 @@ declare module "tslib" { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); // cjs format file -const fs_1 = require("fs"); +const fs_1 = tslib_1.__importDefault(require("fs")); fs_1.default.readFile; -const fs = require("fs"); +const fs = tslib_1.__importStar(require("fs")); fs.readFile; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const fs_1 = require("fs"); -fs_1.default.readFile; -const fs = require("fs"); +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; fs.readFile; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt index 6802cc73a3be9..176b3d13fe10e 100644 --- a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt @@ -1,11 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +subfolder/index.ts(2,1): error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +subfolder/index.ts(3,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== +==== subfolder/index.ts (2 errors) ==== // cjs format file export * from "fs"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. export * as fs from "fs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. ==== index.ts (0 errors) ==== // esm format file export * from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js index 78bfd6a54971e..c058d00e216e0 100644 --- a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js @@ -27,46 +27,16 @@ declare module "tslib" { //// [index.js] "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.fs = void 0; +const tslib_1 = require("tslib"); // cjs format file -__exportStar(require("fs"), exports); -exports.fs = require("fs"); +tslib_1.__exportStar(require("fs"), exports); +exports.fs = tslib_1.__importStar(require("fs")); //// [index.js] -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; // esm format file -__exportStar(require("fs"), exports); -exports.fs = require("fs"); +export * from "fs"; +export * as fs from "fs"; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt index da8b48c67f2f3..a5f7cf4be1399 100644 --- a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt @@ -1,10 +1,11 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +subfolder/index.ts(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 errors) ==== +==== subfolder/index.ts (1 errors) ==== // cjs format file export {default} from "fs"; + ~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. ==== index.ts (0 errors) ==== // esm format file export {default} from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js index 0d3ac537e4d18..381f1b8ba964b 100644 --- a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js @@ -27,16 +27,13 @@ declare module "tslib" { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; +var tslib_1 = require("tslib"); // cjs format file var fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; // esm format file -var fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +export { default } from "fs"; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt index eea6769e776b3..dc4849ff5093c 100644 --- a/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -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(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== 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 (1 errors) ==== +==== index.ts (0 errors) ==== // esm 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}; ==== package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node18).js b/tests/baselines/reference/nodeModulesImportMeta(module=node18).js index a42ca0aa55d14..aa962a90bd346 100644 --- a/tests/baselines/reference/nodeModulesImportMeta(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).js @@ -27,12 +27,9 @@ exports.x = void 0; const x = import.meta.url; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = import.meta.url; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt index 3d8953693b202..e77140972a1ce 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@ -1,43 +1,26 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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 TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (8 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1454: `resolution-mode` can only be set for type-only imports. +!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1454: `resolution-mode` can only be set for type-only imports. +!!! 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" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols index 280c1d65ab17b..97a76656c4050 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols @@ -13,6 +13,7 @@ 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" }; @@ -29,3 +30,11 @@ export type { RequireInterface } from "pkg" assert { "resolution-mode": "require export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types index e2d366a3c018c..27ce52d60a048 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types @@ -2,12 +2,12 @@ === /index.ts === import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -26,10 +26,16 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt index 101346bd2f985..47c2ad040c0db 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt @@ -1,43 +1,26 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(2,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,44): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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,43): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(11,38): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (8 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! 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" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js index 7495778bd6fcb..fad19d466a6ac 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js @@ -33,8 +33,7 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols index d04d9cd473b9a..8d280aee6ffa1 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols @@ -16,6 +16,7 @@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "re >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 {} @@ -29,3 +30,11 @@ export type { RequireInterface } from "pkg" assert { "resolution-mode": "require export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types index 23b3151bb69bc..60e006fe4390a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types @@ -2,12 +2,12 @@ === /index.ts === import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -26,10 +26,16 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ->ImportInterface : any -> : ^^^ +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt index d9c883dc8faa2..e1be07261876a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,35 +1,27 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(2,39): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(2,45): error TS2822: Import assertions cannot be used with type-only imports or exports. +/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,33): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(4,39): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(6,70): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,76): error TS1454: `resolution-mode` can only be set for type-only imports. +/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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (7 errors) ==== +==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2822: Import assertions cannot be used with type-only imports or exports. +!!! 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 import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1454: `resolution-mode` can only be set for type-only imports. +!!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1454: `resolution-mode` can only be set for type-only imports. +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols index df997cc77a096..b209c65c177c1 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols @@ -11,7 +11,9 @@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -22,3 +24,7 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types index 6fee3dbb784b5..b9bc7c1552479 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types @@ -3,8 +3,8 @@ === /index.ts === // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ->RequireInterface : any -> : ^^^ +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ // not type-only import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; @@ -27,3 +27,6 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt deleted file mode 100644 index 86748c74923db..0000000000000 --- a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (1 errors) ==== - // esm format file - import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - type; -==== index.mts (1 errors) ==== - // esm format file - import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - type; -==== index.cts (1 errors) ==== - // esm format file - import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - type; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.cjs", - "imports": { - "#type": "package" - } - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js index 08d6ed09ccb49..a60b20a63d224 100644 --- a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js @@ -23,29 +23,58 @@ type; } } -//// [index.js] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +const type = __importStar(require("#type")); type; -//// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.js] // esm format file -const type = require("#type"); +import * as type from "#type"; type; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.mjs] // esm format file -const type = require("#type"); +import * as type from "#type"; type; +//// [index.d.cts] +export {}; //// [index.d.ts] export {}; //// [index.d.mts] export {}; -//// [index.d.cts] -export {}; diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types index 39ded55adfbea..594635bc9aee3 100644 --- a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).types @@ -3,30 +3,30 @@ === index.ts === // esm format file import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ === index.mts === // esm format file import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ === index.cts === // esm format file import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt index 3658a2f0d757f..01d8a2fd08354 100644 --- a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt @@ -1,27 +1,25 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +index.cts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. +index.mts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. +index.ts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== index.ts (1 errors) ==== // esm format file import * as type from "#type"; ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module '#type' or its corresponding type declarations. type; ==== index.mts (1 errors) ==== // esm format file import * as type from "#type"; ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module '#type' or its corresponding type declarations. type; ==== index.cts (1 errors) ==== // esm format file import * as type from "#type"; ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module '#type' or its corresponding type declarations. type; ==== package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js index 4d9239ee4390b..fa6401e1a49a4 100644 --- a/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js @@ -24,22 +24,51 @@ type; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +const type = __importStar(require("#type")); type; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt deleted file mode 100644 index eec31746ec2d6..0000000000000 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - -==== /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/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js index 100de5460ac25..6c0a3531fac79 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js @@ -32,5 +32,5 @@ 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: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols index 143e2ac662bcb..7558565243724 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols @@ -5,11 +5,24 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types index 7c14534ec1f54..87c7913723785 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types @@ -2,29 +2,33 @@ === /index.ts === export type LocalInterface = ->LocalInterface : any -> : ^^^ +>LocalInterface : 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); ->a : any -> : ^^^ ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any -> : ^^^ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ->b : any -> : ^^^ ->(null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface) : any -> : ^^^ ->null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface : any -> : ^^^ +>b : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any -> : ^^^ +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt index d9b65e97a2fc9..5172f49a5c8cd 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,21 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/index.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/other.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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. /other.ts(3,50): error TS1128: Declaration or statement expected. /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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. -/other.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/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. /other.ts(6,77): error TS1128: Declaration or statement expected. @@ -24,7 +18,7 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci /other.ts(6,80): error TS1434: Unexpected keyword or identifier. /other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. /other.ts(6,96): error TS1128: Declaration or statement expected. -/other.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other.ts(7,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(7,49): error TS1005: 'with' expected. /other.ts(7,66): error TS1005: ';' expected. /other.ts(7,76): error TS1128: Declaration or statement expected. @@ -33,61 +27,54 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other3.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other3.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')'? /other3.ts(3,21): error TS1005: '{' expected. /other3.ts(3,23): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. /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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. -/other3.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/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. /other3.ts(6,100): error TS1005: ',' expected. -/other3.ts(7,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other3.ts(7,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(7,48): error TS1005: '{' expected. /other3.ts(7,50): error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. /other3.ts(7,98): error TS1005: ',' expected. -/other4.ts(6,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(6,7): 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(6,21): error TS1005: '{' expected. /other4.ts(6,21): error TS2448: Block-scoped variable 'Asserts1' used before its declaration. /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,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. -/other4.ts(9,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/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. /other4.ts(9,57): error TS1134: Variable declaration expected. /other4.ts(9,74): error TS1005: ',' expected. -/other4.ts(10,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other4.ts(10,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(10,48): error TS1005: '{' expected. /other4.ts(10,56): error TS1005: ',' expected. /other4.ts(10,57): error TS1134: Variable declaration expected. /other4.ts(10,73): error TS1005: ',' expected. -/other5.ts(2,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,14): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(5,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,41): error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -101,31 +88,23 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (6 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~~~~ !!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ !!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. @@ -140,16 +119,14 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ !!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. @@ -168,8 +145,8 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1128: Declaration or statement expected. export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ !!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. @@ -187,36 +164,32 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci !!! error TS2304: Cannot find name 'ImportInterface'. ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (8 errors) ==== +==== /other2.ts (6 errors) ==== // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! 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'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~~~~ !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. -==== /other3.ts (17 errors) ==== + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~ !!! error TS1005: '{' expected. !!! related TS1007 /other3.ts:3:21: The parser expected to find a '}' to match the '{' token here. @@ -229,16 +202,14 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~ !!! error TS1005: '{' expected. !!! related TS1007 /other3.ts:6:48: The parser expected to find a '}' to match the '{' token here. @@ -247,8 +218,8 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1005: ',' expected. export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~ !!! error TS1005: '{' expected. !!! related TS1007 /other3.ts:7:48: The parser expected to find a '}' to match the '{' token here. @@ -256,15 +227,15 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci !!! 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"} }; export type LocalInterface = & import("pkg", Asserts1).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~ !!! error TS1005: '{' expected. !!! related TS1007 /other4.ts:6:21: The parser expected to find a '}' to match the '{' token here. @@ -279,17 +250,15 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci !!! 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 TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' 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'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", Asserts1).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~ !!! error TS1005: '{' expected. !!! related TS1007 /other4.ts:9:48: The parser expected to find a '}' to match the '{' token here. @@ -300,8 +269,8 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci ~ !!! error TS1005: ',' expected. export const b = (null as any as import("pkg", Asserts2).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~ !!! error TS1005: '{' expected. !!! related TS1007 /other4.ts:10:48: The parser expected to find a '}' to match the '{' token here. @@ -311,27 +280,23 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci !!! error TS1134: Variable declaration expected. ~ !!! error TS1005: ',' expected. -==== /other5.ts (8 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. & import("pkg", { assert: {} }).ImportInterface; - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~~~~~ -!!! error TS2792: Cannot find module 'pkg'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js index 7ed465ef0fbe6..813770edf9748 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js @@ -121,15 +121,15 @@ 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: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); export declare const a: import("pkg", { with: {} }); export declare const b: import("pkg", { with: {} }); //// [other2.d.ts] export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] export type LocalInterface = import("pkg", { with: {} })[{ @@ -143,5 +143,5 @@ export declare const a: import("pkg", { with: {} }), Asserts1: any, RequireInter export declare const b: import("pkg", { with: {} }), Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols index 257a13226618d..ea0f4216cd5c7 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols @@ -13,13 +13,18 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) === /other.ts === // missing assert: @@ -28,6 +33,7 @@ export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) >"resolution-mode" : Symbol("resolution-mode", Decl(other.ts, 3, 21)) export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); @@ -42,10 +48,13 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(other2.ts, 0, 0)) & import("pkg", { assert: {"bad": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); >a : Symbol(a, Decl(other2.ts, 5, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); >b : Symbol(b, Decl(other2.ts, 6, 12)) @@ -59,6 +68,7 @@ export type LocalInterface = >"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 2, 23)) & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) >"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 3, 23)) export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); @@ -89,6 +99,7 @@ export type LocalInterface = >RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 57)) & import("pkg", Asserts2).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) >Asserts2 : Symbol(Asserts2, Decl(other4.ts, 9, 46)) export const a = (null as any as import("pkg", Asserts1).RequireInterface); @@ -106,10 +117,13 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(other5.ts, 0, 0)) & import("pkg", { assert: {} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + & import("pkg", { assert: {} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); >a : Symbol(a, Decl(other5.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); >b : Symbol(b, Decl(other5.ts, 5, 12)) diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types index 4ea92fc9facbc..a38ebca6a3f1d 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types @@ -8,29 +8,29 @@ export interface ImportInterface {} export interface RequireInterface {} === /index.ts === export type LocalInterface = ->LocalInterface : any -> : ^^^ +>LocalInterface : LocalInterface +> : ^^^^^^^^^^^^^^ & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ->a : any -> : ^^^ ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ->b : any -> : ^^^ ->(null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface) : any -> : ^^^ ->null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface : any -> : ^^^ +>b : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ @@ -53,8 +53,8 @@ export type LocalInterface = & import("pkg", {"resolution-mode": "import"}).ImportInterface; >import("pkg", {"resolution-mode": "import"}).ImportInterface : any > : ^^^ ->import("pkg", {"resolution-mode": "import"}) : Promise -> : ^^^^^^^^^^^^ +>import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"pkg" : "pkg" > : ^^^^^ >{"resolution-mode": "import"} : { "resolution-mode": string; } @@ -108,12 +108,12 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); ->a : any -> : ^^^ ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ @@ -144,8 +144,8 @@ export type LocalInterface = & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; >import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any > : ^^^ ->import("pkg", [ {"resolution-mode": "import"} ]) : Promise -> : ^^^^^^^^^^^^ +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"pkg" : "pkg" > : ^^^^^ >[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] @@ -224,8 +224,8 @@ export type LocalInterface = & import("pkg", Asserts2).ImportInterface; >import("pkg", Asserts2).ImportInterface : any > : ^^^ ->import("pkg", Asserts2) : Promise -> : ^^^^^^^^^^^^ +>import("pkg", Asserts2) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"pkg" : "pkg" > : ^^^^^ >Asserts2 : any @@ -270,12 +270,12 @@ export type LocalInterface = & import("pkg", { assert: {} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); ->a : any -> : ^^^ ->(null as any as import("pkg", { assert: {} }).RequireInterface) : any -> : ^^^ ->null as any as import("pkg", { assert: {} }).RequireInterface : any -> : ^^^ +>a : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>null as any as import("pkg", { assert: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >null as any : any > : ^^^ diff --git a/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt b/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt index 3a3075f5a7bb1..033a1c9f7c87f 100644 --- a/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt @@ -1,19 +1,12 @@ -error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/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(1,22): error TS2792: Cannot find module 'not.json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(2,22): error TS2792: Cannot find module 'actually-json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -/main.mts(3,19): error TS2792: Cannot find module 'actually-json/typed'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +/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(8,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node18'. /main.mts(10,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. -!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== /node_modules/not.json/package.json (0 errors) ==== { "name": "not.json", @@ -48,16 +41,14 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci "version": 1 } -==== /main.mts (6 errors) ==== +==== /main.mts (5 errors) ==== import { oops } from "not.json"; // Ok - ~~~~~~~~~~ -!!! error TS2792: Cannot find module 'not.json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import moreOops from "actually-json"; // Error in nodenext ~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'actually-json'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. import typed from "actually-json/typed"; // Error in nodenext ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'actually-json/typed'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. import config from "./config.json" with { type: "json" }; // Ok import { default as config1 } from "./config.json" with { type: "json" }; // Ok @@ -73,17 +64,11 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci !!! error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. config3.default; // Ok -==== /loosey.cts (4 errors) ==== +==== /loosey.cts (2 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. 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/tests/baselines/reference/nodeModulesJson(module=node18).symbols b/tests/baselines/reference/nodeModulesJson(module=node18).symbols index 207490214fc88..42c68c640a2e7 100644 --- a/tests/baselines/reference/nodeModulesJson(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesJson(module=node18).symbols @@ -5,6 +5,10 @@ export function oops(json: string): any; >oops : Symbol(oops, Decl(index.d.ts, 0, 0)) >json : Symbol(json, Decl(index.d.ts, 0, 21)) +=== /node_modules/actually-json/index.json === + +{} + === /node_modules/actually-json/typed.d.json.ts === declare const _default: {}; >_default : Symbol(_default, Decl(typed.d.json.ts, 0, 13)) diff --git a/tests/baselines/reference/nodeModulesJson(module=node18).types b/tests/baselines/reference/nodeModulesJson(module=node18).types index f254812ed632d..2c41926af320a 100644 --- a/tests/baselines/reference/nodeModulesJson(module=node18).types +++ b/tests/baselines/reference/nodeModulesJson(module=node18).types @@ -7,6 +7,11 @@ export function oops(json: string): any; >json : string > : ^^^^^^ +=== /node_modules/actually-json/index.json === +{} +>{} : {} +> : ^^ + === /node_modules/actually-json/typed.d.json.ts === declare const _default: {}; >_default : {} @@ -30,16 +35,16 @@ export default _default; === /main.mts === import { oops } from "not.json"; // Ok ->oops : any -> : ^^^ +>oops : (json: string) => any +> : ^ ^^ ^^^^^ import moreOops from "actually-json"; // Error in nodenext ->moreOops : any -> : ^^^ +>moreOops : {} +> : ^^ import typed from "actually-json/typed"; // Error in nodenext ->typed : any -> : ^^^ +>typed : typeof typed +> : ^^^^^^^^^^^^ import config from "./config.json" with { type: "json" }; // Ok >config : { version: number; } @@ -89,14 +94,14 @@ config3.default; // Ok === /loosey.cts === import config from "./config.json" with { type: "json" }; // Error ->config : any -> : ^^^ +>config : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ import config2 from "./config.json"; // Ok ->config2 : any -> : ^^^ +>config2 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ import { version } from "./config.json"; // Ok >version : number diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt index cbc2d07c0d648..1c28214a47363 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt @@ -1,151 +1,88 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,22): error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,22): error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(8,23): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(9,23): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(10,24): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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(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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (6 errors) ==== +!!! 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"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.mts (6 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; import * as cjsi from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.cts (6 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'package/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; - ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs"; ~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js index 0c6d3339216e9..7d1a5738c7346 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js @@ -88,59 +88,88 @@ export { type }; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.mjs] // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +// cjs format file +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); cjsi; mjsi; typei; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols index 39374133d0504..9e1ccdd9c0683 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols @@ -126,13 +126,13 @@ import * as type from "inner"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -146,13 +146,13 @@ import * as type from "inner"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -166,11 +166,11 @@ import * as type from "inner"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesPackageExports(module=node18).types index 19aabab9d2c1a..536830b78cd02 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).types @@ -3,152 +3,152 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "package/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "package"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as cjsi from "inner/cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ import * as typei from "inner"; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -157,74 +157,74 @@ import * as cjs from "inner/cjs"; > : ^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt index b0dd011d30e70..1599e814addf0 100644 --- a/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt @@ -1,55 +1,32 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,22): error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,22): error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,23): error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "#cjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "#mjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "#cjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "#mjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "#type"; - ~~~~~~~ -!!! error TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjs; mjs; type; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // esm format file import * as cjs from "#cjs"; - ~~~~~~ -!!! error TS2792: Cannot find module '#cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "#mjs"; ~~~~~~ -!!! error TS2792: Cannot find module '#mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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 TS2792: Cannot find module '#type'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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; diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).js b/tests/baselines/reference/nodeModulesPackageImports(module=node18).js index 30a9f5e4b342b..c25d1005e93d5 100644 --- a/tests/baselines/reference/nodeModulesPackageImports(module=node18).js +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).js @@ -37,41 +37,70 @@ type; } } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.mjs] // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +const cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); cjs; mjs; type; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +//// [index.js] // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json b/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json index 5927f2f512fc2..1fc306a0c6b64 100644 --- a/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json @@ -1,70 +1,64 @@ [ + "Found 'package.json' at '/.src/package.json'.", "======== Resolving module '#cjs' from '/.src/index.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File '/.src/#cjs.ts' does not exist.", - "File '/.src/#cjs.tsx' does not exist.", - "File '/.src/#cjs.d.ts' does not exist.", - "File '/#cjs.ts' does not exist.", - "File '/#cjs.tsx' does not exist.", - "File '/#cjs.d.ts' does not exist.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", - "Directory '/node_modules' does not exist, skipping all lookups in it.", - "File '/.src/#cjs.js' does not exist.", - "File '/.src/#cjs.jsx' does not exist.", - "File '/#cjs.js' does not exist.", - "File '/#cjs.jsx' does not exist.", - "======== Module name '#cjs' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Using 'imports' subpath '#cjs' with target './index.cjs'.", + "File name '/.src/index.cjs' has a '.cjs' extension - stripping it.", + "File '/.src/index.cts' exists - use it as a name resolution result.", + "======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========", "======== Resolving module '#mjs' from '/.src/index.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File '/.src/#mjs.ts' does not exist.", - "File '/.src/#mjs.tsx' does not exist.", - "File '/.src/#mjs.d.ts' does not exist.", - "File '/#mjs.ts' does not exist.", - "File '/#mjs.tsx' does not exist.", - "File '/#mjs.d.ts' does not exist.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", - "Directory '/node_modules' does not exist, skipping all lookups in it.", - "File '/.src/#mjs.js' does not exist.", - "File '/.src/#mjs.jsx' does not exist.", - "File '/#mjs.js' does not exist.", - "File '/#mjs.jsx' does not exist.", - "======== Module name '#mjs' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Using 'imports' subpath '#mjs' with target './index.mjs'.", + "File name '/.src/index.mjs' has a '.mjs' extension - stripping it.", + "File '/.src/index.mts' exists - use it as a name resolution result.", + "======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========", "======== Resolving module '#type' from '/.src/index.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File '/.src/#type.ts' does not exist.", - "File '/.src/#type.tsx' does not exist.", - "File '/.src/#type.d.ts' does not exist.", - "File '/#type.ts' does not exist.", - "File '/#type.tsx' does not exist.", - "File '/#type.d.ts' does not exist.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", - "Directory '/node_modules' does not exist, skipping all lookups in it.", - "File '/.src/#type.js' does not exist.", - "File '/.src/#type.jsx' does not exist.", - "File '/#type.js' does not exist.", - "File '/#type.jsx' does not exist.", - "======== Module name '#type' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Using 'imports' subpath '#type' with target './index.js'.", + "File name '/.src/index.js' has a '.js' extension - stripping it.", + "File '/.src/index.ts' exists - use it as a name resolution result.", + "======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========", + "======== Resolving module '#cjs' from '/.src/index.cts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Using 'imports' subpath '#cjs' with target './index.cjs'.", + "File name '/.src/index.cjs' has a '.cjs' extension - stripping it.", + "File '/.src/index.cts' exists - use it as a name resolution result.", + "======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========", + "======== Resolving module '#mjs' from '/.src/index.cts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Using 'imports' subpath '#mjs' with target './index.mjs'.", + "File name '/.src/index.mjs' has a '.mjs' extension - stripping it.", + "File '/.src/index.mts' exists - use it as a name resolution result.", + "======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========", + "======== Resolving module '#type' from '/.src/index.cts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Using 'imports' subpath '#type' with target './index.js'.", + "File name '/.src/index.js' has a '.js' extension - stripping it.", + "File '/.src/index.ts' exists - use it as a name resolution result.", + "======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========", "======== Resolving module '#cjs' from '/.src/index.mts'. ========", "Resolution for module '#cjs' was found in cache from location '/.src'.", - "======== Module name '#cjs' was not resolved. ========", + "======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========", "======== Resolving module '#mjs' from '/.src/index.mts'. ========", "Resolution for module '#mjs' was found in cache from location '/.src'.", - "======== Module name '#mjs' was not resolved. ========", + "======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========", "======== Resolving module '#type' from '/.src/index.mts'. ========", "Resolution for module '#type' was found in cache from location '/.src'.", - "======== Module name '#type' was not resolved. ========", - "======== Resolving module '#cjs' from '/.src/index.cts'. ========", - "Resolution for module '#cjs' was found in cache from location '/.src'.", - "======== Module name '#cjs' was not resolved. ========", - "======== Resolving module '#mjs' from '/.src/index.cts'. ========", - "Resolution for module '#mjs' was found in cache from location '/.src'.", - "======== Module name '#mjs' was not resolved. ========", - "======== Resolving module '#type' from '/.src/index.cts'. ========", - "Resolution for module '#type' was found in cache from location '/.src'.", - "======== Module name '#type' was not resolved. ========", + "======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========", + "File '/.ts/package.json' does not exist.", + "File '/package.json' does not exist.", "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -78,6 +72,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -91,6 +87,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -104,6 +102,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -117,6 +117,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -130,6 +132,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -143,6 +147,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -156,6 +162,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -169,6 +177,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -182,6 +192,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es5' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -195,6 +207,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -208,6 +222,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -221,6 +237,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -234,6 +252,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -247,6 +267,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -260,6 +282,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -273,6 +297,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -286,6 +312,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -299,6 +327,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -312,6 +342,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -325,6 +357,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -338,6 +372,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -351,6 +387,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/arraybuffer' from '/.src/__lib_node_modules_lookup_lib.es2017.arraybuffer.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -364,6 +402,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/arraybuffer' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -377,6 +417,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -390,6 +432,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -403,6 +447,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -416,6 +462,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -429,6 +477,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -442,6 +492,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -455,6 +507,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -468,6 +522,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -481,6 +537,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -494,6 +552,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -507,6 +567,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -520,6 +582,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -533,6 +597,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -546,6 +612,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -559,6 +627,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -572,6 +642,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -585,6 +657,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -598,6 +672,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -611,6 +687,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -624,6 +702,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -637,6 +717,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -650,6 +732,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -663,6 +747,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -676,6 +762,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -689,6 +777,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -702,6 +792,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -715,6 +807,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -728,6 +822,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -741,6 +837,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -754,6 +852,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -767,6 +867,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -780,6 +882,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -793,6 +897,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -806,6 +912,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -819,6 +927,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-dom' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -832,6 +942,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -845,6 +957,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -858,6 +972,8 @@ "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -870,5 +986,7 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).types b/tests/baselines/reference/nodeModulesPackageImports(module=node18).types index a68648b7bd6d8..7cddffea56c0b 100644 --- a/tests/baselines/reference/nodeModulesPackageImports(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).types @@ -3,78 +3,78 @@ === index.ts === // esm format file import * as cjs from "#cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "#mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ === index.mts === // esm format file import * as cjs from "#cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "#mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ === index.cts === // esm format file import * as cjs from "#cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "#mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "#type"; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ cjs; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ mjs; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ type; ->type : any -> : ^^^ +>type : typeof type +> : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt index 507218dfd54fe..624ebe117783b 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -1,106 +1,62 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,23): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,24): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.cts (3 errors) ==== +==== index.cts (1 errors) ==== // cjs format file import * as cjsi from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js index eea8a56131b20..f710ad1fe43f2 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js @@ -66,32 +66,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +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] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +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] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +const cjsi = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(require("inner/js/index")); cjsi; mjsi; typei; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols index 1c6db9a7d8368..40ff4714e8e00 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols @@ -72,13 +72,13 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -92,13 +92,13 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -112,11 +112,11 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types index e12d858eb9244..8de436002a1fa 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types @@ -3,80 +3,80 @@ === index.ts === // esm format file import * as cjsi from "inner/cjs/index"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mts === // esm format file import * as cjsi from "inner/cjs/index"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cts === // cjs format file import * as cjsi from "inner/cjs/index"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ import * as typei from "inner/js/index"; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -85,74 +85,74 @@ import * as cjs from "inner/cjs/index"; > : ^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs/index"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs/index"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt index b434585b0ebdf..fd89603b91a5c 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -1,118 +1,86 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(8,24): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(9,24): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(10,25): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(8,24): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(9,24): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(10,25): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,23): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,24): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(8,24): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(9,24): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(10,25): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/exclude/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. +index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +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(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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (6 errors) ==== +==== index.ts (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjsi from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as typei from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. cjsi; mjsi; typei; import * as cjsi2 from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi2 from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei2 from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi2; mjsi2; typei2; -==== index.mts (6 errors) ==== +==== index.mts (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjsi from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as typei from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. cjsi; mjsi; typei; import * as cjsi2 from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi2 from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei2 from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi2; mjsi2; typei2; -==== index.cts (6 errors) ==== +==== index.cts (4 errors) ==== // cjs format file import * as cjsi from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjsi from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as typei from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. cjsi; mjsi; typei; import * as cjsi2 from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi2 from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi2; mjsi2; typei2; @@ -120,13 +88,13 @@ node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/ // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjs from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as type from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. export { cjs }; export { mjs }; export { type }; @@ -134,13 +102,13 @@ node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/ // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjs from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as type from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. export { cjs }; export { mjs }; export { type }; @@ -148,55 +116,43 @@ node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/ // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. import * as mjs from "inner/mjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. import * as type from "inner/js/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/exclude/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner/js/index"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; - ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index"; ~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js index 47d4d67006a67..5fe735dbc37b1 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js @@ -111,50 +111,79 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; cjsi2; mjsi2; typei2; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; cjsi2; mjsi2; typei2; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +const cjsi = __importStar(require("inner/cjs/exclude/index")); +const mjsi = __importStar(require("inner/mjs/exclude/index")); +const typei = __importStar(require("inner/js/exclude/index")); cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +const cjsi2 = __importStar(require("inner/cjs/index")); +const mjsi2 = __importStar(require("inner/mjs/index")); +const typei2 = __importStar(require("inner/js/index")); cjsi2; mjsi2; typei2; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols index 58f51fc936974..fd0ed5715baab 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols @@ -186,13 +186,13 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -206,13 +206,13 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -226,11 +226,11 @@ import * as type from "inner/js/index"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types index 9e3505eb6f132..b94e493366d49 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types @@ -27,28 +27,28 @@ typei; > : ^^^ import * as cjsi2 from "inner/cjs/index"; ->cjsi2 : any -> : ^^^ +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ import * as mjsi2 from "inner/mjs/index"; ->mjsi2 : any -> : ^^^ +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ import * as typei2 from "inner/js/index"; ->typei2 : any -> : ^^^ +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ cjsi2; ->cjsi2 : any -> : ^^^ +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : any -> : ^^^ +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ typei2; ->typei2 : any -> : ^^^ +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ === index.mts === // esm format file @@ -77,28 +77,28 @@ typei; > : ^^^ import * as cjsi2 from "inner/cjs/index"; ->cjsi2 : any -> : ^^^ +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ import * as mjsi2 from "inner/mjs/index"; ->mjsi2 : any -> : ^^^ +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ import * as typei2 from "inner/js/index"; ->typei2 : any -> : ^^^ +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ cjsi2; ->cjsi2 : any -> : ^^^ +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : any -> : ^^^ +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ typei2; ->typei2 : any -> : ^^^ +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ === index.cts === // cjs format file @@ -127,28 +127,28 @@ typei; > : ^^^ import * as cjsi2 from "inner/cjs/index"; ->cjsi2 : any -> : ^^^ +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ import * as mjsi2 from "inner/mjs/index"; ->mjsi2 : any -> : ^^^ +>mjsi2 : typeof cjsi2.mjs +> : ^^^^^^^^^^^^^^^^ import * as typei2 from "inner/js/index"; ->typei2 : any -> : ^^^ +>typei2 : typeof cjsi2.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ cjsi2; ->cjsi2 : any -> : ^^^ +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : any -> : ^^^ +>mjsi2 : typeof cjsi2.mjs +> : ^^^^^^^^^^^^^^^^ typei2; ->typei2 : any -> : ^^^ +>typei2 : typeof cjsi2.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/exclude/index.d.ts === // cjs format file @@ -235,74 +235,74 @@ import * as cjs from "inner/cjs/index"; > : ^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs/index"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs/index"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner/js/index"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt index 6cc66ddd5b3e9..0ec3660afe010 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,106 +1,62 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.cts(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(3,23): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(4,24): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.cts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.mts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(2,22): error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(3,22): error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -node_modules/inner/index.d.ts(4,23): error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index.js"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjsi from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as typei from "inner/js/index.js"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== index.cts (3 errors) ==== +==== index.cts (1 errors) ==== // cjs format file import * as cjsi from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjsi from "inner/mjs/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (3 errors) ==== +==== node_modules/inner/index.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. import * as mjs from "inner/mjs/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.mts (3 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as type from "inner/js/index.js"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (3 errors) ==== +==== node_modules/inner/index.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/cjs/index.cjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import * as mjs from "inner/mjs/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/mjs/index.mjs'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'inner/js/index.js'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? export { cjs }; export { mjs }; export { type }; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js index 09239e1b577a0..18a9e37f040a1 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js @@ -66,32 +66,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +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] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +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] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +const cjsi = __importStar(require("inner/cjs/index.cjs")); +const mjsi = __importStar(require("inner/mjs/index.mjs")); +const typei = __importStar(require("inner/js/index.js")); cjsi; mjsi; typei; diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols index 522dc53a6b0ee..99d90e029a57c 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols @@ -72,13 +72,13 @@ import * as type from "inner/js/index.js"; >type : Symbol(type, Decl(index.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file @@ -92,13 +92,13 @@ import * as type from "inner/js/index.js"; >type : Symbol(type, Decl(index.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file @@ -112,11 +112,11 @@ import * as type from "inner/js/index.js"; >type : Symbol(type, Decl(index.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json index b30360e496914..4d02f9365e312 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -1,95 +1,189 @@ [ + "Found 'package.json' at '/.src/package.json'.", "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File name '/.src/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "File name '/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", - "File name '/.src/node_modules/@types/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "Directory '/node_modules' does not exist, skipping all lookups in it.", - "File name '/node_modules/@types/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "File name '/.src/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "File name '/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Found 'package.json' at '/.src/node_modules/inner/package.json'.", + "Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'.", + "File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.cts' does not exist.", + "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", + "Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'.", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", "======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File name '/.src/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "File name '/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", - "File name '/.src/node_modules/@types/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "Directory '/node_modules' does not exist, skipping all lookups in it.", - "File name '/node_modules/@types/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "File name '/.src/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "File name '/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'.", + "File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.mts' does not exist.", + "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", + "Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'.", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", "======== Resolving module 'inner/js/index.js' from '/.src/index.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File name '/.src/inner/js/index.js' has a '.js' extension - stripping it.", - "File name '/inner/js/index.js' has a '.js' extension - stripping it.", - "Searching all ancestor node_modules directories for preferred extensions: Declaration.", - "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", - "File name '/.src/node_modules/@types/inner/js/index.js' has a '.js' extension - stripping it.", - "Directory '/node_modules' does not exist, skipping all lookups in it.", - "File name '/node_modules/@types/inner/js/index.js' has a '.js' extension - stripping it.", - "File name '/.src/inner/js/index.js' has a '.js' extension - stripping it.", - "File name '/inner/js/index.js' has a '.js' extension - stripping it.", - "======== Module name 'inner/js/index.js' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './js/*.js' with target './index.js'.", + "File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it.", + "File '/.src/node_modules/inner/index.ts' does not exist.", + "File '/.src/node_modules/inner/index.tsx' does not exist.", + "File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'.", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'.", + "File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.cts' does not exist.", + "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'.", + "File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.mts' does not exist.", + "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './js/*.js' with target './index.js'.", + "File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it.", + "File '/.src/node_modules/inner/index.ts' does not exist.", + "File '/.src/node_modules/inner/index.tsx' does not exist.", + "File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result.", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'.", + "File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.cts' does not exist.", + "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'.", + "File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.mts' does not exist.", + "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './js/*.js' with target './index.js'.", + "File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it.", + "File '/.src/node_modules/inner/index.ts' does not exist.", + "File '/.src/node_modules/inner/index.tsx' does not exist.", + "File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result.", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", "======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", "======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'.", + "File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.cts' does not exist.", + "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", + "Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'.", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", "======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'.", + "File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it.", + "File '/.src/node_modules/inner/index.mts' does not exist.", + "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", + "Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'.", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", "======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== Module name 'inner/js/index.js' was not resolved. ========", - "Found 'package.json' at '/.src/node_modules/inner/package.json'.", + "Module resolution kind is not specified, using 'Node16'.", + "Resolving in CJS mode with conditions 'require', 'types', 'node'.", + "File '/.src/package.json' exists according to earlier cached lookups.", + "Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "Using 'exports' subpath './js/*.js' with target './index.js'.", + "File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it.", + "File '/.src/node_modules/inner/index.ts' does not exist.", + "File '/.src/node_modules/inner/index.tsx' does not exist.", + "File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'.", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File name '/.src/node_modules/inner/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "File name '/.src/node_modules/inner/cjs/index.cjs' has a '.cjs' extension - stripping it.", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", - "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File name '/.src/node_modules/inner/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "File name '/.src/node_modules/inner/mjs/index.mjs' has a '.mjs' extension - stripping it.", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", - "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ========", - "Module resolution kind is not specified, using 'Classic'.", - "File name '/.src/node_modules/inner/inner/js/index.js' has a '.js' extension - stripping it.", - "File name '/.src/node_modules/inner/js/index.js' has a '.js' extension - stripping it.", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== Module name 'inner/js/index.js' was not resolved. ========", - "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", - "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", - "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ========", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== Module name 'inner/cjs/index.cjs' was not resolved. ========", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== Module name 'inner/mjs/index.mjs' was not resolved. ========", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== Module name 'inner/js/index.js' was not resolved. ========", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ========", + "======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ========", + "======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", + "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", + "File '/.ts/package.json' does not exist.", + "File '/package.json' does not exist.", "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -102,6 +196,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -114,6 +210,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -126,6 +224,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -138,6 +238,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -150,6 +252,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -162,6 +266,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -174,6 +280,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -186,6 +294,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -198,6 +308,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es5' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -210,6 +322,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -222,6 +336,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -234,6 +350,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -246,6 +364,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -258,6 +378,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -270,6 +392,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -282,6 +406,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -294,6 +420,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -306,6 +434,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -318,6 +448,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -330,6 +462,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -342,6 +476,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -354,6 +490,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/arraybuffer' from '/.src/__lib_node_modules_lookup_lib.es2017.arraybuffer.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/arraybuffer' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -366,6 +504,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/arraybuffer' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -378,6 +518,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -390,6 +532,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -402,6 +546,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -414,6 +560,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -426,6 +574,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -438,6 +588,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -450,6 +602,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -462,6 +616,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -474,6 +630,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -486,6 +644,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -498,6 +658,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -510,6 +672,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -522,6 +686,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -534,6 +700,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -546,6 +714,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -558,6 +728,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -570,6 +742,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -582,6 +756,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -594,6 +770,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -606,6 +784,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -618,6 +798,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -630,6 +812,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -642,6 +826,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -654,6 +840,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -666,6 +854,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -678,6 +868,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -690,6 +882,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -702,6 +896,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -714,6 +910,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -726,6 +924,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -738,6 +938,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -750,6 +952,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -762,6 +966,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -774,6 +980,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -786,6 +994,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-dom' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -798,6 +1008,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -810,6 +1022,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -822,6 +1036,8 @@ "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups.", "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", "Explicitly specified module resolution kind: 'Node10'.", "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", @@ -833,5 +1049,7 @@ "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", "Directory '/node_modules' does not exist, skipping all lookups in it.", - "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========", + "File '/.ts/package.json' does not exist according to earlier cached lookups.", + "File '/package.json' does not exist according to earlier cached lookups." ] \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types index 2f12cac8afb3a..c11fe2feb146f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types @@ -3,80 +3,80 @@ === index.ts === // esm format file import * as cjsi from "inner/cjs/index.cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index.mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index.js"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.mts === // esm format file import * as cjsi from "inner/cjs/index.cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index.mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ import * as typei from "inner/js/index.js"; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ === index.cts === // cjs format file import * as cjsi from "inner/cjs/index.cjs"; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ import * as mjsi from "inner/mjs/index.mjs"; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ import * as typei from "inner/js/index.js"; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ cjsi; ->cjsi : any -> : ^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ mjsi; ->mjsi : any -> : ^^^ +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ typei; ->typei : any -> : ^^^ +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.ts === // cjs format file @@ -85,74 +85,74 @@ import * as cjs from "inner/cjs/index.cjs"; > : ^^^ import * as mjs from "inner/mjs/index.mjs"; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ import * as type from "inner/js/index.js"; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; >cjs : any > : ^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.mts === // esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index.mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ import * as type from "inner/js/index.js"; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ === node_modules/inner/index.d.cts === // cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ import * as mjs from "inner/mjs/index.mjs"; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ import * as type from "inner/js/index.js"; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ export { cjs }; ->cjs : any -> : ^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ export { mjs }; ->mjs : any -> : ^^^ +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ export { type }; ->type : any -> : ^^^ +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt deleted file mode 100644 index dd1786c54b352..0000000000000 --- a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).errors.txt +++ /dev/null @@ -1,43 +0,0 @@ -error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -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.ts(2,25): error TS2339: Property 'name' does not exist on type 'string'. -index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -!!! error TS5070: Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (2 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== 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 (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js index af502406763e4..09afe3776dcb2 100644 --- a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js @@ -34,52 +34,89 @@ export const name2 = ns.default.name; "default": "misedirection" } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); -exports.name = package_json_1.default.name; -const ns = require("./package.json"); -exports.thing = ns; -exports.name2 = ns.default.name; +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); +const package_json_1 = __importDefault(require("./package.json")); exports.name = package_json_1.default.name; -const ns = require("./package.json"); +const ns = __importStar(require("./package.json")); exports.thing = ns; exports.name2 = ns.default.name; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); -exports.name = package_json_1.default.name; -const ns = require("./package.json"); -exports.thing = ns; -exports.name2 = ns.default.name; +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; //// [index.d.ts] -export declare const name: any; +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: any; +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: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols index edd3cc7a55d66..e38476567ace3 100644 --- a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols @@ -6,7 +6,9 @@ import pkg from "./package.json" with { type: "json" }; export const name = pkg.name; >name : Symbol(name, Decl(index.ts, 1, 12)) +>pkg.name : Symbol("name", Decl(package.json, 0, 1)) >pkg : Symbol(pkg, Decl(index.ts, 0, 6)) +>name : Symbol("name", Decl(package.json, 0, 1)) import * as ns from "./package.json" with { type: "json" }; >ns : Symbol(ns, Decl(index.ts, 2, 6)) @@ -17,9 +19,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) ->ns.default : Symbol(pkg, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol(pkg, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === import pkg from "./package.json"; @@ -27,7 +31,9 @@ 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)) @@ -38,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(pkg, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(pkg, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types index 4a3846f3fc72d..aa041b8d125eb 100644 --- a/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types @@ -2,92 +2,89 @@ === index.ts === import pkg from "./package.json" with { type: "json" }; ->pkg : string -> : ^^^^^^ ->type : any -> : ^^^ +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>type : error export const name = pkg.name; ->name : any -> : ^^^ ->pkg.name : any -> : ^^^ ->pkg : string -> : ^^^^^^ ->name : any -> : ^^^ +>name : string +> : ^^^^^^ +>pkg.name : string +> : ^^^^^^ +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>name : string +> : ^^^^^^ import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->type : any -> : ^^^ +>ns : { default: { name: string; version: string; type: string; default: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>type : error 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 : string -> : ^^^^^^ +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ export const name = pkg.name; ->name : any -> : ^^^ ->pkg.name : any -> : ^^^ ->pkg : string -> : ^^^^^^ ->name : any -> : ^^^ +>name : string +> : ^^^^^^ +>pkg.name : string +> : ^^^^^^ +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>name : string +> : ^^^^^^ import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>ns : { default: { name: string; version: string; type: string; default: string; }; name: string; version: string; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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; }; name: string; version: string; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>ns : { default: { name: string; version: string; type: string; default: string; }; name: string; version: string; type: 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; }; name: string; version: string; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>default : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>name : string +> : ^^^^^^ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->type : any -> : ^^^ +>type : error export const name = pkg.name; >name : string @@ -102,8 +99,7 @@ export const name = pkg.name; import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->type : any -> : ^^^ +>type : error export const thing = ns; >thing : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt index d5ff2aa5de6e1..44537a76c954c 100644 --- a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt @@ -1,11 +1,18 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +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 TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== subfolder/index.ts (0 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() { @@ -13,10 +20,12 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci const mod4 = await import ("./index.js"); h(); } -==== index.ts (0 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() { diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js index 0b0f71fc7f5d6..f317196b7b330 100644 --- a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js @@ -34,14 +34,11 @@ export async function h() { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.h = h; -const index_js_1 = require("./subfolder/index.js"); -async function h() { +import { f } from "./subfolder/index.js"; +export async function h() { const mod3 = await import("./index.js"); const mod4 = await import("./subfolder/index.js"); - (0, index_js_1.f)(); + f(); } //// [index.js] "use strict"; diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types index 890bce62e15de..508587cdb1aa9 100644 --- a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).types @@ -35,12 +35,12 @@ export async function f() { > : ^^^^^^^^^^^^^ const mod4 = await import ("./index.js"); ->mod4 : typeof mod2 -> : ^^^^^^^^^^^ ->await import ("./index.js") : typeof mod2 -> : ^^^^^^^^^^^ ->import ("./index.js") : Promise -> : ^^^^^^^^^^^^^^^^^^^^ +>mod4 : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import ("./index.js") : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import ("./index.js") : Promise<{ default: typeof mod2; f(): Promise; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./index.js" : "./index.js" > : ^^^^^^^^^^^^ @@ -85,12 +85,12 @@ export async function h() { > : ^^^^^^^^^^^^ const mod4 = await import ("./subfolder/index.js"); ->mod4 : typeof mod2 -> : ^^^^^^^^^^^ ->await import ("./subfolder/index.js") : typeof mod2 -> : ^^^^^^^^^^^ ->import ("./subfolder/index.js") : Promise -> : ^^^^^^^^^^^^^^^^^^^^ +>mod4 : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>await import ("./subfolder/index.js") : { default: typeof mod2; f(): Promise; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import ("./subfolder/index.js") : Promise<{ default: typeof mod2; f(): Promise; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./subfolder/index.js" : "./subfolder/index.js" > : ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt index c4b38653e2066..0fd2e5390cdaf 100644 --- a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt @@ -1,29 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== 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/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js index c39cdd61dff4b..8d33777f0c4e7 100644 --- a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js @@ -30,12 +30,9 @@ const x = await 1; exports.x = x; for await (const y of []) { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = await 1; -exports.x = x; +export { x }; for await (const y of []) { } diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt deleted file mode 100644 index 800ea564bb92f..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -/index.ts(2,41): error TS2304: Cannot find name 'RequireInterface'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (2 errors) ==== - /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. - export interface LocalInterface extends RequireInterface {} - ~~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name '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 {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols index 3e24f512d0b9c..e9ef3b7f0b67f 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols @@ -4,4 +4,13 @@ /// export interface LocalInterface extends RequireInterface {} >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types index b2607cd389551..12d57f77e6462 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types @@ -4,3 +4,11 @@ /// export interface LocalInterface extends RequireInterface {} +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : any +> : ^^^ + + interface RequireInterface {} +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt deleted file mode 100644 index bd0d87a46409b..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (2 errors) ==== - /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. - 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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js index ae8fe6ec2ab1e..86c97ee2d0bdf 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js @@ -29,9 +29,8 @@ declare global { export interface LocalInterface extends ImportInterface {} //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// +export {}; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols index f597f1ce06801..dfccc41309458 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols @@ -4,4 +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/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types index 0507e04d1dac4..fddc105efb549 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types @@ -4,3 +4,11 @@ /// export interface LocalInterface extends ImportInterface {} +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : any +> : ^^^ + + interface ImportInterface {} +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt deleted file mode 100644 index ac63d6536476a..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends 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 {} - } -==== /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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js index 48b106a94af98..a8890a9178cb4 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js @@ -29,9 +29,8 @@ declare global { export interface LocalInterface extends RequireInterface {} //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// +export {}; //// [index.d.ts] diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt deleted file mode 100644 index 2707a6fc22430..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node18).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends 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 {} - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt deleted file mode 100644 index 745421bf23b34..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node18).errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (0 errors) ==== - /// - /// - export interface LocalInterface extends ImportInterface, 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 {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt deleted file mode 100644 index 02e13245a3b84..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/uses.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -/uses.ts(2,16): error TS2304: Cannot find name 'getInterR'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (0 errors) ==== - import obj from "./uses.js" - export default (obj as typeof obj); -==== /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 {} - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - function getInterR(): RequireInterface; - } -==== /uses.ts (2 errors) ==== - /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. - export default getInterR(); - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'getInterR'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js index ec6e8f20408f5..a4f6401e19790 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js @@ -35,14 +35,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getInterR(); //// [index.js] "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const uses_js_1 = require("./uses.js"); +const uses_js_1 = __importDefault(require("./uses.js")); exports.default = uses_js_1.default; //// [uses.d.ts] /// -declare const _default: any; +declare const _default: RequireInterface; export default _default; //// [index.d.ts] import obj from "./uses.js"; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols index ee2567988fca6..5b4a63b24e6f4 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols @@ -8,7 +8,20 @@ export default (obj as typeof obj); >obj : Symbol(obj, Decl(index.ts, 0, 6)) >obj : Symbol(obj, Decl(index.ts, 0, 6)) -=== /uses.ts === +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) + function getInterR(): RequireInterface; +>getInterR : Symbol(getInterR, Decl(require.d.ts, 2, 33)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) +} +=== /uses.ts === /// export default getInterR(); +>getInterR : Symbol(getInterR, Decl(require.d.ts, 2, 33)) + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types index e303918eaf382..79de08e8be8c3 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types @@ -2,24 +2,35 @@ === /index.ts === import obj from "./uses.js" ->obj : any -> : ^^^ +>obj : RequireInterface +> : ^^^^^^^^^^^^^^^^ export default (obj as typeof obj); ->(obj as typeof obj) : any -> : ^^^ ->obj as typeof obj : any -> : ^^^ ->obj : any -> : ^^^ ->obj : any -> : ^^^ +>(obj as typeof obj) : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>obj as typeof obj : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>obj : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>obj : RequireInterface +> : ^^^^^^^^^^^^^^^^ +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + interface RequireInterface {} + function getInterR(): RequireInterface; +>getInterR : () => RequireInterface +> : ^^^^^^ +} === /uses.ts === /// export default getInterR(); ->getInterR() : any -> : ^^^ ->getInterR : any -> : ^^^ +>getInterR() : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>getInterR : () => RequireInterface +> : ^^^^^^ diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt deleted file mode 100644 index f12cdc00b0346..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).errors.txt +++ /dev/null @@ -1,63 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/sub1/uses.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -/sub1/uses.ts(2,16): error TS2304: Cannot find name 'getInterI'. -/sub2/uses.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -/sub2/uses.ts(2,16): error TS2304: Cannot find name 'getInterR'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (0 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; -==== /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 (2 errors) ==== - /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. - export default getInterI(); - ~~~~~~~~~ -!!! error TS2304: Cannot find name 'getInterI'. -==== /sub1/package.json (0 errors) ==== - { - "private": true, - "type": "module" - } -==== /sub2/uses.ts (2 errors) ==== - /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. - export default getInterR(); - ~~~~~~~~~ -!!! error TS2304: Cannot find name '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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js index 221a17c87dec4..e6134a89881bc 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js @@ -49,32 +49,91 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; //// [uses.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// -exports.default = getInterI(); +export default getInterI(); //// [uses.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /// exports.default = getInterR(); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // only an esm file can `import` both kinds of files -const uses_js_1 = require("./sub1/uses.js"); -const uses_js_2 = require("./sub2/uses.js"); -exports.default = [uses_js_1.default, uses_js_2.default.default]; +import obj1 from "./sub1/uses.js"; +import obj2 from "./sub2/uses.js"; +export default [obj1, obj2.default]; //// [uses.d.ts] /// -declare const _default: any; +declare const _default: ImportInterface; export default _default; //// [uses.d.ts] /// -declare const _default: any; +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/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols index 24e8de611f10a..26fb30363849d 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols @@ -10,14 +10,44 @@ import obj2 from "./sub2/uses.js" 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 : Symbol(obj2, Decl(index.ts, 2, 6)) +>default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) >const : Symbol(const) -=== /sub1/uses.ts === +=== /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(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 { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + interface RequireInterface { _r: any; } +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) +>_r : Symbol(RequireInterface._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(); -=== /sub2/uses.ts === +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) +=== /sub2/uses.ts === /// export default getInterR(); +>getInterR : Symbol(getInterR, Decl(require.d.ts, 2, 43)) + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types index a99b9b4cdfd78..478e6741c1467 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types @@ -3,40 +3,66 @@ === /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 : any -> : ^^^ +>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 : any -> : ^^^ ->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 { +>global : typeof global +> : ^^^^^^^^^^^^^ + + interface RequireInterface { _r: any; } +>_r : any + + function getInterR(): RequireInterface; +>getInterR : () => RequireInterface +> : ^^^^^^ +} === /sub1/uses.ts === /// export default getInterI(); ->getInterI() : any -> : ^^^ ->getInterI : any -> : ^^^ +>getInterI() : ImportInterface +> : ^^^^^^^^^^^^^^^ +>getInterI : () => ImportInterface +> : ^^^^^^ === /sub2/uses.ts === /// export default getInterR(); ->getInterR() : any -> : ^^^ ->getInterR : any -> : ^^^ +>getInterR() : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>getInterR : () => RequireInterface +> : ^^^^^^ diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt index 01ea79f9da042..c9a6ac79317f9 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt @@ -1,20 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -/index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (3 errors) ==== +==== /index.ts (1 errors) ==== /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. foo; ~~~ !!! error TS2304: Cannot find name 'foo'. bar; // bar should resolve while foo should not, since index.js is cjs - ~~~ -!!! error TS2304: Cannot find name 'bar'. export {}; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols index cbc34f33743a3..0959d385ada08 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols @@ -1,8 +1,17 @@ //// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride1.ts] //// === /index.ts === - /// foo; bar; // bar should resolve while foo should not, since index.js is cjs +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) + export {}; +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + var bar: number; +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types index 54fe35a973f24..a9b87eb30959c 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types @@ -7,7 +7,17 @@ foo; > : ^^^ bar; // bar should resolve while foo should not, since index.js is cjs ->bar : any -> : ^^^ +>bar : number +> : ^^^^^^ export {}; +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var bar: number; +>bar : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt index 3219d8e3985b1..13991aa13538a 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt @@ -1,17 +1,9 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -/index.ts(2,1): error TS2304: Cannot find name 'foo'. /index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (3 errors) ==== +==== /index.ts (1 errors) ==== /// - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. 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'. diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js index 70cf2e6b25892..aee176689b2d9 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js @@ -31,8 +31,7 @@ bar; export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// foo; // foo should resolve while bar should not, since index.js is esm bar; +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols index 324227bb5ccb9..0f65d258dc7cf 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols @@ -1,8 +1,17 @@ //// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts] //// === /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; export {}; +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + var foo: number; +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types index 141c922905c94..438257a3bb9c3 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types @@ -3,11 +3,21 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm ->foo : any -> : ^^^ +>foo : number +> : ^^^^^^ bar; >bar : any > : ^^^ export {}; +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var foo: number; +>foo : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt index 703862b74dc4a..477d247984d39 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== /index.ts (1 errors) ==== /// foo; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js index 7bde651a81183..c6806f897de91 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js @@ -31,8 +31,7 @@ bar; // bar should resolve while foo should not, since even though index.js is e export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// foo; bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs +export {}; diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt index 192913da3114e..3d7f07f2775e1 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. /index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== /index.ts (1 errors) ==== /// foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt deleted file mode 100644 index 041c3b1e2a5c6..0000000000000 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride5(module=node18).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (0 errors) ==== - /// - /// - // Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two - // references above. - foo; - bar; - export {}; -==== /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 { - var foo: number; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - var bar: number; - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt index 428ae843b712e..68be0baf51514 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt @@ -1,23 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. /index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -/index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== /// ~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. - ~~~ -!!! error TS2688: Cannot find type definition file for 'pkg'. foo; // bad resolution mode, which resolves is arbitrary ~~~ !!! error TS2304: Cannot find name 'foo'. bar; - ~~~ -!!! error TS2304: Cannot find name 'bar'. export {}; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols index 3080bff7fcb0d..8a1dd89345abe 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols @@ -1,8 +1,17 @@ //// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts] //// === /index.ts === - /// foo; // bad resolution mode, which resolves is arbitrary bar; +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) + export {}; +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(require.d.ts, 0, 10)) + + var bar: number; +>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +} diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types index ce00cab1bab39..fc34db9ecd52d 100644 --- a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types @@ -7,7 +7,17 @@ foo; // bad resolution mode, which resolves is arbitrary > : ^^^ bar; ->bar : any -> : ^^^ +>bar : number +> : ^^^^^^ export {}; +=== /node_modules/pkg/require.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + var bar: number; +>bar : number +> : ^^^^^^ +} diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt deleted file mode 100644 index ef24bc2eb569f..0000000000000 --- a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).errors.txt +++ /dev/null @@ -1,63 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,22): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,22): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,22): error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (1 errors) ==== - // esm format file - import * as mod from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - mod.correctVersionApplied; - -==== index.mts (1 errors) ==== - // esm format file - import * as mod from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - mod.correctVersionApplied; - -==== index.cts (1 errors) ==== - // cjs format file - import * as mod from "inner"; - ~~~~~~~ -!!! error TS2792: Cannot find module 'inner'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - mod.correctVersionApplied; - -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const noConditionsApplied = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const importConditionApplied = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const wrongConditionApplied = true; -==== node_modules/inner/old-types.d.ts (0 errors) ==== - export const noVersionApplied = true; -==== node_modules/inner/new-types.d.ts (0 errors) ==== - export const correctVersionApplied = true; -==== node_modules/inner/future-types.d.ts (0 errors) ==== - export const futureVersionApplied = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - ".": { - "types@>=10000": "./future-types.d.ts", - "types@>=1": "./new-types.d.ts", - "types": "./old-types.d.ts", - "import": "./index.mjs", - "node": "./index.js" - }, - } - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js index d2267d06615b2..fe34ab0566b01 100644 --- a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js @@ -52,22 +52,51 @@ export const futureVersionApplied = true; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const mod = require("inner"); +import * as mod from "inner"; mod.correctVersionApplied; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const mod = require("inner"); +import * as mod from "inner"; mod.correctVersionApplied; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const mod = require("inner"); +const mod = __importStar(require("inner")); mod.correctVersionApplied; diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols index dcb791b8b5908..8ec3cb25a7915 100644 --- a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols @@ -6,7 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -14,7 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file @@ -22,7 +26,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.cts, 1, 6)) mod.correctVersionApplied; +>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.cts, 1, 6)) +>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === node_modules/inner/index.d.ts === // cjs format file diff --git a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types index 9987e1390da87..c4e2d97b2afba 100644 --- a/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).types @@ -3,44 +3,44 @@ === index.ts === // esm format file import * as mod from "inner"; ->mod : any -> : ^^^ +>mod : typeof mod +> : ^^^^^^^^^^ mod.correctVersionApplied; ->mod.correctVersionApplied : any -> : ^^^ ->mod : any -> : ^^^ ->correctVersionApplied : any -> : ^^^ +>mod.correctVersionApplied : true +> : ^^^^ +>mod : typeof mod +> : ^^^^^^^^^^ +>correctVersionApplied : true +> : ^^^^ === index.mts === // esm format file import * as mod from "inner"; ->mod : any -> : ^^^ +>mod : typeof mod +> : ^^^^^^^^^^ mod.correctVersionApplied; ->mod.correctVersionApplied : any -> : ^^^ ->mod : any -> : ^^^ ->correctVersionApplied : any -> : ^^^ +>mod.correctVersionApplied : true +> : ^^^^ +>mod : typeof mod +> : ^^^^^^^^^^ +>correctVersionApplied : true +> : ^^^^ === index.cts === // cjs format file import * as mod from "inner"; ->mod : any -> : ^^^ +>mod : typeof mod +> : ^^^^^^^^^^ mod.correctVersionApplied; ->mod.correctVersionApplied : any -> : ^^^ ->mod : any -> : ^^^ ->correctVersionApplied : any -> : ^^^ +>mod.correctVersionApplied : true +> : ^^^^ +>mod : typeof mod +> : ^^^^^^^^^^ +>correctVersionApplied : true +> : ^^^^ === node_modules/inner/index.d.ts === // cjs format file diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt b/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt index 5b3eb8f7d9b05..0c45f9b8f43a1 100644 --- a/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt @@ -1,27 +1,19 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as self from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? self; -==== index.mts (1 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as self from "package"; - ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? self; ==== index.cts (1 errors) ==== // esm format file import * as self from "package"; ~~~~~~~~~ -!!! error TS2792: Cannot find module 'package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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) ==== { diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).js b/tests/baselines/reference/nodePackageSelfName(module=node18).js index 808f7208b84fc..dc65d690cf617 100644 --- a/tests/baselines/reference/nodePackageSelfName(module=node18).js +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +const self = __importStar(require("package")); self; diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).types b/tests/baselines/reference/nodePackageSelfName(module=node18).types index 5b4e024c6a945..058acb1f54fdf 100644 --- a/tests/baselines/reference/nodePackageSelfName(module=node18).types +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).types @@ -3,30 +3,30 @@ === index.ts === // esm format file import * as self from "package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ === index.mts === // esm format file import * as self from "package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ === index.cts === // esm format file import * as self from "package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt index 84679073941e5..2c0b58848c59a 100644 --- a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt @@ -1,27 +1,19 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -index.cts(2,23): error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.mts(2,23): error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -index.ts(2,23): error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +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. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as self from "@scope/package"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? self; -==== index.mts (1 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as self from "@scope/package"; - ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? self; ==== index.cts (1 errors) ==== // cjs format file import * as self from "@scope/package"; ~~~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module '@scope/package'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +!!! error TS1479: The current file is a CommonJS module whose 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) ==== { diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js index 0ab838fc3efdb..f9d633df6fc03 100644 --- a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("@scope/package"); +import * as self from "@scope/package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("@scope/package"); +import * as self from "@scope/package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const self = require("@scope/package"); +const self = __importStar(require("@scope/package")); self; diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types index 3ef4dcccbb6b2..e197ff58db4b0 100644 --- a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).types @@ -3,30 +3,30 @@ === index.ts === // esm format file import * as self from "@scope/package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ === index.mts === // esm format file import * as self from "@scope/package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ === index.cts === // cjs format file import * as self from "@scope/package"; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ self; ->self : any -> : ^^^ +>self : typeof self +> : ^^^^^^^^^^^ diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt index 90ba5bc476890..9062d29947423 100644 --- a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt @@ -1,7 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. ==== node_modules/pkg/index.d.ts (0 errors) ==== interface GlobalThing { a: number } ==== node_modules/pkg/package.json (0 errors) ==== @@ -10,7 +9,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspeci "types": "index.d.ts", "exports": "some-other-thing.js" } -==== usage.ts (0 errors) ==== +==== usage.ts (1 errors) ==== /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. const a: GlobalThing = { a: 0 }; \ No newline at end of file From 33876127a150191d6ee9eb6c31b76a2d05ba67d4 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 9 Dec 2024 16:18:10 -0800 Subject: [PATCH 6/7] Fix module/moduleResolution agreement error --- src/compiler/program.ts | 3 ++- .../emitHelpersWithLocalCollisions(module=node18).errors.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 45d8539f581e3..fbb0145507ce0 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4539,7 +4539,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg !(ModuleResolutionKind.Node16 <= moduleResolution && moduleResolution <= ModuleResolutionKind.NodeNext) ) { const moduleKindName = ModuleKind[moduleKind]; - createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleKindName, moduleKindName); + const moduleResolutionName = ModuleResolutionKind[moduleKindName as any] ? moduleKindName : "Node16"; + createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleResolutionName, moduleKindName); } else if ( ModuleResolutionKind[moduleResolution] && diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt index 386cac3eec940..7dfd532d52b18 100644 --- a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt @@ -1,7 +1,7 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node18'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node18' (or left unspecified) when option 'module' is set to 'Node18'. +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node18'. ==== a.ts (0 errors) ==== declare var dec: any, __decorate: any; @dec export class A { From c477aa726642271560b7d458f29fe30b1dda1fae Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 12 Dec 2024 14:22:51 -0800 Subject: [PATCH 7/7] Remove extra space --- .../moduleResolution/packageJsonImportsExportsOptionCompat.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts index e7826a31c5e54..b1bf3811d6e64 100644 --- a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts +++ b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic, node, node16, nodenext, bundler +// @moduleResolution: classic, node, node16, nodenext, bundler // @resolvePackageJsonImports: true // @resolvePackageJsonExports: true // @noTypesAndSymbols: true