From f69580f82146bebfb2bee8c7b8666af0e04c7e34 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 13 Dec 2024 10:16:23 -0800 Subject: [PATCH] Add `--module node18` (#60722) --- src/compiler/checker.ts | 45 +- src/compiler/commandLineParser.ts | 1 + src/compiler/diagnosticMessages.json | 16 +- src/compiler/program.ts | 3 +- src/compiler/transformer.ts | 1 + src/compiler/types.ts | 1 + src/compiler/utilities.ts | 25 +- src/server/protocol.ts | 1 + .../codefixes/fixModuleAndTargetOptions.ts | 6 +- src/services/codefixes/importFixes.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 2 + ...entifiers_module(module=node18).errors.txt | 42 + ...espaceIdentifiers_module(module=node18).js | 104 ++ ...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 | 26 + ...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 | 64 + ...moduleNodeDefaultImports(module=node18).js | 65 + ...eNodeDefaultImports(module=node18).symbols | 116 ++ ...uleNodeDefaultImports(module=node18).types | 210 +++ ...veTopLevelAwait1(target=es2016).errors.txt | 8 +- ...(module=node18,moduleresolution=node16).js | 52 + ...le=node18,moduleresolution=node16).symbols | 15 + ...dule=node18,moduleresolution=node16).types | 22 + ...odule=node18,moduleresolution=nodenext).js | 52 + ...=node18,moduleresolution=nodenext).symbols | 15 + ...le=node18,moduleresolution=nodenext).types | 22 + ...sPackageSelfName(module=node18).errors.txt | 26 + ...deAllowJsPackageSelfName(module=node18).js | 77 + ...owJsPackageSelfName(module=node18).symbols | 26 + ...llowJsPackageSelfName(module=node18).types | 32 + .../nodeModules1(module=node18).errors.txt | 564 +++++++ .../reference/nodeModules1(module=node18).js | 710 ++++++++ .../nodeModules1(module=node18).symbols | 819 ++++++++++ .../nodeModules1(module=node18).types | 1440 +++++++++++++++++ ...eModulesAllowJs1(module=node18).errors.txt | 663 ++++++++ .../nodeModulesAllowJs1(module=node18).js | 698 ++++++++ ...nodeModulesAllowJs1(module=node18).symbols | 819 ++++++++++ .../nodeModulesAllowJs1(module=node18).types | 1440 +++++++++++++++++ ...lesAllowJsCjsFromJs(module=node18).symbols | 17 + ...dulesAllowJsCjsFromJs(module=node18).types | 28 + ...alPackageExports(module=node18).errors.txt | 137 ++ ...onditionalPackageExports(module=node18).js | 215 +++ ...ionalPackageExports(module=node18).symbols | 245 +++ ...itionalPackageExports(module=node18).types | 344 ++++ ...ulesAllowJsDynamicImport(module=node18).js | 44 + ...llowJsDynamicImport(module=node18).symbols | 24 + ...sAllowJsDynamicImport(module=node18).types | 36 + ...ExportAssignment(module=node18).errors.txt | 41 + ...sAllowJsExportAssignment(module=node18).js | 62 + ...wJsExportAssignment(module=node18).symbols | 38 + ...lowJsExportAssignment(module=node18).types | 67 + ...essJsModuleDetectionAuto(module=node18).js | 13 + ...ModuleDetectionAuto(module=node18).symbols | 8 + ...JsModuleDetectionAuto(module=node18).types | 8 + ...edNameCollisions(module=node18).errors.txt | 38 + ...sGeneratedNameCollisions(module=node18).js | 62 + ...ratedNameCollisions(module=node18).symbols | 40 + ...neratedNameCollisions(module=node18).types | 62 + ...ImportAssignment(module=node18).errors.txt | 49 + ...sAllowJsImportAssignment(module=node18).js | 65 + ...wJsImportAssignment(module=node18).symbols | 45 + ...lowJsImportAssignment(module=node18).types | 69 + ...lpersCollisions1(module=node18).errors.txt | 36 + ...ImportHelpersCollisions1(module=node18).js | 52 + ...tHelpersCollisions1(module=node18).symbols | 42 + ...ortHelpersCollisions1(module=node18).types | 70 + ...lpersCollisions2(module=node18).errors.txt | 32 + ...ImportHelpersCollisions2(module=node18).js | 47 + ...tHelpersCollisions2(module=node18).symbols | 24 + ...ortHelpersCollisions2(module=node18).types | 28 + ...lpersCollisions3(module=node18).errors.txt | 31 + ...ImportHelpersCollisions3(module=node18).js | 52 + ...tHelpersCollisions3(module=node18).symbols | 38 + ...ortHelpersCollisions3(module=node18).types | 50 + ...llowJsImportMeta(module=node18).errors.txt | 23 + ...ModulesAllowJsImportMeta(module=node18).js | 38 + ...esAllowJsImportMeta(module=node18).symbols | 26 + ...ulesAllowJsImportMeta(module=node18).types | 38 + ...JsPackageExports(module=node18).errors.txt | 109 ++ ...lesAllowJsPackageExports(module=node18).js | 175 ++ ...lowJsPackageExports(module=node18).symbols | 176 ++ ...AllowJsPackageExports(module=node18).types | 230 +++ ...JsPackageImports(module=node18).errors.txt | 46 + ...lesAllowJsPackageImports(module=node18).js | 106 ++ ...lowJsPackageImports(module=node18).symbols | 62 + ...AllowJsPackageImports(module=node18).types | 80 + ...gePatternExports(module=node18).errors.txt | 78 + ...wJsPackagePatternExports(module=node18).js | 134 ++ ...ckagePatternExports(module=node18).symbols | 122 ++ ...PackagePatternExports(module=node18).types | 158 ++ ...rnExportsExclude(module=node18).errors.txt | 123 ++ ...agePatternExportsExclude(module=node18).js | 137 ++ ...tternExportsExclude(module=node18).symbols | 122 ++ ...PatternExportsExclude(module=node18).types | 158 ++ ...nExportsTrailers(module=node18).errors.txt | 78 + ...gePatternExportsTrailers(module=node18).js | 134 ++ ...ternExportsTrailers(module=node18).symbols | 122 ++ ...atternExportsTrailers(module=node18).types | 158 ++ ...ronousCallErrors(module=node18).errors.txt | 57 + ...wJsSynchronousCallErrors(module=node18).js | 68 + ...nchronousCallErrors(module=node18).symbols | 60 + ...SynchronousCallErrors(module=node18).types | 102 ++ ...wJsTopLevelAwait(module=node18).errors.txt | 28 + ...ulesAllowJsTopLevelAwait(module=node18).js | 42 + ...llowJsTopLevelAwait(module=node18).symbols | 24 + ...sAllowJsTopLevelAwait(module=node18).types | 42 + ...rmatFileAlwaysHasDefault(module=node18).js | 36 + ...ileAlwaysHasDefault(module=node18).symbols | 15 + ...tFileAlwaysHasDefault(module=node18).types | 20 + ...alPackageExports(module=node18).errors.txt | 137 ++ ...onditionalPackageExports(module=node18).js | 215 +++ ...ionalPackageExports(module=node18).symbols | 245 +++ ...itionalPackageExports(module=node18).types | 344 ++++ ...thPackageExports(module=node18).errors.txt | 118 ++ ...onEmitWithPackageExports(module=node18).js | 212 +++ ...tWithPackageExports(module=node18).symbols | 203 +++ ...mitWithPackageExports(module=node18).types | 284 ++++ ...nodeModulesDynamicImport(module=node18).js | 44 + ...odulesDynamicImport(module=node18).symbols | 24 + ...eModulesDynamicImport(module=node18).types | 36 + ...xportAssignments(module=node18).errors.txt | 23 + ...ModulesExportAssignments(module=node18).js | 38 + ...esExportAssignments(module=node18).symbols | 18 + ...ulesExportAssignments(module=node18).types | 26 + ...cifierResolution(module=node18).errors.txt | 33 + ...locksSpecifierResolution(module=node18).js | 30 + ...SpecifierResolution(module=node18).symbols | 27 + ...ksSpecifierResolution(module=node18).types | 39 + ...cksTypesVersions(module=node18).errors.txt | 92 ++ ...portsBlocksTypesVersions(module=node18).js | 70 + ...BlocksTypesVersions(module=node18).symbols | 28 + ...cksTypesVersions(module=node18).trace.json | 1080 +++++++++++++ ...tsBlocksTypesVersions(module=node18).types | 28 + ...sExportsSourceTs(module=node18).errors.txt | 34 + ...deModulesExportsSourceTs(module=node18).js | 44 + ...ulesExportsSourceTs(module=node18).symbols | 31 + ...odulesExportsSourceTs(module=node18).types | 47 + ...rationConditions(module=node18).errors.txt | 37 + ...fierGenerationConditions(module=node18).js | 41 + ...enerationConditions(module=node18).symbols | 27 + ...rGenerationConditions(module=node18).types | 39 + ...erationDirectory(module=node18).errors.txt | 32 + ...ifierGenerationDirectory(module=node18).js | 36 + ...GenerationDirectory(module=node18).symbols | 27 + ...erGenerationDirectory(module=node18).types | 39 + ...enerationPattern(module=node18).errors.txt | 32 + ...ecifierGenerationPattern(module=node18).js | 36 + ...erGenerationPattern(module=node18).symbols | 27 + ...fierGenerationPattern(module=node18).types | 39 + ...esForbidenSyntax(module=node18).errors.txt | 139 ++ ...odeModulesForbidenSyntax(module=node18).js | 172 ++ ...dulesForbidenSyntax(module=node18).symbols | 122 ++ ...ModulesForbidenSyntax(module=node18).types | 266 +++ ...edNameCollisions(module=node18).errors.txt | 38 + ...sGeneratedNameCollisions(module=node18).js | 64 + ...ratedNameCollisions(module=node18).symbols | 40 + ...neratedNameCollisions(module=node18).types | 62 + ...ImportAssertions(module=node16).errors.txt | 8 +- ...ImportAssertions(module=node18).errors.txt | 16 + ...eModulesImportAssertions(module=node18).js | 20 + ...lesImportAssertions(module=node18).symbols | 27 + ...dulesImportAssertions(module=node18).types | 57 + ...ModulesImportAssignments(module=node18).js | 65 + ...esImportAssignments(module=node18).symbols | 45 + ...ulesImportAssignments(module=node18).types | 63 + ...ImportAttributes(module=node16).errors.txt | 8 +- ...ImportAttributes(module=node18).errors.txt | 17 + ...eModulesImportAttributes(module=node18).js | 21 + ...lesImportAttributes(module=node18).symbols | 28 + ...dulesImportAttributes(module=node18).types | 58 + ...DeclarationEmit1(module=node16).errors.txt | 8 +- ...DeclarationEmit1(module=node18).errors.txt | 37 + ...utesModeDeclarationEmit1(module=node18).js | 45 + ...odeDeclarationEmit1(module=node18).symbols | 40 + ...sModeDeclarationEmit1(module=node18).types | 41 + ...DeclarationEmit2(module=node16).errors.txt | 8 +- ...DeclarationEmit2(module=node18).errors.txt | 42 + ...utesModeDeclarationEmit2(module=node18).js | 49 + ...odeDeclarationEmit2(module=node18).symbols | 40 + ...sModeDeclarationEmit2(module=node18).types | 41 + ...rationEmitErrors(module=node16).errors.txt | 12 +- ...rationEmitErrors(module=node18).errors.txt | 43 + ...odeDeclarationEmitErrors(module=node18).js | 39 + ...clarationEmitErrors(module=node18).symbols | 30 + ...DeclarationEmitErrors(module=node18).types | 32 + ...sTypeModeDeclarationEmit(module=node18).js | 36 + ...ModeDeclarationEmit(module=node18).symbols | 28 + ...peModeDeclarationEmit(module=node18).types | 34 + ...rationEmitErrors(module=node18).errors.txt | 308 ++++ ...odeDeclarationEmitErrors(module=node18).js | 153 ++ ...clarationEmitErrors(module=node18).symbols | 130 ++ ...DeclarationEmitErrors(module=node18).types | 293 ++++ ...elpersCollisions(module=node18).errors.txt | 36 + ...sImportHelpersCollisions(module=node18).js | 52 + ...rtHelpersCollisions(module=node18).symbols | 42 + ...portHelpersCollisions(module=node18).types | 70 + ...lpersCollisions2(module=node18).errors.txt | 32 + ...ImportHelpersCollisions2(module=node18).js | 47 + ...tHelpersCollisions2(module=node18).symbols | 24 + ...ortHelpersCollisions2(module=node18).types | 28 + ...lpersCollisions3(module=node18).errors.txt | 27 + ...ImportHelpersCollisions3(module=node18).js | 42 + ...tHelpersCollisions3(module=node18).symbols | 22 + ...ortHelpersCollisions3(module=node18).types | 26 + ...odulesImportMeta(module=node18).errors.txt | 23 + .../nodeModulesImportMeta(module=node18).js | 40 + ...deModulesImportMeta(module=node18).symbols | 26 + ...nodeModulesImportMeta(module=node18).types | 38 + ...DeclarationEmit1(module=node16).errors.txt | 8 +- ...DeclarationEmit1(module=node18).errors.txt | 37 + ...portModeDeclarationEmit1(module=node18).js | 45 + ...odeDeclarationEmit1(module=node18).symbols | 40 + ...tModeDeclarationEmit1(module=node18).types | 41 + ...DeclarationEmit2(module=node16).errors.txt | 8 +- ...DeclarationEmit2(module=node18).errors.txt | 42 + ...portModeDeclarationEmit2(module=node18).js | 49 + ...odeDeclarationEmit2(module=node18).symbols | 40 + ...tModeDeclarationEmit2(module=node18).types | 41 + ...ationEmitErrors1(module=node16).errors.txt | 12 +- ...ationEmitErrors1(module=node18).errors.txt | 43 + ...deDeclarationEmitErrors1(module=node18).js | 39 + ...larationEmitErrors1(module=node18).symbols | 30 + ...eclarationEmitErrors1(module=node18).types | 32 + ...portResolutionIntoExport(module=node18).js | 80 + ...esolutionIntoExport(module=node18).symbols | 26 + ...tResolutionIntoExport(module=node18).types | 32 + ...esolutionNoCycle(module=node18).errors.txt | 33 + ...sImportResolutionNoCycle(module=node18).js | 80 + ...rtResolutionNoCycle(module=node18).symbols | 26 + ...portResolutionNoCycle(module=node18).types | 32 + ...TypeModeDeclarationEmit1(module=node18).js | 36 + ...odeDeclarationEmit1(module=node18).symbols | 28 + ...eModeDeclarationEmit1(module=node18).types | 34 + ...ationEmitErrors1(module=node18).errors.txt | 302 ++++ ...deDeclarationEmitErrors1(module=node18).js | 147 ++ ...larationEmitErrors1(module=node18).symbols | 130 ++ ...eclarationEmitErrors1(module=node18).types | 291 ++++ .../nodeModulesJson(module=node16).errors.txt | 24 +- .../nodeModulesJson(module=node18).errors.txt | 83 + .../nodeModulesJson(module=node18).symbols | 85 + .../nodeModulesJson(module=node18).types | 139 ++ ...esPackageExports(module=node18).errors.txt | 109 ++ ...odeModulesPackageExports(module=node18).js | 175 ++ ...dulesPackageExports(module=node18).symbols | 176 ++ ...ModulesPackageExports(module=node18).types | 230 +++ ...esPackageImports(module=node18).errors.txt | 44 + ...odeModulesPackageImports(module=node18).js | 106 ++ ...dulesPackageImports(module=node18).symbols | 62 + ...esPackageImports(module=node18).trace.json | 992 ++++++++++++ ...ModulesPackageImports(module=node18).types | 80 + ...gePatternExports(module=node18).errors.txt | 78 + ...lesPackagePatternExports(module=node18).js | 134 ++ ...ckagePatternExports(module=node18).symbols | 122 ++ ...PackagePatternExports(module=node18).types | 158 ++ ...rnExportsExclude(module=node18).errors.txt | 177 ++ ...agePatternExportsExclude(module=node18).js | 197 +++ ...tternExportsExclude(module=node18).symbols | 236 +++ ...PatternExportsExclude(module=node18).types | 308 ++++ ...nExportsTrailers(module=node18).errors.txt | 78 + ...gePatternExportsTrailers(module=node18).js | 134 ++ ...ternExportsTrailers(module=node18).symbols | 122 ++ ...nExportsTrailers(module=node18).trace.json | 1055 ++++++++++++ ...atternExportsTrailers(module=node18).types | 158 ++ ...esolveJsonModule(module=node16).errors.txt | 16 +- ...ModulesResolveJsonModule(module=node18).js | 130 ++ ...esResolveJsonModule(module=node18).symbols | 91 ++ ...ulesResolveJsonModule(module=node18).types | 152 ++ ...ronousCallErrors(module=node18).errors.txt | 45 + ...lesSynchronousCallErrors(module=node18).js | 59 + ...nchronousCallErrors(module=node18).symbols | 60 + ...SynchronousCallErrors(module=node18).types | 102 ++ ...lesTopLevelAwait(module=node18).errors.txt | 28 + ...nodeModulesTopLevelAwait(module=node18).js | 44 + ...odulesTopLevelAwait(module=node18).symbols | 24 + ...eModulesTopLevelAwait(module=node18).types | 42 + ...enceModeDeclarationEmit1(module=node18).js | 35 + ...odeDeclarationEmit1(module=node18).symbols | 16 + ...eModeDeclarationEmit1(module=node18).types | 14 + ...enceModeDeclarationEmit2(module=node18).js | 39 + ...odeDeclarationEmit2(module=node18).symbols | 16 + ...eModeDeclarationEmit2(module=node18).types | 14 + ...enceModeDeclarationEmit3(module=node18).js | 39 + ...odeDeclarationEmit3(module=node18).symbols | 16 + ...eModeDeclarationEmit3(module=node18).types | 14 + ...enceModeDeclarationEmit4(module=node18).js | 35 + ...odeDeclarationEmit4(module=node18).symbols | 16 + ...eModeDeclarationEmit4(module=node18).types | 14 + ...enceModeDeclarationEmit5(module=node18).js | 38 + ...odeDeclarationEmit5(module=node18).symbols | 26 + ...eModeDeclarationEmit5(module=node18).types | 23 + ...enceModeDeclarationEmit6(module=node18).js | 53 + ...odeDeclarationEmit6(module=node18).symbols | 27 + ...eModeDeclarationEmit6(module=node18).types | 36 + ...enceModeDeclarationEmit7(module=node18).js | 139 ++ ...odeDeclarationEmit7(module=node18).symbols | 53 + ...eModeDeclarationEmit7(module=node18).types | 68 + ...nceModeOverride1(module=node18).errors.txt | 29 + ...shReferenceModeOverride1(module=node18).js | 33 + ...erenceModeOverride1(module=node18).symbols | 17 + ...eferenceModeOverride1(module=node18).types | 23 + ...nceModeOverride2(module=node18).errors.txt | 34 + ...shReferenceModeOverride2(module=node18).js | 37 + ...erenceModeOverride2(module=node18).symbols | 17 + ...eferenceModeOverride2(module=node18).types | 23 + ...nceModeOverride3(module=node18).errors.txt | 34 + ...shReferenceModeOverride3(module=node18).js | 37 + ...erenceModeOverride3(module=node18).symbols | 17 + ...eferenceModeOverride3(module=node18).types | 23 + ...nceModeOverride4(module=node18).errors.txt | 29 + ...shReferenceModeOverride4(module=node18).js | 33 + ...erenceModeOverride4(module=node18).symbols | 17 + ...eferenceModeOverride4(module=node18).types | 23 + ...shReferenceModeOverride5(module=node18).js | 39 + ...erenceModeOverride5(module=node18).symbols | 30 + ...eferenceModeOverride5(module=node18).types | 36 + ...verrideModeError(module=node18).errors.txt | 32 + ...nceModeOverrideModeError(module=node18).js | 33 + ...deOverrideModeError(module=node18).symbols | 17 + ...ModeOverrideModeError(module=node18).types | 23 + ...pesVersionPackageExports(module=node18).js | 108 ++ ...rsionPackageExports(module=node18).symbols | 59 + ...VersionPackageExports(module=node18).types | 89 + ...ePackageSelfName(module=node18).errors.txt | 24 + .../nodePackageSelfName(module=node18).js | 77 + ...nodePackageSelfName(module=node18).symbols | 26 + .../nodePackageSelfName(module=node18).types | 32 + ...geSelfNameScoped(module=node18).errors.txt | 24 + ...odePackageSelfNameScoped(module=node18).js | 77 + ...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 | 17 + ...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 | 2 +- ...leSlashTypesReferenceWithMissingExports.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 +- 463 files changed, 31423 insertions(+), 529 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).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).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).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).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).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).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).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).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).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).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).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).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).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).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).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).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).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).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).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/src/compiler/checker.ts b/src/compiler/checker.ts index 565420738d8ce..04facba3196e7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -882,6 +882,7 @@ import { ModuleKind, ModuleResolutionKind, ModuleSpecifierResolutionHost, + moduleSupportsImportAttributes, Mutable, MutableNodeArray, NamedDeclaration, @@ -37631,13 +37632,13 @@ 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); } } 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."); @@ -39212,6 +39213,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); @@ -39232,8 +39234,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; @@ -48064,16 +48066,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_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; - 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); @@ -48122,7 +48130,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - if (!importClause.isTypeOnly && moduleKind === ModuleKind.NodeNext && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) { + if (!importClause.isTypeOnly && 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]); } @@ -52062,6 +52070,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( @@ -52080,7 +52089,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; } @@ -52882,7 +52891,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) { @@ -52890,13 +52899,13 @@ 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); 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/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/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 { - 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: { @@ -9000,6 +9006,7 @@ const _computedOptions = createComputedCompilerOptions({ } switch (_computedOptions.module.computeValue(compilerOptions)) { case ModuleKind.Node16: + case ModuleKind.Node18: case ModuleKind.NodeNext: case ModuleKind.Preserve: return true; @@ -9229,6 +9236,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/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: 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..cc359bceb4904 --- /dev/null +++ b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).errors.txt @@ -0,0 +1,42 @@ +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"'. + + +==== 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..311a983aea48a --- /dev/null +++ b/tests/baselines/reference/arbitraryModuleNamespaceIdentifiers_module(module=node18).js @@ -0,0 +1,104 @@ +//// [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"; +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[""] = 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[""] = __importStar(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..7dfd532d52b18 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).errors.txt @@ -0,0 +1,12 @@ +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 '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 { + } + + 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..47204b7a76f30 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node18).js @@ -0,0 +1,26 @@ +//// [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] +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; +}; +let A = class A { +}; +A = __decorate([ + dec +], A); +export { 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..2fd1d68ba8d00 --- /dev/null +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).errors.txt @@ -0,0 +1,64 @@ +b.mts(15,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(16,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(17,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(18,1): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(19,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. +b.mts(20,6): error TS2349: This expression is not callable. + Type 'typeof import("mod")' has no call signatures. + + +==== mod.cts (0 errors) ==== + 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..1d6e31ec0afb2 --- /dev/null +++ b/tests/baselines/reference/moduleNodeDefaultImports(module=node18).js @@ -0,0 +1,65 @@ +//// [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] +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(); 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..2d0c7b4607ea5 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=node16).js @@ -0,0 +1,52 @@ +//// [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"; +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 = __importStar(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..2d0c7b4607ea5 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithModule(module=node18,moduleresolution=nodenext).js @@ -0,0 +1,52 @@ +//// [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"; +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 = __importStar(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..fe6d0aa7e42be --- /dev/null +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).errors.txt @@ -0,0 +1,26 @@ +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 TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.js (0 errors) ==== + // esm format file + import * as self from "package"; + self; +==== index.mjs (0 errors) ==== + // esm format file + import * as self from "package"; + self; +==== index.cjs (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + self; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js new file mode 100644 index 0000000000000..1498e98d79602 --- /dev/null +++ b/tests/baselines/reference/nodeAllowJsPackageSelfName(module=node18).js @@ -0,0 +1,77 @@ +//// [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] +// esm format file +import * as self from "package"; +self; +//// [index.mjs] +// esm format file +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 = __importStar(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..f8e06c7c53e1c --- /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 : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + +=== index.mjs === +// esm format file +import * as self from "package"; +>self : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + +=== index.cjs === +// esm format file +import * as self from "package"; +>self : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + 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..acd3f749846d5 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).errors.txt @@ -0,0 +1,564 @@ +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'? + + +==== 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 (27 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 TS2307: Cannot find module './' or its corresponding type declarations. + import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + void m1; + void m2; + void m3; + 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 TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m26 = require("./subfolder"); + import m27 = require("./subfolder/"); + import m28 = require("./subfolder/index"); + import m29 = require("./subfolder2"); + import m30 = require("./subfolder2/"); + import m31 = require("./subfolder2/index"); + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; + void m25; + void m26; + 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 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 (27 errors) ==== + // ESM-format imports below should issue errors + import * as m1 from "./index.js"; + ~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. + import * as m2 from "./index.mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. + import * as m3 from "./index.cjs"; + import * as m4 from "./subfolder/index.js"; + import * as m5 from "./subfolder/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. + import * as m6 from "./subfolder/index.cjs"; + import * as m7 from "./subfolder2/index.js"; + import * as m8 from "./subfolder2/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. + import * as m9 from "./subfolder2/index.cjs"; + import * as m10 from "./subfolder2/another/index.js"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. + import * as m11 from "./subfolder2/another/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. + import * as m12 from "./subfolder2/another/index.cjs"; + // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) + import * as m13 from "./"; + ~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. + import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. + import * as m15 from "./subfolder"; + import * as m16 from "./subfolder/"; + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + import * as m19 from "./subfolder2/"; + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. + import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. + void m1; + void m2; + void m3; + 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 TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m26 = require("./subfolder"); + import m27 = require("./subfolder/"); + import m28 = require("./subfolder/index"); + import m29 = require("./subfolder2"); + import m30 = require("./subfolder2/"); + import m31 = require("./subfolder2/index"); + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; + void m25; + void m26; + 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 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 (27 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 TS2307: Cannot find module './' or its corresponding type declarations. + import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + void m1; + void m2; + void m3; + 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 TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m25 = require("./index"); + ~~~~~~~~~ +!!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m26 = require("./subfolder"); + import m27 = require("./subfolder/"); + import m28 = require("./subfolder/index"); + import m29 = require("./subfolder2"); + import m30 = require("./subfolder2/"); + import m31 = require("./subfolder2/index"); + import m32 = require("./subfolder2/another"); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; + void m25; + void m26; + 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 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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}; +==== 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..bfebc4d12e830 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).js @@ -0,0 +1,710 @@ +//// [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] +// esm format file +const x = 1; +export { 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] +// esm format file +const x = 1; +export { x }; +//// [index.js] +// esm format file +const x = 1; +export { x }; +//// [index.mjs] +// esm format file +const x = 1; +export { 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"; +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 = __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 = __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; +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] +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 +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!) +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; +export { x }; +//// [index.mjs] +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 +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!) +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; +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.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..cf80f6db97d80 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node18).symbols @@ -0,0 +1,819 @@ +//// [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)) + +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)) + +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)) + +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)) + +// 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)) + +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)) + +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)) + +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)) + +// 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)) + +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)) + +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)) + +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)) + +// 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..49631af15a8e8 --- /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 : any +> : ^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : any +> : ^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : any +> : ^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : any +> : ^^^ + +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 : any +> : ^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : any +> : ^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : any +> : ^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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 : typeof m1 +> : ^^^^^^^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : typeof m26 +> : ^^^^^^^^^^ + +import m27 = require("./subfolder/"); +>m27 : typeof m26 +> : ^^^^^^^^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m26 +> : ^^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : typeof m29 +> : ^^^^^^^^^^ + +import m30 = require("./subfolder2/"); +>m30 : typeof m29 +> : ^^^^^^^^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m29 +> : ^^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : typeof m10 +> : ^^^^^^^^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : typeof m10 +> : ^^^^^^^^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ + +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 : typeof m1 +> : ^^^^^^^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : typeof m4 +> : ^^^^^^^^^ + +import * as m16 from "./subfolder/"; +>m16 : typeof m4 +> : ^^^^^^^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : typeof m7 +> : ^^^^^^^^^ + +import * as m19 from "./subfolder2/"; +>m19 : typeof m7 +> : ^^^^^^^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : typeof m10 +> : ^^^^^^^^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : typeof m10 +> : ^^^^^^^^^^ + +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 : typeof m1 +> : ^^^^^^^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : typeof m4 +> : ^^^^^^^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : typeof m4 +> : ^^^^^^^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : typeof m7 +> : ^^^^^^^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : typeof m7 +> : ^^^^^^^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : typeof m10 +> : ^^^^^^^^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : typeof m10 +> : ^^^^^^^^^^ + +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 : typeof m1 +> : ^^^^^^^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : typeof m4 +> : ^^^^^^^^^ + +import m27 = require("./subfolder/"); +>m27 : typeof m4 +> : ^^^^^^^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : typeof m7 +> : ^^^^^^^^^ + +import m30 = require("./subfolder2/"); +>m30 : typeof m7 +> : ^^^^^^^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : typeof m10 +> : ^^^^^^^^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : typeof m10 +> : ^^^^^^^^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : typeof m4 +> : ^^^^^^^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : typeof m4 +> : ^^^^^^^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : typeof m7 +> : ^^^^^^^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : typeof m7 +> : ^^^^^^^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ + +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 : any +> : ^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : any +> : ^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : any +> : ^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : any +> : ^^^ + +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 : any +> : ^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : any +> : ^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : any +> : ^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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 : typeof m1 +> : ^^^^^^^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : typeof m26 +> : ^^^^^^^^^^ + +import m27 = require("./subfolder/"); +>m27 : typeof m26 +> : ^^^^^^^^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m26 +> : ^^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : typeof m29 +> : ^^^^^^^^^^ + +import m30 = require("./subfolder2/"); +>m30 : typeof m29 +> : ^^^^^^^^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m29 +> : ^^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : typeof m10 +> : ^^^^^^^^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : typeof m10 +> : ^^^^^^^^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ + +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..13ade2052e398 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).errors.txt @@ -0,0 +1,663 @@ +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 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(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(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(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(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(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. +index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + + +==== 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 (38 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 TS2307: Cannot find module './' or its corresponding type declarations. + import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + void m1; + void m2; + void m3; + 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 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. + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + 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. + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + 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 TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; + void m25; + void m26; + 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 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 (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 TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. + import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. + import * as m15 from "./subfolder"; + import * as m16 from "./subfolder/"; + import * as m17 from "./subfolder/index"; + import * as m18 from "./subfolder2"; + import * as m19 from "./subfolder2/"; + import * as m20 from "./subfolder2/index"; + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. + import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. + void m1; + void m2; + void m3; + 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 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. + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + 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. + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + 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 TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; + void m25; + void m26; + 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 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 (38 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 TS2307: Cannot find module './' or its corresponding type declarations. + import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? + import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? + import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? + import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. + import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? + void m1; + void m2; + void m3; + 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 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. + import m27 = require("./subfolder/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + 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. + import m30 = require("./subfolder2/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + 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 TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m33 = require("./subfolder2/another/"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import m34 = require("./subfolder2/another/index"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + void m24; + void m25; + void m26; + 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 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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 TS2834: 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}; +==== 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..4a63449d26383 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).js @@ -0,0 +1,698 @@ +//// [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] +// esm format file +const x = 1; +export { 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] +// esm format file +const x = 1; +export { x }; +//// [index.js] +// esm format file +const x = 1; +export { 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] +// esm format file +const x = 1; +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 = __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 = __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; +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] +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 +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!) +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; +export { x }; +//// [index.js] +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 +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!) +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; +export { 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..1d24c14a43ea7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJs1(module=node18).symbols @@ -0,0 +1,819 @@ +//// [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)) + +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)) + +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)) + +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)) + +// 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)) + +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)) + +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)) + +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)) + +// 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)) + +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)) + +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)) + +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)) + +// 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..672e1a9c81b16 --- /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 : any +> : ^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : any +> : ^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : any +> : ^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : any +> : ^^^ + +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 : any +> : ^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : any +> : ^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : any +> : ^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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 : typeof m1 +> : ^^^^^^^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : typeof m26 +> : ^^^^^^^^^^ + +import m27 = require("./subfolder/"); +>m27 : typeof m26 +> : ^^^^^^^^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m26 +> : ^^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : typeof m29 +> : ^^^^^^^^^^ + +import m30 = require("./subfolder2/"); +>m30 : typeof m29 +> : ^^^^^^^^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m29 +> : ^^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : typeof m10 +> : ^^^^^^^^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : typeof m10 +> : ^^^^^^^^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ + +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 : typeof m1 +> : ^^^^^^^^^ + +import * as m14 from "./index"; +>m14 : typeof m1 +> : ^^^^^^^^^ + +import * as m15 from "./subfolder"; +>m15 : typeof m4 +> : ^^^^^^^^^ + +import * as m16 from "./subfolder/"; +>m16 : typeof m4 +> : ^^^^^^^^^ + +import * as m17 from "./subfolder/index"; +>m17 : typeof m4 +> : ^^^^^^^^^ + +import * as m18 from "./subfolder2"; +>m18 : typeof m7 +> : ^^^^^^^^^ + +import * as m19 from "./subfolder2/"; +>m19 : typeof m7 +> : ^^^^^^^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : typeof m7 +> : ^^^^^^^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : typeof m10 +> : ^^^^^^^^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : typeof m10 +> : ^^^^^^^^^^ + +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 : typeof m1 +> : ^^^^^^^^^ + +void m14; +>void m14 : undefined +> : ^^^^^^^^^ +>m14 : typeof m1 +> : ^^^^^^^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : typeof m4 +> : ^^^^^^^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : typeof m4 +> : ^^^^^^^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : typeof m4 +> : ^^^^^^^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : typeof m7 +> : ^^^^^^^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : typeof m7 +> : ^^^^^^^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : typeof m7 +> : ^^^^^^^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : typeof m10 +> : ^^^^^^^^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : typeof m10 +> : ^^^^^^^^^^ + +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 : typeof m1 +> : ^^^^^^^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : typeof m4 +> : ^^^^^^^^^ + +import m27 = require("./subfolder/"); +>m27 : typeof m4 +> : ^^^^^^^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m4 +> : ^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : typeof m7 +> : ^^^^^^^^^ + +import m30 = require("./subfolder2/"); +>m30 : typeof m7 +> : ^^^^^^^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m7 +> : ^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : typeof m10 +> : ^^^^^^^^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : typeof m10 +> : ^^^^^^^^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : typeof m4 +> : ^^^^^^^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : typeof m4 +> : ^^^^^^^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m4 +> : ^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : typeof m7 +> : ^^^^^^^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : typeof m7 +> : ^^^^^^^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m7 +> : ^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ + +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 : any +> : ^^^ + +import * as m15 from "./subfolder"; +>m15 : any +> : ^^^ + +import * as m16 from "./subfolder/"; +>m16 : any +> : ^^^ + +import * as m17 from "./subfolder/index"; +>m17 : any +> : ^^^ + +import * as m18 from "./subfolder2"; +>m18 : any +> : ^^^ + +import * as m19 from "./subfolder2/"; +>m19 : any +> : ^^^ + +import * as m20 from "./subfolder2/index"; +>m20 : any +> : ^^^ + +import * as m21 from "./subfolder2/another"; +>m21 : any +> : ^^^ + +import * as m22 from "./subfolder2/another/"; +>m22 : any +> : ^^^ + +import * as m23 from "./subfolder2/another/index"; +>m23 : any +> : ^^^ + +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 : any +> : ^^^ + +void m15; +>void m15 : undefined +> : ^^^^^^^^^ +>m15 : any +> : ^^^ + +void m16; +>void m16 : undefined +> : ^^^^^^^^^ +>m16 : any +> : ^^^ + +void m17; +>void m17 : undefined +> : ^^^^^^^^^ +>m17 : any +> : ^^^ + +void m18; +>void m18 : undefined +> : ^^^^^^^^^ +>m18 : any +> : ^^^ + +void m19; +>void m19 : undefined +> : ^^^^^^^^^ +>m19 : any +> : ^^^ + +void m20; +>void m20 : undefined +> : ^^^^^^^^^ +>m20 : any +> : ^^^ + +void m21; +>void m21 : undefined +> : ^^^^^^^^^ +>m21 : any +> : ^^^ + +void m22; +>void m22 : undefined +> : ^^^^^^^^^ +>m22 : any +> : ^^^ + +void m23; +>void m23 : undefined +> : ^^^^^^^^^ +>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 : typeof m1 +> : ^^^^^^^^^ + +import m25 = require("./index"); +>m25 : typeof m1 +> : ^^^^^^^^^ + +import m26 = require("./subfolder"); +>m26 : typeof m26 +> : ^^^^^^^^^^ + +import m27 = require("./subfolder/"); +>m27 : typeof m26 +> : ^^^^^^^^^^ + +import m28 = require("./subfolder/index"); +>m28 : typeof m26 +> : ^^^^^^^^^^ + +import m29 = require("./subfolder2"); +>m29 : typeof m29 +> : ^^^^^^^^^^ + +import m30 = require("./subfolder2/"); +>m30 : typeof m29 +> : ^^^^^^^^^^ + +import m31 = require("./subfolder2/index"); +>m31 : typeof m29 +> : ^^^^^^^^^^ + +import m32 = require("./subfolder2/another"); +>m32 : typeof m10 +> : ^^^^^^^^^^ + +import m33 = require("./subfolder2/another/"); +>m33 : typeof m10 +> : ^^^^^^^^^^ + +import m34 = require("./subfolder2/another/index"); +>m34 : typeof m10 +> : ^^^^^^^^^^ + +void m24; +>void m24 : undefined +> : ^^^^^^^^^ +>m24 : typeof m1 +> : ^^^^^^^^^ + +void m25; +>void m25 : undefined +> : ^^^^^^^^^ +>m25 : typeof m1 +> : ^^^^^^^^^ + +void m26; +>void m26 : undefined +> : ^^^^^^^^^ +>m26 : typeof m26 +> : ^^^^^^^^^^ + +void m27; +>void m27 : undefined +> : ^^^^^^^^^ +>m27 : typeof m26 +> : ^^^^^^^^^^ + +void m28; +>void m28 : undefined +> : ^^^^^^^^^ +>m28 : typeof m26 +> : ^^^^^^^^^^ + +void m29; +>void m29 : undefined +> : ^^^^^^^^^ +>m29 : typeof m29 +> : ^^^^^^^^^^ + +void m30; +>void m30 : undefined +> : ^^^^^^^^^ +>m30 : typeof m29 +> : ^^^^^^^^^^ + +void m31; +>void m31 : undefined +> : ^^^^^^^^^ +>m31 : typeof m29 +> : ^^^^^^^^^^ + +void m32; +>void m32 : undefined +> : ^^^^^^^^^ +>m32 : typeof m10 +> : ^^^^^^^^^^ + +void m33; +>void m33 : undefined +> : ^^^^^^^^^ +>m33 : typeof m10 +> : ^^^^^^^^^^ + +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).symbols b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols new file mode 100644 index 0000000000000..b855f772f99f4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsCjsFromJs(module=node18).symbols @@ -0,0 +1,17 @@ +//// [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.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 new file mode 100644 index 0000000000000..ec9c59e5c8a9b --- /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 : typeof foo +> : ^^^^^^^^^^ + +foo.foo; +>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 new file mode 100644 index 0000000000000..af5e14950e1c9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -0,0 +1,137 @@ +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 TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.js (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/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 (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/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 (2 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + cjs; + mjs; + type; + import * as cjsi from "inner/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; +==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/a"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + 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; +==== node_modules/inner/index.d.mts (1 errors) ==== + // esm format file + import * as cjs from "inner/a"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + 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; +==== node_modules/inner/index.d.cts (0 errors) ==== + // 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 (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..89094051db9df --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js @@ -0,0 +1,215 @@ +//// [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.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] +"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 = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); +cjs; +mjs; +type; +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.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 new file mode 100644 index 0000000000000..6ac785d10279f --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols @@ -0,0 +1,245 @@ +//// [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.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 +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.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 +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.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 +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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) + +export { type }; +>type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) + +export { ts }; +>ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) + +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(mjs.type.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(mjs.cjs, Decl(index.d.mts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) + +export { type }; +>type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) + +export { ts }; +>ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) + +export const mjsSource = true; +>mjsSource : Symbol(mjs.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.cjs, Decl(index.d.cts, 5, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) + +export { type }; +>type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) + +export { ts }; +>ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) + +export const cjsSource = true; +>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 new file mode 100644 index 0000000000000..bfa4914e21fe9 --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/a"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/b"; +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi +> : ^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjsi +> : ^^^^^^^^^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +typei.mjsSource; +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +ts.mjsSource; +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +=== index.mjs === +// esm format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/a"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/b"; +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi +> : ^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjsi +> : ^^^^^^^^^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +typei.mjsSource; +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +ts.mjsSource; +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +=== index.cjs === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/a"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/b"; +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjsi +> : ^^^^^^^^^^^ + +cjsi.cjsSource; +>cjsi.cjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ + +mjsi.cjsSource; +>mjsi.cjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ + +typei.implicitCjsSource; +>typei.implicitCjsSource : true +> : ^^^^ +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ +>implicitCjsSource : true +> : ^^^^ + +ts.cjsSource; +>ts.cjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof mjs +> : ^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ + +export { ts }; +>ts : typeof mjs +> : ^^^^^^^^^^ + +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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof mjs +> : ^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof mjs +> : ^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs +> : ^^^^^^^^^^ + +export { ts }; +>ts : typeof mjs +> : ^^^^^^^^^^ + +export const mjsSource = true; +>mjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/b"; +>mjs : typeof cjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjs +> : ^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ + +export { ts }; +>ts : typeof cjs +> : ^^^^^^^^^^ + +export const cjsSource = true; +>cjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js new file mode 100644 index 0000000000000..ac43e11733d77 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).js @@ -0,0 +1,44 @@ +//// [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] +// esm format file +export 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..8689b18a720f7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsDynamicImport(module=node18).types @@ -0,0 +1,36 @@ +//// [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..15bd70e4c2e9d --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).errors.txt @@ -0,0 +1,41 @@ +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 TS8003: 'export =' can only be used in TypeScript files. + + +==== subfolder/index.js (1 errors) ==== + // cjs format file + const a = {}; + export = a; + ~~~~~~~~~~~ +!!! error TS8003: 'export =' can only be used in TypeScript files. +==== subfolder/file.js (0 errors) ==== + // cjs format file + const a = {}; + module.exports = a; +==== 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..92ecb7eacddd7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node18).js @@ -0,0 +1,62 @@ +//// [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] +// esm format file +const a = {}; +export {}; +//// [file.js] +// esm format file +import "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).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..e54f9b0f94ca4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).errors.txt @@ -0,0 +1,38 @@ +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. + + +==== 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 + 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..30926a25ccde1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsGeneratedNameCollisions(module=node18).js @@ -0,0 +1,62 @@ +//// [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] +// esm format file +function require() { } +const exports = {}; +class Object { +} +export const __esModule = false; +export { require, exports, Object }; + + +//// [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..476c47f703e37 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).errors.txt @@ -0,0 +1,49 @@ +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. + + +==== 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..ee161c309e871 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportAssignment(module=node18).js @@ -0,0 +1,65 @@ +//// [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] +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +// esm format file +const fs = __require("fs"); +fs.readFile; +const fs2 = __require("fs"); +export { fs2 }; +//// [file.js] +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_1("fs"); +fs.readFile; +const fs2 = __require_1("fs"); +export { fs2 }; + + +//// [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..17c99081b2e70 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).errors.txt @@ -0,0 +1,36 @@ +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'. + + +==== 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 + 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..a30d220227f20 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions1(module=node18).js @@ -0,0 +1,52 @@ +//// [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 }); +const tslib_1 = require("tslib"); +// cjs format file +const fs_1 = tslib_1.__importDefault(require("fs")); +fs_1.default.readFile; +const fs = tslib_1.__importStar(require("fs")); +fs.readFile; +//// [index.js] +// esm format file +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "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..78bd927d81fe8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).errors.txt @@ -0,0 +1,32 @@ +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'. + + +==== 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"; + 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..1960ba0103e95 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions2(module=node18).js @@ -0,0 +1,47 @@ +//// [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"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +const tslib_1 = require("tslib"); +// cjs format file +tslib_1.__exportStar(require("fs"), exports); +exports.fs = tslib_1.__importStar(require("fs")); +//// [index.js] +// esm format file +export * from "fs"; +export * as fs from "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..f1e751aeb0f1f --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).errors.txt @@ -0,0 +1,31 @@ +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 (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) ==== + // 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..8fefc3d2d6b56 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportHelpersCollisions3(module=node18).js @@ -0,0 +1,52 @@ +//// [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; +var tslib_1 = require("tslib"); +// cjs format file +var fs_1 = require("fs"); +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 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] +// esm format file +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; + + +//// [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..28110ed339d18 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).errors.txt @@ -0,0 +1,23 @@ +subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +==== subfolder/index.js (1 errors) ==== + // cjs format file + const x = import.meta.url; + ~~~~~~~~~~~ +!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + export {x}; +==== index.js (0 errors) ==== + // esm format file + const x = import.meta.url; + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js new file mode 100644 index 0000000000000..7e6d01b7daf2a --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsImportMeta(module=node18).js @@ -0,0 +1,38 @@ +//// [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] +// esm format file +const x = import.meta.url; +export { 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..f5736b5998181 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -0,0 +1,109 @@ +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 TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.js (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + import * as typei from "inner"; + cjsi; + mjsi; + typei; +==== index.mjs (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + import * as typei from "inner"; + cjsi; + mjsi; + typei; +==== index.cjs (3 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as typei from "inner"; + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as type from "inner"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + import * as type from "inner"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as type from "inner"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js new file mode 100644 index 0000000000000..208b7a1a36fde --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js @@ -0,0 +1,175 @@ +//// [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.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] +"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 = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); +cjs; +mjs; +type; +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); +cjsi; +mjsi; +typei; +//// [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.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 new file mode 100644 index 0000000000000..9fe0e570a7061 --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..4a54afca62898 --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mjs === +// esm format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cjs === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +typei; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>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 new file mode 100644 index 0000000000000..e845dc72f0284 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).errors.txt @@ -0,0 +1,46 @@ +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 TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.js (0 errors) ==== + // esm format file + import * as cjs from "#cjs"; + import * as mjs from "#mjs"; + import * as type from "#type"; + cjs; + mjs; + type; +==== index.mjs (0 errors) ==== + // esm format file + import * as cjs from "#cjs"; + import * as mjs from "#mjs"; + import * as type from "#type"; + cjs; + mjs; + type; +==== index.cjs (2 errors) ==== + // esm format file + import * as cjs from "#cjs"; + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. + import * as type from "#type"; + ~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. + cjs; + mjs; + type; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js", + "imports": { + "#cjs": "./index.cjs", + "#mjs": "./index.mjs", + "#type": "./index.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js new file mode 100644 index 0000000000000..510e6b7128c79 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackageImports(module=node18).js @@ -0,0 +1,106 @@ +//// [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.mjs] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +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 cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); +cjs; +mjs; +type; +//// [index.js] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; + + +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; +//// [index.d.ts] +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..4557791be394f --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "#mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +=== index.mjs === +// esm format file +import * as cjs from "#cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "#mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +=== index.cjs === +// esm format file +import * as cjs from "#cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "#mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + 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..37254a32db001 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -0,0 +1,78 @@ +index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + + +==== index.js (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + import * as mjsi from "inner/mjs/index"; + import * as typei from "inner/js/index"; + cjsi; + mjsi; + typei; +==== index.mjs (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + import * as mjsi from "inner/mjs/index"; + import * as typei from "inner/js/index"; + cjsi; + mjsi; + typei; +==== index.cjs (1 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index"; + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as typei from "inner/js/index"; + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index"; + import * as mjs from "inner/mjs/index"; + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./mjs/*": "./*.mjs", + "./js/*": "./*.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js new file mode 100644 index 0000000000000..79669dc7d4da8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js @@ -0,0 +1,134 @@ +//// [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] +// 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] +"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 = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(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..d6dea7356d738 --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..ab36a515a18bd --- /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 : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/index"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index"; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +typei; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +=== 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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>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 new file mode 100644 index 0000000000000..44e51033d1cc7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).errors.txt @@ -0,0 +1,123 @@ +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. + + +==== index.js (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + cjsi; + mjsi; + typei; +==== index.mjs (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + cjsi; + mjsi; + typei; +==== index.cjs (3 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + cjsi; + mjsi; + typei; +==== node_modules/inner/exclude/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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 TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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 TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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..3ba5fbbce0406 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsExclude(module=node18).js @@ -0,0 +1,137 @@ +//// [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] +// 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] +"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 = __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; + + +//// [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..dbaadfd82f599 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -0,0 +1,78 @@ +index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + + +==== index.js (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + import * as mjsi from "inner/mjs/index.mjs"; + import * as typei from "inner/js/index.js"; + cjsi; + mjsi; + typei; +==== index.mjs (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + import * as mjsi from "inner/mjs/index.mjs"; + import * as typei from "inner/js/index.js"; + cjsi; + mjsi; + typei; +==== index.cjs (1 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index.cjs"; + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + import * as typei from "inner/js/index.js"; + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + import * as type from "inner/js/index.js"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index.cjs"; + import * as mjs from "inner/mjs/index.mjs"; + import * as type from "inner/js/index.js"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + import * as type from "inner/js/index.js"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs/*.cjs": "./*.cjs", + "./mjs/*.mjs": "./*.mjs", + "./js/*.js": "./*.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js new file mode 100644 index 0000000000000..b23d73a88c0e9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js @@ -0,0 +1,134 @@ +//// [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] +// 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] +"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 = __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; + + +//// [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..5dd3851cacbbc --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..8aec22f2cab84 --- /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 : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index.js"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mjs === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index.js"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cjs === +// cjs format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index.js"; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +typei; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +=== 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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner/js/index.js"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner/js/index.js"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner/js/index.js"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>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 new file mode 100644 index 0000000000000..a4ba6ab81a73f --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).errors.txt @@ -0,0 +1,57 @@ +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. + + +==== 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"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 (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"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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..bb91ae6ef3a60 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsSynchronousCallErrors(module=node18).js @@ -0,0 +1,68 @@ +//// [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] +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +// esm format file +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"); + 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..e10d1bf1c8370 --- /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 : { 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" +> : ^^^^^^^^^^^^ + + 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 : { 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" +> : ^^^^^^^^^^^^^^^^^^^^^^ + + 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..78c93edaa0624 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).errors.txt @@ -0,0 +1,28 @@ +subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. + + +==== subfolder/index.js (2 errors) ==== + // cjs format file + const x = await 1; + ~~~~~ +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. + export {x}; + for await (const y of []) {} + ~~~~~ +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.js (0 errors) ==== + // esm format file + const x = await 1; + export {x}; + for await (const y of []) {} +==== 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..354fe725f0960 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node18).js @@ -0,0 +1,42 @@ +//// [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] +// esm format file +const x = await 1; +export { 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).js b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js new file mode 100644 index 0000000000000..f0c9198a51305 --- /dev/null +++ b/tests/baselines/reference/nodeModulesCjsFormatFileAlwaysHasDefault(module=node18).js @@ -0,0 +1,36 @@ +//// [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] +// esm format file +import mod from "./subfolder/index.js"; +mod; + + +//// [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..1ae92add000d0 --- /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 : typeof mod +> : ^^^^^^^^^^ + +mod; +>mod : typeof mod +> : ^^^^^^^^^^ + 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..41703e1cf0cc1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -0,0 +1,137 @@ +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 TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.ts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/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 (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/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 (2 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + cjs; + mjs; + type; + import * as cjsi from "inner/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; +==== node_modules/inner/index.d.ts (1 errors) ==== + // cjs format file + import * as cjs from "inner/a"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + 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; +==== node_modules/inner/index.d.mts (1 errors) ==== + // esm format file + import * as cjs from "inner/a"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + 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; +==== node_modules/inner/index.d.cts (0 errors) ==== + // 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 (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..8bf4f316a59ff --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js @@ -0,0 +1,215 @@ +//// [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.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] +"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 = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); +cjs; +mjs; +type; +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.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 new file mode 100644 index 0000000000000..07c60903e55eb --- /dev/null +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols @@ -0,0 +1,245 @@ +//// [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.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 +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.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 +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.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 +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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) + +export { type }; +>type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) + +export { ts }; +>ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) + +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(mjs.type.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(mjs.cjs, Decl(index.d.mts, 5, 8)) + +export { mjs }; +>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) + +export { type }; +>type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) + +export { ts }; +>ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) + +export const mjsSource = true; +>mjsSource : Symbol(mjs.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.cjs, Decl(index.d.cts, 5, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) + +export { type }; +>type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) + +export { ts }; +>ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) + +export const cjsSource = true; +>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 new file mode 100644 index 0000000000000..a7cb6f45bf8e8 --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/a"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/b"; +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi +> : ^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjsi +> : ^^^^^^^^^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +typei.mjsSource; +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +ts.mjsSource; +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/a"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/b"; +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi +> : ^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjsi +> : ^^^^^^^^^^^ + +cjsi.mjsSource; +>cjsi.mjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +mjsi.mjsSource; +>mjsi.mjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +typei.mjsSource; +>typei.mjsSource : true +> : ^^^^ +>typei : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +ts.mjsSource; +>ts.mjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>mjsSource : true +> : ^^^^ + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/a"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/b"; +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjsi +> : ^^^^^^^^^^^ + +cjsi.cjsSource; +>cjsi.cjsSource : true +> : ^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ + +mjsi.cjsSource; +>mjsi.cjsSource : true +> : ^^^^ +>mjsi : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ + +typei.implicitCjsSource; +>typei.implicitCjsSource : true +> : ^^^^ +>typei : typeof cjsi.type +> : ^^^^^^^^^^^^^^^^ +>implicitCjsSource : true +> : ^^^^ + +ts.cjsSource; +>ts.cjsSource : true +> : ^^^^ +>ts : typeof cjsi +> : ^^^^^^^^^^^ +>cjsSource : true +> : ^^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/b"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof mjs +> : ^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.type +> : ^^^^^^^^^^^^^^^ + +export { ts }; +>ts : typeof mjs +> : ^^^^^^^^^^ + +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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof mjs +> : ^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof mjs +> : ^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs +> : ^^^^^^^^^^ + +export { ts }; +>ts : typeof mjs +> : ^^^^^^^^^^ + +export const mjsSource = true; +>mjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/a"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/b"; +>mjs : typeof cjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ + +import * as ts from "inner/types"; +>ts : typeof cjs +> : ^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof cjs.type +> : ^^^^^^^^^^^^^^^ + +export { ts }; +>ts : typeof cjs +> : ^^^^^^^^^^ + +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..f2737ac29f32f --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).errors.txt @@ -0,0 +1,118 @@ +error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. +index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/index.d.cts(5,1): error TS1036: Statements are not allowed in ambient contexts. +node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in ambient contexts. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. + + +!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.ts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + 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 (0 errors) ==== + // 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 (3 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + export const a = cjs; + export const b = mjs; + export const c = type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as typei from "inner"; + export const d = cjsi; + export const e = mjsi; + export const f = typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as type from "inner"; + cjs; + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + mjs; + type; + export const cjsMain = true; +==== node_modules/inner/index.d.mts (1 errors) ==== + // esm format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + import * as type from "inner"; + cjs; + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + mjs; + type; + export const esm = true; +==== node_modules/inner/index.d.cts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as type from "inner"; + cjs; + ~~~ +!!! 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..58d736d2641fe --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitWithPackageExports(module=node18).js @@ -0,0 +1,212 @@ +//// [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.mjs] +// 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.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 = __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 = __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.mts] +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] +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 new file mode 100644 index 0000000000000..93d7af061919a --- /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(type.a, Decl(index.ts, 4, 12)) +>cjs : Symbol(cjs, Decl(index.ts, 1, 6)) + +export const b = mjs; +>b : Symbol(type.b, Decl(index.ts, 5, 12)) +>mjs : Symbol(mjs, Decl(index.ts, 2, 6)) + +export const c = type; +>c : Symbol(type.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(type.d, Decl(index.ts, 10, 12)) +>cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) + +export const e = mjsi; +>e : Symbol(type.e, Decl(index.ts, 11, 12)) +>mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) + +export const f = typei; +>f : Symbol(type.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(mjs.a, Decl(index.mts, 4, 12)) +>cjs : Symbol(cjs, Decl(index.mts, 1, 6)) + +export const b = mjs; +>b : Symbol(mjs.b, Decl(index.mts, 5, 12)) +>mjs : Symbol(mjs, Decl(index.mts, 2, 6)) + +export const c = type; +>c : Symbol(mjs.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(mjs.d, Decl(index.mts, 10, 12)) +>cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) + +export const e = mjsi; +>e : Symbol(mjs.e, Decl(index.mts, 11, 12)) +>mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) + +export const f = typei; +>f : Symbol(mjs.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(cjs.a, Decl(index.cts, 4, 12)) +>cjs : Symbol(cjs, Decl(index.cts, 1, 6)) + +export const b = mjs; +>b : Symbol(cjs.b, Decl(index.cts, 5, 12)) +>mjs : Symbol(mjs, Decl(index.cts, 2, 6)) + +export const c = type; +>c : Symbol(cjs.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(cjs.d, Decl(index.cts, 10, 12)) +>cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) + +export const e = mjsi; +>e : Symbol(cjs.e, Decl(index.cts, 11, 12)) +>mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) + +export const f = typei; +>f : Symbol(cjs.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(type.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(mjs.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(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 new file mode 100644 index 0000000000000..9921b0e1f5183 --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +export const a = cjs; +>a : typeof cjs +> : ^^^^^^^^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export const b = mjs; +>b : typeof mjs +> : ^^^^^^^^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export const c = type; +>c : typeof type +> : ^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +export const d = cjsi; +>d : typeof cjsi +> : ^^^^^^^^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +export const e = mjsi; +>e : typeof mjsi +> : ^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ + +export const f = typei; +>f : typeof typei +> : ^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +export const a = cjs; +>a : typeof cjs +> : ^^^^^^^^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export const b = mjs; +>b : typeof mjs +> : ^^^^^^^^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export const c = type; +>c : typeof type +> : ^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +export const d = cjsi; +>d : typeof cjsi +> : ^^^^^^^^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +export const e = mjsi; +>e : typeof mjsi +> : ^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ + +export const f = typei; +>f : typeof typei +> : ^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +export const a = cjs; +>a : typeof cjs +> : ^^^^^^^^^^ +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export const b = mjs; +>b : typeof mjs +> : ^^^^^^^^^^ +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export const c = type; +>c : typeof type +> : ^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +export const d = cjsi; +>d : typeof cjsi +> : ^^^^^^^^^^^ +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +export const e = mjsi; +>e : typeof mjsi +> : ^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ + +export const f = typei; +>f : typeof typei +> : ^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +export const cjsMain = true; +>cjsMain : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +export const esm = true; +>esm : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +export const cjsNonmain = true; +>cjsNonmain : true +> : ^^^^ +>true : true +> : ^^^^ + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js new file mode 100644 index 0000000000000..378a054d25109 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).js @@ -0,0 +1,44 @@ +//// [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] +// esm format file +export 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..18249dadabb9c --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node18).types @@ -0,0 +1,36 @@ +//// [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..edb49c7a61f05 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).errors.txt @@ -0,0 +1,23 @@ +index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + + +==== subfolder/index.ts (0 errors) ==== + // cjs format file + const a = {}; + export = a; +==== index.ts (1 errors) ==== + // esm format file + const a = {}; + export = a; + ~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js new file mode 100644 index 0000000000000..2d09438ae7cd8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node18).js @@ -0,0 +1,38 @@ +//// [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] +// esm format file +const a = {}; +export {}; + + +//// [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..7e86097227b3b --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).errors.txt @@ -0,0 +1,33 @@ +index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. + + +==== index.ts (2 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. + export const a = (await import("inner")).x(); + ~ +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. +==== 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..da6fe0fc80095 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).js @@ -0,0 +1,30 @@ +//// [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] +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 new file mode 100644 index 0000000000000..91fce59692fb1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node18).symbols @@ -0,0 +1,27 @@ +//// [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)) +>(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 +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..dc944e2b96ae6 --- /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 : 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 : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== 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..a0ed330173ed8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).errors.txt @@ -0,0 +1,92 @@ +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 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 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 (3 errors) ==== + import {} from "exports-and-types-versions/foo"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. + import {} from "exports-and-types-versions/yep"; + import {} from "exports-and-types-versions/versioned-yep"; + import {} from "exports-and-types-versions/versioned-nah"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. + import {} from "just-types-versions/foo"; + +==== /main.mts (3 errors) ==== + import {} from "exports-and-types-versions/foo"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. + import {} from "exports-and-types-versions/yep"; + import {} from "exports-and-types-versions/versioned-yep"; + import {} from "exports-and-types-versions/versioned-nah"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. + import {} from "just-types-versions/foo"; + \ 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..396ca2dfc4bcc --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).js @@ -0,0 +1,70 @@ +//// [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] +export {}; 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..b75c764ff9c7c --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsBlocksTypesVersions(module=node18).trace.json @@ -0,0 +1,1080 @@ +[ + "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 '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.", + "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 '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 '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 '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 '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 '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'. ========", + "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'. ========", + "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'. ========", + "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'. ========", + "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'. ========", + "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'. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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/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..358a0e61437a1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).errors.txt @@ -0,0 +1,34 @@ +index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. + + +==== index.ts (2 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. + export const a = (await import("inner")).x(); + ~ +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. + import {a as a2} from "package"; +==== 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..b6f1adda8d33c --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).js @@ -0,0 +1,44 @@ +//// [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" +} + +//// [other.js] +export const x = null; +//// [index.js] +// esm format file +export { x } from "./other.js"; +//// [index.js] +export const a = (await import("inner")).x(); + + +//// [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..182723309687c --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node18).symbols @@ -0,0 +1,31 @@ +//// [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)) +>(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 === +// 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..880b84aad2d77 --- /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 : 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 : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +import {a as a2} from "package"; +>a : import("node_modules/inner/other").Thing +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>a2 : import("node_modules/inner/other").Thing +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +=== 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..08ce05322d3bc --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).errors.txt @@ -0,0 +1,37 @@ +index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. + + +==== index.ts (1 errors) ==== + // esm format file + import { Thing } from "inner/other.js"; // should fail + ~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. + export const a = (await import("inner")).x(); +==== 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..5db58ae2f7bfa --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).js @@ -0,0 +1,41 @@ +//// [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] +export const a = (await import("inner")).x(); + + +//// [index.d.ts] +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 new file mode 100644 index 0000000000000..d429eab9b497f --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node18).symbols @@ -0,0 +1,27 @@ +//// [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)) +>(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 +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..d62dfd1155d03 --- /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 : 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 : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== 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..f7015dbf604c1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).errors.txt @@ -0,0 +1,32 @@ +index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. + + +==== index.ts (1 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. + export const a = (await import("inner/index.js")).x(); +==== 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..c0d6b006b33cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).js @@ -0,0 +1,36 @@ +//// [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] +export const a = (await import("inner/index.js")).x(); + + +//// [index.d.ts] +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 new file mode 100644 index 0000000000000..6fd6d1a29cedd --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node18).symbols @@ -0,0 +1,27 @@ +//// [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)) +>(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 +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..034994f0ff8bb --- /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 : 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 : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== 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..002881ca1c0e7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).errors.txt @@ -0,0 +1,32 @@ +index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. + + +==== index.ts (1 errors) ==== + // esm format file + import { Thing } from "inner/other"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. + export const a = (await import("inner/index.js")).x(); +==== 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..dcdd62bed698d --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).js @@ -0,0 +1,36 @@ +//// [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] +export const a = (await import("inner/index.js")).x(); + + +//// [index.d.ts] +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 new file mode 100644 index 0000000000000..7429733b3c4f6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node18).symbols @@ -0,0 +1,27 @@ +//// [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)) +>(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 +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..78367ad6e9714 --- /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 : 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 : () => import("node_modules/inner/other").Thing +> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ + +=== 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..e338028b93522 --- /dev/null +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).errors.txt @@ -0,0 +1,139 @@ +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. + + +==== 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..4cca6af5a58d7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesForbidenSyntax(module=node18).js @@ -0,0 +1,172 @@ +//// [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] +// esm format file +const x = () => (void 0); +export { 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] +// esm format file +const x = () => (void 0); +export { x }; +//// [index.js] +// esm format file +const x = () => (void 0); +export { x }; +//// [index.mjs] +// esm format file +const x = () => (void 0); +export { 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] +// esm format file +const x = () => (void 0); +export { 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] +// esm format file +const x = () => (void 0); +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.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..fe89fc2f3863b --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).errors.txt @@ -0,0 +1,38 @@ +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. + + +==== 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 + 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..3b196cd32c98b --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node18).js @@ -0,0 +1,64 @@ +//// [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] +// esm format file +function require() { } +const exports = {}; +class Object { +} +export 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 }; +//// [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..b1d54f8e2145b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt @@ -0,0 +1,16 @@ +otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + + +==== index.ts (0 errors) ==== + import json from "./package.json" assert { type: "json" }; +==== otherc.cts (1 errors) ==== + import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + 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..091166d523cd1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js @@ -0,0 +1,20 @@ +//// [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] +export {}; +//// [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..9780c35bba0cc --- /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 : { 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 : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>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).js b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js new file mode 100644 index 0000000000000..c73ff1177a58e --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).js @@ -0,0 +1,65 @@ +//// [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] +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +// esm format file +const fs = __require("fs"); +fs.readFile; +const fs2 = __require("fs"); +export { fs2 }; +//// [file.js] +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_1("fs"); +fs.readFile; +const fs2 = __require_1("fs"); +export { fs2 }; + + +//// [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..f73668aaa7a8f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node18).types @@ -0,0 +1,63 @@ +//// [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..8f85517984cb6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).errors.txt @@ -0,0 +1,17 @@ +otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + + +==== index.ts (0 errors) ==== + import json from "./package.json" with { type: "json" }; +==== otherc.cts (1 errors) ==== + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! 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..fb3984fd32c68 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node18).js @@ -0,0 +1,21 @@ +//// [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] +export {}; +//// [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..6f07805d83b53 --- /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 : { 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 : { name: string; private: boolean; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>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..bf4698ad28e95 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,37 @@ +/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. + + +==== /index.ts (3 errors) ==== + 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" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error 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" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +==== /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..b2c93c67d55e4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,40 @@ +//// [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" }; +>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" }; +>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)) + +=== /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 new file mode 100644 index 0000000000000..107dc1327d766 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +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 : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>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=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..5c93150f88f13 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt @@ -0,0 +1,42 @@ +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. + + +==== /index.ts (3 errors) ==== + 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" }; + ~~~~~~~~~~~~~~~~ +!!! 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 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" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +==== /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..afe399f85b0ad --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).js @@ -0,0 +1,49 @@ +//// [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] +export {}; + + +//// [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..d76777ff60b36 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).symbols @@ -0,0 +1,40 @@ +//// [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" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) +>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)) + +=== /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 new file mode 100644 index 0000000000000..79bd80a1c7f46 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +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 : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>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=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..c45ca1322b3a8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt @@ -0,0 +1,43 @@ +/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + + +==== /index.ts (5 errors) ==== + // incorrect mode + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error 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 TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + + 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..33a5f17944412 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).symbols @@ -0,0 +1,30 @@ +//// [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" }; +>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 {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + + + + +=== /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 new file mode 100644 index 0000000000000..d432212769fe8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +// 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 {} + + + + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} 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..1f0e1652f5505 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).symbols @@ -0,0 +1,28 @@ +//// [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 +>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 new file mode 100644 index 0000000000000..1c9297e238011 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>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 : 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 : 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 new file mode 100644 index 0000000000000..2d2f2c5b8ffbb --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt @@ -0,0 +1,308 @@ +/index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. +/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,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other.ts(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. +/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,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. +/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,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/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,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/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,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other3.ts(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,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,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,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. +/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other4.ts(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,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,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/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,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'. + + +==== /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 (2 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + +==== /other.ts (27 errors) ==== + // missing with: + export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + ~~~~~~~~~~~~~~~ +!!! 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. + ~ +!!! 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 TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~~~~~~~~~~~ +!!! 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. + ~ +!!! 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 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. + ~ +!!! 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 (6 errors) ==== + // wrong attribute key + export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + ~~~~~ +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + ~~~~~ +!!! 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 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 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 (16 errors) ==== + // Array instead of object-y thing + export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + ~~~~~~~~~~~~~ +!!! 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~~~~~~~~~ +!!! 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + +==== /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 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. + ~~~~~~~~~~ +!!! 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 TS2448: Block-scoped variable 'Attribute2' used before its declaration. +!!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", Attribute1).RequireInterface); + ~~~~~~~~~~~~~ +!!! 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. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", Attribute2).ImportInterface); + ~~~~~~~~~~~~~ +!!! 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. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + +==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + ~~ +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. + & import("pkg", { with: {} }).ImportInterface; + ~~ +!!! 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 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 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).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..8a23a85dd4673 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).symbols @@ -0,0 +1,130 @@ +//// [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 +>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: +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other.ts, 0, 0)) + + & 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); +>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 +>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)) + +=== /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; +>"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); +>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; +>"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); +>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 +>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 new file mode 100644 index 0000000000000..c1e5b7e23e6a1 --- /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 : 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 : 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 : 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 +> : ^^^ + +=== /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<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"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 : 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 +> : ^^^ + +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<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"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<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"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 : 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 +> : ^^^ + +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..05c2a81067dde --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).errors.txt @@ -0,0 +1,36 @@ +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'. + + +==== 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 + 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..4712d65a0999e --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node18).js @@ -0,0 +1,52 @@ +//// [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 }); +const tslib_1 = require("tslib"); +// cjs format file +const fs_1 = tslib_1.__importDefault(require("fs")); +fs_1.default.readFile; +const fs = tslib_1.__importStar(require("fs")); +fs.readFile; +//// [index.js] +// esm format file +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "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..176b3d13fe10e --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).errors.txt @@ -0,0 +1,32 @@ +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'. + + +==== 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"; + 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..c058d00e216e0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node18).js @@ -0,0 +1,47 @@ +//// [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"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +const tslib_1 = require("tslib"); +// cjs format file +tslib_1.__exportStar(require("fs"), exports); +exports.fs = tslib_1.__importStar(require("fs")); +//// [index.js] +// esm format file +export * from "fs"; +export * as fs from "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..a5f7cf4be1399 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).errors.txt @@ -0,0 +1,27 @@ +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 (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"; +==== 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..381f1b8ba964b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node18).js @@ -0,0 +1,42 @@ +//// [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; +var tslib_1 = require("tslib"); +// cjs format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); +//// [index.js] +// esm format file +export { default } from "fs"; + + +//// [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..dc4849ff5093c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).errors.txt @@ -0,0 +1,23 @@ +subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +==== subfolder/index.ts (1 errors) ==== + // cjs format file + const x = import.meta.url; + ~~~~~~~~~~~ +!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + export {x}; +==== index.ts (0 errors) ==== + // esm format file + const x = import.meta.url; + export {x}; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node18).js b/tests/baselines/reference/nodeModulesImportMeta(module=node18).js new file mode 100644 index 0000000000000..aa962a90bd346 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node18).js @@ -0,0 +1,40 @@ +//// [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] +// esm format file +const x = import.meta.url; +export { 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..e77140972a1ce --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,37 @@ +/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. + + +==== /index.ts (3 errors) ==== + 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" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error 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" }; + export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + +==== /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..97a76656c4050 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,40 @@ +//// [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" }; +>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" }; +>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)) + +=== /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 new file mode 100644 index 0000000000000..27ce52d60a048 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +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 : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>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=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..47c2ad040c0db --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt @@ -0,0 +1,42 @@ +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. + + +==== /index.ts (3 errors) ==== + 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" }; + ~~~~~~~~~~~~~~~~ +!!! 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 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" }; + export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + +==== /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..fad19d466a6ac --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js @@ -0,0 +1,49 @@ +//// [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] +export {}; + + +//// [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..8d280aee6ffa1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols @@ -0,0 +1,40 @@ +//// [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" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) +>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)) + +=== /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 new file mode 100644 index 0000000000000..60e006fe4390a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : ImportInterface +> : ^^^^^^^^^^^^^^^ + +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 : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +>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=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..e1be07261876a --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt @@ -0,0 +1,43 @@ +/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + + +==== /index.ts (5 errors) ==== + // incorrect mode + import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error 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 TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + + 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..b209c65c177c1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols @@ -0,0 +1,30 @@ +//// [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" }; +>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 {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 115)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + + + + +=== /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 new file mode 100644 index 0000000000000..b9bc7c1552479 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +>RequireInterface : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +// 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 {} + + + + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js new file mode 100644 index 0000000000000..a60b20a63d224 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionIntoExport(module=node18).js @@ -0,0 +1,80 @@ +//// [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.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 = __importStar(require("#type")); +type; +//// [index.js] +// esm format file +import * as type from "#type"; +type; +//// [index.mjs] +// esm format file +import * as type from "#type"; +type; + + +//// [index.d.cts] +export {}; +//// [index.d.ts] +export {}; +//// [index.d.mts] +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..594635bc9aee3 --- /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 : typeof type +> : ^^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +=== index.cts === +// esm format file +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + 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..01d8a2fd08354 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).errors.txt @@ -0,0 +1,33 @@ +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. + + +==== index.ts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! 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 TS2307: Cannot find module '#type' or its corresponding type declarations. + type; +==== index.cts (1 errors) ==== + // esm format file + import * as type from "#type"; + ~~~~~~~ +!!! error TS2307: Cannot find module '#type' or its corresponding type declarations. + 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..fa6401e1a49a4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportResolutionNoCycle(module=node18).js @@ -0,0 +1,80 @@ +//// [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] +// esm format file +import * as type from "#type"; +type; +//// [index.mjs] +// esm format file +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 = __importStar(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).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js new file mode 100644 index 0000000000000..6c0a3531fac79 --- /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: 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 new file mode 100644 index 0000000000000..7558565243724 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,28 @@ +//// [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 +>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 new file mode 100644 index 0000000000000..87c7913723785 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/node/nodeModulesImportTypeModeDeclarationEmit1.ts] //// + +=== /index.ts === +export type LocalInterface = +>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 : 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 : 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 new file mode 100644 index 0000000000000..5172f49a5c8cd --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -0,0 +1,302 @@ +/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/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,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other.ts(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. +/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,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. +/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,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/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,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/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,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other3.ts(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,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,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,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. +/other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other4.ts(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,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,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/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,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'. + + +==== /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 (2 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); +==== /other.ts (27 errors) ==== + // missing assert: + export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + ~~~~~~~~~~~~~~~ +!!! 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. + ~ +!!! 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 TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~~~~~~~~~~~ +!!! 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. + ~ +!!! 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 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. + ~ +!!! 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 (6 errors) ==== + // wrong assertion key + export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface + ~~~~~ +!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; + ~~~~~ +!!! 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 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 TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +==== /other3.ts (16 errors) ==== + // Array instead of object-y thing + export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + ~~~~~~~~~~~~~ +!!! 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~~~~~~~~~ +!!! 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. +==== /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 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. + ~~~~~~~~ +!!! 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 TS2448: Block-scoped variable 'Asserts2' used before its declaration. +!!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", Asserts1).RequireInterface); + ~~~~~~~~~~~~~ +!!! 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. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", Asserts2).ImportInterface); + ~~~~~~~~~~~~~ +!!! 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. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. +==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface + ~~ +!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + & import("pkg", { assert: {} }).ImportInterface; + ~~ +!!! 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 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 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 new file mode 100644 index 0000000000000..813770edf9748 --- /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: 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: import("pkg").RequireInterface; +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: 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 new file mode 100644 index 0000000000000..ea0f4216cd5c7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).symbols @@ -0,0 +1,130 @@ +//// [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 +>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: +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other.ts, 0, 0)) + + & 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); +>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 +>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)) + +=== /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; +>"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); +>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; +>"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); +>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 +>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 new file mode 100644 index 0000000000000..a38ebca6a3f1d --- /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 : 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 : 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 : 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 +> : ^^^ + +=== /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<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"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 : 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 +> : ^^^ + +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<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"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<{ default: typeof import("/node_modules/pkg/import"); }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>"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 : 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 +> : ^^^ + +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 ec8512329307c..8977f188ced9e 100644 --- a/tests/baselines/reference/nodeModulesJson(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesJson(module=node16).errors.txt @@ -1,11 +1,11 @@ -/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(9,47): 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(9,47): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node16'. -/main.mts(10,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. -/main.mts(11,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +/main.mts(10,41): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/main.mts(11,42): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. @@ -50,23 +50,23 @@ 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 type config2Type from "./config.json"; // Ok, type-only import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import { version } from "./config.json" with { type: "json" }; // Error, named import ~~~~~~~ !!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node16'. ~~~~~~~~~~~~~~~~~~~~~ -!!! error 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; }; }'. @@ -75,7 +75,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..4ba7849c2d719 --- /dev/null +++ b/tests/baselines/reference/nodeModulesJson(module=node18).errors.txt @@ -0,0 +1,83 @@ +/loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. +/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. +/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. +/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. +/main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports. +/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node18'. +/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. + + +==== /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 + import moreOops from "actually-json"; // Error in nodenext + ~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. + import typed from "actually-json/typed"; // Error in nodenext + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node18'. + + 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 type config2Type from "./config.json"; // Ok, type-only + import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. + 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 (2 errors) ==== + import config from "./config.json" with { type: "json" }; // Error + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + import config2 from "./config.json"; // Ok + 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..52d983d5b9516 --- /dev/null +++ b/tests/baselines/reference/nodeModulesJson(module=node18).symbols @@ -0,0 +1,85 @@ +//// [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/index.json === + +{} + +=== /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 type config2Type from "./config.json"; // Ok, type-only +>config2Type : Symbol(config2Type, Decl(main.mts, 7, 6)) + +import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports +>config2Type2 : Symbol(config2Type2, Decl(main.mts, 8, 6)) + +import { version } from "./config.json" with { type: "json" }; // Error, named import +>version : Symbol(version, Decl(main.mts, 9, 8)) + +import * as config3 from "./config.json" with { type: "json" }; +>config3 : Symbol(config3, Decl(main.mts, 10, 6)) + +config3.version; // Error +>config3 : Symbol(config3, Decl(main.mts, 10, 6)) + +config3.default; // Ok +>config3.default : Symbol("/config") +>config3 : Symbol(config3, Decl(main.mts, 10, 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..37ac9a196dd4e --- /dev/null +++ b/tests/baselines/reference/nodeModulesJson(module=node18).types @@ -0,0 +1,139 @@ +//// [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/index.json === +{} +>{} : {} +> : ^^ + +=== /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 : (json: string) => any +> : ^ ^^ ^^^^^ + +import moreOops from "actually-json"; // Error in nodenext +>moreOops : {} +> : ^^ + +import typed from "actually-json/typed"; // Error in nodenext +>typed : typeof typed +> : ^^^^^^^^^^^^ + +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 type config2Type from "./config.json"; // Ok, type-only +>config2Type : any +> : ^^^ + +import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports +>config2Type2 : any +> : ^^^ +>type : any +> : ^^^ + +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 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ +>type : any +> : ^^^ + +import config2 from "./config.json"; // Ok +>config2 : { version: number; } +> : ^^^^^^^^^^^^^^^^^^^^ + +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..1c28214a47363 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt @@ -0,0 +1,109 @@ +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 TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +==== index.ts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + import * as typei from "inner"; + cjsi; + mjsi; + typei; +==== index.mts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + import * as type from "package"; + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + import * as typei from "inner"; + cjsi; + mjsi; + typei; +==== index.cts (3 errors) ==== + // cjs format file + import * as cjs from "package/cjs"; + import * as mjs from "package/mjs"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. + import * as type from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + cjs; + mjs; + type; + import * as cjsi from "inner/cjs"; + import * as mjsi from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as typei from "inner"; + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as type from "inner"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + import * as type from "inner"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs"; + import * as mjs from "inner/mjs"; + ~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. + import * as type from "inner"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js new file mode 100644 index 0000000000000..7d1a5738c7346 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js @@ -0,0 +1,175 @@ +//// [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.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] +"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 = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); +cjs; +mjs; +type; +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); +cjsi; +mjsi; +typei; +//// [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.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 new file mode 100644 index 0000000000000..9e1ccdd9c0683 --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..536830b78cd02 --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cts === +// cjs format file +import * as cjs from "package/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "package/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "package"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +import * as cjsi from "inner/cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs"; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +import * as typei from "inner"; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +typei; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.ts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : any +> : ^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>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 new file mode 100644 index 0000000000000..1599e814addf0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).errors.txt @@ -0,0 +1,44 @@ +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. + + +==== index.ts (0 errors) ==== + // esm format file + import * as cjs from "#cjs"; + import * as mjs from "#mjs"; + import * as type from "#type"; + cjs; + mjs; + type; +==== index.mts (0 errors) ==== + // esm format file + import * as cjs from "#cjs"; + import * as mjs from "#mjs"; + import * as type from "#type"; + cjs; + mjs; + type; +==== index.cts (2 errors) ==== + // esm format file + import * as cjs from "#cjs"; + import * as mjs from "#mjs"; + ~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#mjs")' call instead. + import * as type from "#type"; + ~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("#type")' call instead. + cjs; + mjs; + type; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js", + "imports": { + "#cjs": "./index.cjs", + "#mjs": "./index.mjs", + "#type": "./index.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackageImports(module=node18).js b/tests/baselines/reference/nodeModulesPackageImports(module=node18).js new file mode 100644 index 0000000000000..c25d1005e93d5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).js @@ -0,0 +1,106 @@ +//// [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.mjs] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +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 cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); +cjs; +mjs; +type; +//// [index.js] +// esm format file +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; +cjs; +mjs; +type; + + +//// [index.d.mts] +export {}; +//// [index.d.cts] +export {}; +//// [index.d.ts] +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..1fc306a0c6b64 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackageImports(module=node18).trace.json @@ -0,0 +1,992 @@ +[ + "Found 'package.json' at '/.src/package.json'.", + "======== Resolving module '#cjs' from '/.src/index.ts'. ========", + "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 '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 '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 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 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 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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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 new file mode 100644 index 0000000000000..7cddffea56c0b --- /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 : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "#mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as cjs from "#cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "#mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + +=== index.cts === +// esm format file +import * as cjs from "#cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "#mjs"; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "#type"; +>type : typeof type +> : ^^^^^^^^^^^ + +cjs; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +mjs; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +type; +>type : typeof type +> : ^^^^^^^^^^^ + 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..624ebe117783b --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -0,0 +1,78 @@ +index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + + +==== index.ts (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + import * as mjsi from "inner/mjs/index"; + import * as typei from "inner/js/index"; + cjsi; + mjsi; + typei; +==== index.mts (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index"; + import * as mjsi from "inner/mjs/index"; + import * as typei from "inner/js/index"; + cjsi; + mjsi; + typei; +==== index.cts (1 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index"; + import * as mjsi from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as typei from "inner/js/index"; + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index"; + import * as mjs from "inner/mjs/index"; + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./mjs/*": "./*.mjs", + "./js/*": "./*.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js new file mode 100644 index 0000000000000..f710ad1fe43f2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js @@ -0,0 +1,134 @@ +//// [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] +// 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] +"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 = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(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..40ff4714e8e00 --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..8de436002a1fa --- /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 : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/index"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/index"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index"; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index"; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +typei; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +=== 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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>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 new file mode 100644 index 0000000000000..fd89603b91a5c --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -0,0 +1,177 @@ +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. + + +==== index.ts (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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 (3 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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 (4 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjsi from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as typei from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + cjsi; + mjsi; + typei; + import * as cjsi2 from "inner/cjs/index"; + import * as mjsi2 from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as typei2 from "inner/js/index"; + cjsi2; + mjsi2; + typei2; +==== node_modules/inner/exclude/index.d.ts (3 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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 TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + 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 TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. + import * as mjs from "inner/mjs/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. + import * as type from "inner/js/exclude/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index"; + import * as mjs from "inner/mjs/index"; + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index"; + import * as mjs from "inner/mjs/index"; + ~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. + import * as type from "inner/js/index"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs/*": "./*.cjs", + "./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..5fe735dbc37b1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js @@ -0,0 +1,197 @@ +//// [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] +// 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.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; +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 = __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 = __importStar(require("inner/cjs/index")); +const mjsi2 = __importStar(require("inner/mjs/index")); +const typei2 = __importStar(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..fd0ed5715baab --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..b94e493366d49 --- /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 : typeof cjsi2 +> : ^^^^^^^^^^^^ + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ + +import * as typei2 from "inner/js/index"; +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ + +cjsi2; +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ + +mjsi2; +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ + +typei2; +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ + +=== 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 : typeof cjsi2 +> : ^^^^^^^^^^^^ + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ + +import * as typei2 from "inner/js/index"; +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ + +cjsi2; +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ + +mjsi2; +>mjsi2 : typeof cjsi2.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^^ + +typei2; +>typei2 : typeof typei2 +> : ^^^^^^^^^^^^^ + +=== 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 : typeof cjsi2 +> : ^^^^^^^^^^^^ + +import * as mjsi2 from "inner/mjs/index"; +>mjsi2 : typeof cjsi2.mjs +> : ^^^^^^^^^^^^^^^^ + +import * as typei2 from "inner/js/index"; +>typei2 : typeof cjsi2.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi2; +>cjsi2 : typeof cjsi2 +> : ^^^^^^^^^^^^ + +mjsi2; +>mjsi2 : typeof cjsi2.mjs +> : ^^^^^^^^^^^^^^^^ + +typei2; +>typei2 : typeof cjsi2.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^^ + +=== 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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner/js/index"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>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 new file mode 100644 index 0000000000000..0ec3660afe010 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -0,0 +1,78 @@ +index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. +node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + + +==== index.ts (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + import * as mjsi from "inner/mjs/index.mjs"; + import * as typei from "inner/js/index.js"; + cjsi; + mjsi; + typei; +==== index.mts (0 errors) ==== + // esm format file + import * as cjsi from "inner/cjs/index.cjs"; + import * as mjsi from "inner/mjs/index.mjs"; + import * as typei from "inner/js/index.js"; + cjsi; + mjsi; + typei; +==== index.cts (1 errors) ==== + // cjs format file + import * as cjsi from "inner/cjs/index.cjs"; + import * as mjsi from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + import * as typei from "inner/js/index.js"; + cjsi; + mjsi; + typei; +==== node_modules/inner/index.d.ts (2 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + ~~~ +!!! error TS2303: Circular definition of import alias 'cjs'. + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + import * as type from "inner/js/index.js"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + import * as cjs from "inner/cjs/index.cjs"; + import * as mjs from "inner/mjs/index.mjs"; + import * as type from "inner/js/index.js"; + export { cjs }; + export { mjs }; + export { type }; +==== node_modules/inner/index.d.cts (1 errors) ==== + // cjs format file + import * as cjs from "inner/cjs/index.cjs"; + import * as mjs from "inner/mjs/index.mjs"; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. + import * as type from "inner/js/index.js"; + export { cjs }; + export { mjs }; + export { type }; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + } +==== node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs/*.cjs": "./*.cjs", + "./mjs/*.mjs": "./*.mjs", + "./js/*.js": "./*.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js new file mode 100644 index 0000000000000..18a9e37f040a1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js @@ -0,0 +1,134 @@ +//// [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] +// 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] +"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 = __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; + + +//// [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..99d90e029a57c --- /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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) + +export { mjs }; +>mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) + +export { type }; +>type : Symbol(mjs.cjs.cjs.type.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.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) + +export { type }; +>type : Symbol(cjs.cjs.mjs.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.cjs, Decl(index.d.cts, 4, 8)) + +export { mjs }; +>mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) + +export { type }; +>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 new file mode 100644 index 0000000000000..4d02f9365e312 --- /dev/null +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -0,0 +1,1055 @@ +[ + "Found 'package.json' at '/.src/package.json'.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.ts'. ========", + "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 '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 '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 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 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 successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", + "======== Resolving module 'inner/cjs/index.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.", + "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'. ========", + "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'. ========", + "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'. ========", + "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/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 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 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 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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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.", + "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. ========", + "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 new file mode 100644 index 0000000000000..c11fe2feb146f --- /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 : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index.js"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index.js"; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^^ + +typei; +>typei : typeof typei +> : ^^^^^^^^^^^^ + +=== index.cts === +// cjs format file +import * as cjsi from "inner/cjs/index.cjs"; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +import * as mjsi from "inner/mjs/index.mjs"; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +import * as typei from "inner/js/index.js"; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +cjsi; +>cjsi : typeof cjsi +> : ^^^^^^^^^^^ + +mjsi; +>mjsi : typeof cjsi.mjs +> : ^^^^^^^^^^^^^^^ + +typei; +>typei : typeof cjsi.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^^ + +=== 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 : typeof mjs +> : ^^^^^^^^^^ + +import * as type from "inner/js/index.js"; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : any +> : ^^^ + +export { mjs }; +>mjs : typeof mjs +> : ^^^^^^^^^^ + +export { type }; +>type : typeof mjs.cjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.mts === +// esm format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +import * as type from "inner/js/index.js"; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.cjs.mjs +> : ^^^^^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.cjs.mjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +=== node_modules/inner/index.d.cts === +// cjs format file +import * as cjs from "inner/cjs/index.cjs"; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +import * as mjs from "inner/mjs/index.mjs"; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +import * as type from "inner/js/index.js"; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + +export { cjs }; +>cjs : typeof cjs +> : ^^^^^^^^^^ + +export { mjs }; +>mjs : typeof cjs.mjs +> : ^^^^^^^^^^^^^^ + +export { type }; +>type : typeof cjs.mjs.cjs.type +> : ^^^^^^^^^^^^^^^^^^^^^^^ + 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).js b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js new file mode 100644 index 0000000000000..09afe3776dcb2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).js @@ -0,0 +1,130 @@ +//// [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] +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 = __importDefault(require("./package.json")); +exports.name = package_json_1.default.name; +const ns = __importStar(require("./package.json")); +exports.thing = ns; +exports.name2 = ns.default.name; +//// [index.mjs] +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: string; +export declare const thing: { + default: { + name: string; + version: string; + type: string; + default: string; + }; +}; +export declare const name2: string; +//// [index.d.cts] +export declare const name: string; +export declare const thing: { + default: { + name: string; + version: string; + type: string; + default: string; + }; + name: string; + version: string; + type: string; +}; +export declare const name2: string; +//// [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..e38476567ace3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).symbols @@ -0,0 +1,91 @@ +//// [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.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)) + +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.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") +>ns : Symbol(ns, Decl(index.ts, 2, 6)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) + +=== 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.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)) + +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.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") +>ns : Symbol(ns, Decl(index.cts, 2, 6)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) + +=== 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..aa041b8d125eb --- /dev/null +++ b/tests/baselines/reference/nodeModulesResolveJsonModule(module=node18).types @@ -0,0 +1,152 @@ +//// [tests/cases/conformance/node/nodeModulesResolveJsonModule.ts] //// + +=== index.ts === +import pkg from "./package.json" with { type: "json" }; +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>type : error + +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 : error + +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 +> : ^^^^^^ + +=== index.cts === +import pkg from "./package.json"; +>pkg : { name: string; version: string; type: string; default: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +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"; +>ns : { default: { name: string; version: string; type: string; default: string; }; name: string; version: string; type: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +export const thing = ns; +>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 : 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 : error + +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 : error + +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..44537a76c954c --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).errors.txt @@ -0,0 +1,45 @@ +index.ts(3,22): error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. +subfolder/index.ts(2,17): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. + To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. +subfolder/index.ts(3,22): error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + + +==== subfolder/index.ts (2 errors) ==== + // cjs format file + import {h} from "../index.js"; + ~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead. +!!! error TS1479: To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. + import mod = require("../index.js"); + ~~~~~~~~~~~~~ +!!! error TS1471: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import {f as _f} from "./index.js"; + import mod2 = require("./index.js"); + export async function f() { + const mod3 = await import ("../index.js"); + const mod4 = await import ("./index.js"); + h(); + } +==== index.ts (1 errors) ==== + // esm format file + import {h as _h} from "./index.js"; + import mod = require("./index.js"); + ~~~~~~~~~~~~ +!!! error TS1471: Module './index.js' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. + import {f} from "./subfolder/index.js"; + import mod2 = require("./subfolder/index.js"); + export async function h() { + const mod3 = await import ("./index.js"); + const mod4 = await import ("./subfolder/index.js"); + f(); + } +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js new file mode 100644 index 0000000000000..f317196b7b330 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node18).js @@ -0,0 +1,59 @@ +//// [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] +import { f } from "./subfolder/index.js"; +export async function h() { + const mod3 = await import("./index.js"); + const mod4 = await import("./subfolder/index.js"); + 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..508587cdb1aa9 --- /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 : { 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" +> : ^^^^^^^^^^^^ + + 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 : { 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" +> : ^^^^^^^^^^^^^^^^^^^^^^ + + 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..0fd2e5390cdaf --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).errors.txt @@ -0,0 +1,28 @@ +subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. + + +==== subfolder/index.ts (2 errors) ==== + // cjs format file + const x = await 1; + ~~~~~ +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. + export {x}; + for await (const y of []) {} + ~~~~~ +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.ts (0 errors) ==== + // esm format file + const x = await 1; + export {x}; + for await (const y of []) {} +==== 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..8d33777f0c4e7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node18).js @@ -0,0 +1,44 @@ +//// [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] +// esm format file +const x = await 1; +export { 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).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..e9ef3b7f0b67f --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.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/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types new file mode 100644 index 0000000000000..12d57f77e6462 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node18).types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit1.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/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js new file mode 100644 index 0000000000000..86c97ee2d0bdf --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).js @@ -0,0 +1,39 @@ +//// [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] +/// +export {}; + + +//// [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..dfccc41309458 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.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/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types new file mode 100644 index 0000000000000..fddc105efb549 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node18).types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit2.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/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js new file mode 100644 index 0000000000000..a8890a9178cb4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node18).js @@ -0,0 +1,39 @@ +//// [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] +/// +export {}; + + +//// [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).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).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).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js new file mode 100644 index 0000000000000..a4f6401e19790 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).js @@ -0,0 +1,53 @@ +//// [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"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const uses_js_1 = __importDefault(require("./uses.js")); +exports.default = uses_js_1.default; + + +//// [uses.d.ts] +/// +declare const _default: RequireInterface; +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..5b4a63b24e6f4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).symbols @@ -0,0 +1,27 @@ +//// [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)) + +=== /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 new file mode 100644 index 0000000000000..79de08e8be8c3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node18).types @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeDeclarationEmit6.ts] //// + +=== /index.ts === +import obj from "./uses.js" +>obj : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +export default (obj as typeof obj); +>(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() : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>getInterR : () => RequireInterface +> : ^^^^^^ + diff --git a/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js new file mode 100644 index 0000000000000..e6134a89881bc --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).js @@ -0,0 +1,139 @@ +//// [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] +/// +export default getInterI(); +//// [uses.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// +exports.default = getInterR(); +//// [index.js] +// 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]; + + +//// [uses.d.ts] +/// +declare const _default: ImportInterface; +export default _default; +//// [uses.d.ts] +/// +declare const _default: RequireInterface; +export default _default; +//// [index.d.ts] +declare const _default: readonly [ImportInterface, RequireInterface]; +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 new file mode 100644 index 0000000000000..26fb30363849d --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).symbols @@ -0,0 +1,53 @@ +//// [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.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) + +=== /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(); +>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 new file mode 100644 index 0000000000000..478e6741c1467 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node18).types @@ -0,0 +1,68 @@ +//// [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 : ImportInterface +> : ^^^^^^^^^^^^^^^ + +import obj2 from "./sub2/uses.js" +>obj2 : typeof obj2 +> : ^^^^^^^^^^^ + +export default [obj1, obj2.default] as const; +>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>obj1 : ImportInterface +> : ^^^^^^^^^^^^^^^ +>obj2.default : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>obj2 : typeof obj2 +> : ^^^^^^^^^^^ +>default : RequireInterface +> : ^^^^^^^^^^^^^^^^ + +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global +> : ^^^^^^^^^^^^^ + + interface ImportInterface { _i: any; } +>_i : any + + function getInterI(): ImportInterface; +>getInterI : () => ImportInterface +> : ^^^^^^ +} +=== /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() : ImportInterface +> : ^^^^^^^^^^^^^^^ +>getInterI : () => ImportInterface +> : ^^^^^^ + +=== /sub2/uses.ts === +/// +export default getInterR(); +>getInterR() : RequireInterface +> : ^^^^^^^^^^^^^^^^ +>getInterR : () => RequireInterface +> : ^^^^^^ + 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..c9a6ac79317f9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).errors.txt @@ -0,0 +1,29 @@ +/index.ts(2,1): error TS2304: Cannot find name 'foo'. + + +==== /index.ts (1 errors) ==== + /// + foo; + ~~~ +!!! error TS2304: Cannot find name 'foo'. + bar; // bar should resolve while foo should not, since index.js 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; + } \ 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..0959d385ada08 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).symbols @@ -0,0 +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 new file mode 100644 index 0000000000000..a9b87eb30959c --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride1(module=node18).types @@ -0,0 +1,23 @@ +//// [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 : 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 new file mode 100644 index 0000000000000..13991aa13538a --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).errors.txt @@ -0,0 +1,34 @@ +/index.ts(3,1): error TS2304: Cannot find name 'bar'. + + +==== /index.ts (1 errors) ==== + /// + foo; // foo should resolve while bar should not, since index.js is esm + 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..aee176689b2d9 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).js @@ -0,0 +1,37 @@ +//// [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] +/// +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 new file mode 100644 index 0000000000000..0f65d258dc7cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).symbols @@ -0,0 +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 new file mode 100644 index 0000000000000..438257a3bb9c3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride2(module=node18).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride2.ts] //// + +=== /index.ts === +/// +foo; // foo should resolve while bar should not, since index.js 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/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt new file mode 100644 index 0000000000000..477d247984d39 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).errors.txt @@ -0,0 +1,34 @@ +/index.ts(2,1): error TS2304: Cannot find name 'foo'. + + +==== /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..c6806f897de91 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride3(module=node18).js @@ -0,0 +1,37 @@ +//// [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] +/// +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/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..3d7f07f2775e1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverride4(module=node18).errors.txt @@ -0,0 +1,29 @@ +/index.ts(3,1): error TS2304: Cannot find name 'bar'. + + +==== /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).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..68be0baf51514 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).errors.txt @@ -0,0 +1,32 @@ +/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,1): error TS2304: Cannot find name 'foo'. + + +==== /index.ts (2 errors) ==== + /// + ~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + foo; // bad resolution mode, which resolves is arbitrary + ~~~ +!!! error TS2304: Cannot find name '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).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..8a1dd89345abe --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).symbols @@ -0,0 +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 new file mode 100644 index 0000000000000..fc34db9ecd52d --- /dev/null +++ b/tests/baselines/reference/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node18).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverrideModeError.ts] //// + +=== /index.ts === +/// +foo; // bad resolution mode, which resolves is arbitrary +>foo : any +> : ^^^ + +bar; +>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).js b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js new file mode 100644 index 0000000000000..fe34ab0566b01 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).js @@ -0,0 +1,108 @@ +//// [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] +// esm format file +import * as mod from "inner"; +mod.correctVersionApplied; +//// [index.mjs] +// esm format file +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 = __importStar(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..8ec3cb25a7915 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTypesVersionPackageExports(module=node18).symbols @@ -0,0 +1,59 @@ +//// [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.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 +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 +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 +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..c4e2d97b2afba --- /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 : typeof mod +> : ^^^^^^^^^^ + +mod.correctVersionApplied; +>mod.correctVersionApplied : true +> : ^^^^ +>mod : typeof mod +> : ^^^^^^^^^^ +>correctVersionApplied : true +> : ^^^^ + +=== index.mts === +// esm format file +import * as mod from "inner"; +>mod : typeof mod +> : ^^^^^^^^^^ + +mod.correctVersionApplied; +>mod.correctVersionApplied : true +> : ^^^^ +>mod : typeof mod +> : ^^^^^^^^^^ +>correctVersionApplied : true +> : ^^^^ + +=== index.cts === +// cjs format file +import * as mod from "inner"; +>mod : typeof mod +> : ^^^^^^^^^^ + +mod.correctVersionApplied; +>mod.correctVersionApplied : true +> : ^^^^ +>mod : typeof mod +> : ^^^^^^^^^^ +>correctVersionApplied : true +> : ^^^^ + +=== 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..0c45f9b8f43a1 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).errors.txt @@ -0,0 +1,24 @@ +index.cts(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + + +==== index.ts (0 errors) ==== + // esm format file + import * as self from "package"; + self; +==== index.mts (0 errors) ==== + // esm format file + import * as self from "package"; + self; +==== index.cts (1 errors) ==== + // esm format file + import * as self from "package"; + ~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. + self; +==== package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodePackageSelfName(module=node18).js b/tests/baselines/reference/nodePackageSelfName(module=node18).js new file mode 100644 index 0000000000000..dc65d690cf617 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfName(module=node18).js @@ -0,0 +1,77 @@ +//// [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] +// esm format file +import * as self from "package"; +self; +//// [index.mjs] +// esm format file +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 = __importStar(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..058acb1f54fdf --- /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 : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as self from "package"; +>self : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + +=== index.cts === +// esm format file +import * as self from "package"; +>self : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + 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..2c0b58848c59a --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).errors.txt @@ -0,0 +1,24 @@ +index.cts(2,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@scope/package")' call instead. + + +==== index.ts (0 errors) ==== + // esm format file + import * as self from "@scope/package"; + self; +==== index.mts (0 errors) ==== + // esm format file + import * as self from "@scope/package"; + self; +==== index.cts (1 errors) ==== + // cjs format file + import * as self from "@scope/package"; + ~~~~~~~~~~~~~~~~ +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@scope/package")' call instead. + self; +==== package.json (0 errors) ==== + { + "name": "@scope/package", + "private": true, + "type": "module", + "exports": "./index.js" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js new file mode 100644 index 0000000000000..f9d633df6fc03 --- /dev/null +++ b/tests/baselines/reference/nodePackageSelfNameScoped(module=node18).js @@ -0,0 +1,77 @@ +//// [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] +// esm format file +import * as self from "@scope/package"; +self; +//// [index.mjs] +// esm format file +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 = __importStar(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..e197ff58db4b0 --- /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 : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + +=== index.mts === +// esm format file +import * as self from "@scope/package"; +>self : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + +=== index.cts === +// cjs format file +import * as self from "@scope/package"; +>self : typeof self +> : ^^^^^^^^^^^ + +self; +>self : typeof self +> : ^^^^^^^^^^^ + 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..9062d29947423 --- /dev/null +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node18).errors.txt @@ -0,0 +1,17 @@ +usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. + + +==== 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 (1 errors) ==== + /// + ~~~ +!!! error TS2688: Cannot find type definition file for 'pkg'. + + 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..df96cce680e38 100644 --- a/tests/cases/compiler/moduleResolutionWithModule.ts +++ b/tests/cases/compiler/moduleResolutionWithModule.ts @@ -1,5 +1,5 @@ // @moduleResolution: node16,nodenext -// @module: commonjs,node16,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/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 44469097d0d06..a3b8c44d38f09 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