diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 6ea9b826954..7e9f3ced07f 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -282,7 +282,6 @@ import { setValueDeclaration, ShorthandPropertyAssignment, shouldPreserveConstEnums, - shouldResolveJsRequire, SignatureDeclaration, skipParentheses, sliceAfter, @@ -3559,7 +3558,6 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { const possibleVariableDecl = node.kind === SyntaxKind.VariableDeclaration ? node : node.parent.parent; if ( isInJSFile(node) && - shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & ModifierFlags.Export) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d7b6e2122fb..d86d4e4a76d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -322,7 +322,6 @@ import { getLineAndCharacterOfPosition, getLocalSymbolForExportDefault, getMembersOfDeclaration, - getModeForUsageLocation, getModifiers, getModuleInstanceState, getNameFromImportAttribute, @@ -960,7 +959,6 @@ import { ShorthandPropertyAssignment, shouldAllowImportingTsExtension, shouldPreserveConstEnums, - shouldResolveJsRequire, Signature, SignatureDeclaration, SignatureFlags, @@ -4059,7 +4057,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function getUsageModeForExpression(usage: Expression) { - return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : undefined; + return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : undefined; } function isESMFormatImportImportingCommonjsFormatFile(usageMode: ResolutionMode, targetMode: ResolutionMode) { @@ -4073,7 +4071,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function canHaveSyntheticDefault(file: SourceFile | undefined, moduleSymbol: Symbol, dontResolveAlias: boolean, usage: Expression) { const usageMode = file && getUsageModeForExpression(usage); - if (file && usageMode !== undefined) { + if (file && usageMode !== undefined && ModuleKind.Node16 <= moduleKind && moduleKind <= ModuleKind.NodeNext) { const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat); if (usageMode === ModuleKind.ESNext || result) { return result; @@ -5005,13 +5003,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const currentSourceFile = getSourceFileOfNode(location); const contextSpecifier = isStringLiteralLike(location) ? location - : findAncestor(location, isImportCall)?.arguments[0] || + : (isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)?.name || + (isLiteralImportTypeNode(location) ? location : undefined)?.argument.literal || + (isVariableDeclaration(location) && location.initializer && isRequireCall(location.initializer, /*requireStringLiteralLikeArgument*/ true) ? location.initializer.arguments[0] : undefined) || + findAncestor(location, isImportCall)?.arguments[0] || findAncestor(location, isImportDeclaration)?.moduleSpecifier || findAncestor(location, isExternalModuleImportEqualsDeclaration)?.moduleReference.expression || - findAncestor(location, isExportDeclaration)?.moduleSpecifier || - (isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)?.name || - (isLiteralImportTypeNode(location) ? location : undefined)?.argument.literal; - const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat; + findAncestor(location, isExportDeclaration)?.moduleSpecifier; + const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat; const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); const resolvedModule = host.getResolvedModule(currentSourceFile, moduleReference, mode)?.resolvedModule; const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile); @@ -32083,7 +32082,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; - const mod = resolveExternalModule(location!, runtimeImportSpecifier, errorMessage, location!); + // Synthesized JSX import is either first or after tslib + const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0; + const specifier = file?.imports[jsxImportIndex]; + if (specifier) { + Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`); + } + const mod = resolveExternalModule(specifier || location!, runtimeImportSpecifier, errorMessage, location!); const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : undefined; if (links) { links.jsxImplicitImportContainer = result || false; @@ -35811,7 +35816,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) { + if (isInJSFile(node) && isCommonJsRequire(node)) { return resolveExternalModuleTypeByLiteral(node.arguments![0] as StringLiteral); } @@ -37745,6 +37750,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // fallthrough case ModuleKind.ES2022: case ModuleKind.ESNext: + case ModuleKind.Preserve: case ModuleKind.System: if (languageVersion >= ScriptTarget.ES2017) { break; @@ -37752,8 +37758,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_or_nodenext_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_or_nodenext_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_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; diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message)); hasError = true; break; @@ -46056,14 +46062,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } const mode = (moduleKind === ModuleKind.NodeNext) && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier); - if (mode !== ModuleKind.ESNext && moduleKind !== ModuleKind.ESNext) { + if (mode !== ModuleKind.ESNext && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.Preserve) { const message = isImportAttributes ? moduleKind === ModuleKind.NodeNext ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls - : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext + : 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_or_nodenext; + : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve; return grammarErrorOnNode(node, message); } @@ -46147,7 +46153,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } else { - if (moduleKind >= ModuleKind.ES2015 && getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & NodeFlags.Ambient)) { + if (moduleKind >= ModuleKind.ES2015 && moduleKind !== ModuleKind.Preserve && getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & NodeFlags.Ambient)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } @@ -46433,6 +46439,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Forbid export= in esm implementation files, and esm mode declaration files if ( moduleKind >= ModuleKind.ES2015 && + moduleKind !== ModuleKind.Preserve && ((node.flags & NodeFlags.Ambient && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.ESNext) || (!(node.flags & NodeFlags.Ambient) && getSourceFileOfNode(node).impliedNodeFormat !== ModuleKind.CommonJS)) ) { @@ -47605,7 +47612,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if ( (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (node.parent as ImportDeclaration).moduleSpecifier === node) || - ((isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler && isRequireCall(node.parent, /*requireStringLiteralLikeArgument*/ false)) || isImportCall(node.parent)) || + ((isInJSFile(node) && isRequireCall(node.parent, /*requireStringLiteralLikeArgument*/ false)) || isImportCall(node.parent)) || (isLiteralTypeNode(node.parent) && isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) ) { return resolveExternalModuleName(node, node as LiteralExpression, ignoreErrors); @@ -50004,7 +50011,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_or_nodenext_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_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher), ); break; } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 58c43f74119..feee1493eb1 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -559,6 +559,7 @@ export const moduleOptionDeclaration: CommandLineOptionOfCustomType = { esnext: ModuleKind.ESNext, node16: ModuleKind.Node16, nodenext: ModuleKind.NodeNext, + preserve: ModuleKind.Preserve, })), affectsSourceFile: true, affectsModuleResolution: true, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fa99e82b814..344d92f054f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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', or 'nodenext', 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', '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', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher.": { "category": "Error", "code": 1432 }, @@ -3595,7 +3595,7 @@ "category": "Error", "code": 2820 }, - "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.": { + "Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.": { "category": "Error", "code": 2821 }, @@ -3603,7 +3603,7 @@ "category": "Error", "code": 2822 }, - "Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'.": { + "Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.": { "category": "Error", "code": 2823 }, @@ -3683,7 +3683,7 @@ "category": "Error", "code": 2853 }, - "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher.": { "category": "Error", "code": 2854 }, @@ -4309,7 +4309,7 @@ "category": "Error", "code": 5070 }, - "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'.": { + "Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'.": { "category": "Error", "code": 5071 }, @@ -4401,7 +4401,7 @@ "category": "Error", "code": 5094 }, - "Option '{0}' can only be used when 'module' is set to 'es2015' or later.": { + "Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.": { "category": "Error", "code": 5095 }, diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 6727876b16c..09a3dc090a1 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -44,7 +44,6 @@ import { getCompilerOptionValue, getDirectoryPath, GetEffectiveTypeRootsHost, - getEmitModuleKind, getEmitModuleResolutionKind, getNormalizedAbsolutePath, getOwnKeys, @@ -1417,20 +1416,7 @@ export function resolveModuleName(moduleName: string, containingFile: string, co else { let moduleResolution = compilerOptions.moduleResolution; if (moduleResolution === undefined) { - switch (getEmitModuleKind(compilerOptions)) { - case ModuleKind.CommonJS: - moduleResolution = ModuleResolutionKind.Node10; - break; - case ModuleKind.Node16: - moduleResolution = ModuleResolutionKind.Node16; - break; - case ModuleKind.NodeNext: - moduleResolution = ModuleResolutionKind.NodeNext; - break; - default: - moduleResolution = ModuleResolutionKind.Classic; - break; - } + moduleResolution = getEmitModuleResolutionKind(compilerOptions); if (traceEnabled) { trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]); } diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 1da0c9e834b..9801e54397c 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -385,7 +385,7 @@ function computeModuleSpecifiers( if (reason.kind !== FileIncludeKind.Import || reason.file !== importingSourceFile.path) return undefined; // If the candidate import mode doesn't match the mode we're generating for, don't consider it // TODO: maybe useful to keep around as an alternative option for certain contexts where the mode is overridable - if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index)) return undefined; + if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return undefined; const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; // If the preference is for non relative and the module specifier is relative, ignore it return preferences.relativePreference !== RelativePreference.NonRelative || !pathIsRelative(specifier) ? diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6dd6cb6de43..6c360819120 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -140,6 +140,7 @@ import { getResolveJsonModule, getRootLength, getSetExternalModuleIndicator, + getSourceFileOfNode, getSpellingSuggestion, getStrictOptionValue, getSupportedExtensions, @@ -287,7 +288,6 @@ import { ScriptTarget, setParent, setParentRecursive, - shouldResolveJsRequire, skipTrivia, skipTypeChecking, some, @@ -852,20 +852,25 @@ export function getModeForFileReference(ref: FileReference | string, containingF } /** - * Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly - * defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm). - * If you have an actual import node, prefer using getModeForUsageLocation on the reference string node. + * Use `program.getModeForResolutionAtIndex`, which retrieves the correct `compilerOptions`, instead of this function whenever possible. + * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode + * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In + * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the + * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns + * `undefined`, as the result would have no impact on module resolution, emit, or type checking. * @param file File to fetch the resolution mode within * @param index Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations + * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options + * should be the options of the referenced project, not the referencing project. */ -export function getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode; +export function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode; /** @internal */ // eslint-disable-next-line @typescript-eslint/unified-signatures -export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number): ResolutionMode; -export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number): ResolutionMode { +export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number, compilerOptions: CompilerOptions): ResolutionMode; +export function getModeForResolutionAtIndex(file: SourceFileImportsList, index: number, compilerOptions?: CompilerOptions): ResolutionMode { // we ensure all elements of file.imports and file.moduleAugmentations have the relevant parent pointers set during program setup, // so it's safe to use them even pre-bind - return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index)); + return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions); } /** @internal */ @@ -880,15 +885,23 @@ export function isExclusivelyTypeOnlyImportOrExport(decl: ImportDeclaration | Ex } /** - * Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if - * one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm). - * Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when - * `moduleResolution` is `node16`+. + * Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible. + * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import + * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may + * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other + * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no + * impact on module resolution, emit, or type checking. * @param file The file the import or import-like reference is contained within * @param usage The module reference string + * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options + * should be the options of the referenced project, not the referencing project. * @returns The final resolution mode of the import */ -export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMode; }, usage: StringLiteralLike) { +export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMode; }, usage: StringLiteralLike, compilerOptions: CompilerOptions) { + return getModeForUsageLocationWorker(file, usage, compilerOptions); +} + +function getModeForUsageLocationWorker(file: { impliedNodeFormat?: ResolutionMode; }, usage: StringLiteralLike, compilerOptions?: CompilerOptions) { if ((isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent))) { const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent); if (isTypeOnly) { @@ -904,6 +917,11 @@ export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMo return override; } } + if (compilerOptions && getEmitModuleKind(compilerOptions) === ModuleKind.Preserve) { + return (usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(usage.parent, /*requireStringLiteralLikeArgument*/ false)) + ? ModuleKind.CommonJS + : ModuleKind.ESNext; + } if (file.impliedNodeFormat === undefined) return undefined; if (file.impliedNodeFormat !== ModuleKind.ESNext) { // in cjs files, import call expressions are esm format, otherwise everything is cjs @@ -954,7 +972,7 @@ const emptyResolution: ResolvedModuleWithFailedLookupLocations & ResolvedTypeRef /** @internal */ export interface ResolutionNameAndModeGetter { getName(entry: Entry): string; - getMode(entry: Entry, file: SourceFile): ResolutionMode; + getMode(entry: Entry, file: SourceFile, compilerOptions: CompilerOptions): ResolutionMode; } /** @internal */ @@ -970,7 +988,7 @@ function getModuleResolutionName(literal: StringLiteralLike) { /** @internal */ export const moduleResolutionNameAndModeGetter: ResolutionNameAndModeGetter = { getName: getModuleResolutionName, - getMode: (entry, file) => getModeForUsageLocation(file, entry), + getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions), }; /** @internal */ @@ -1001,8 +1019,7 @@ function getTypeReferenceResolutionName(entry: return !isString(entry) ? toFileNameLowerCase(entry.fileName) : entry; } -/** @internal */ -export const typeReferenceResolutionNameAndModeGetter: ResolutionNameAndModeGetter = { +const typeReferenceResolutionNameAndModeGetter: ResolutionNameAndModeGetter = { getName: getTypeReferenceResolutionName, getMode: (entry, file) => getModeForFileReference(entry, file?.impliedNodeFormat), }; @@ -1053,7 +1070,7 @@ export function loadWithModeAwareCache automaticTypeDirectiveResolutions, isSourceFileFromExternalLibrary, isSourceFileDefaultLibrary, + getModeForUsageLocation, + getModeForResolutionAtIndex, getSourceFileFromReference, getLibFileFromReference, sourceFileToPackageName, @@ -1894,6 +1913,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg resolvedTypeReferenceDirectiveNames, resolvedLibReferences, getResolvedModule, + getResolvedModuleFromModuleSpecifier, getResolvedTypeReferenceDirective, forEachResolvedModule, forEachResolvedTypeReferenceDirective, @@ -1950,6 +1970,12 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg return resolvedModules?.get(file.path)?.get(moduleName, mode); } + function getResolvedModuleFromModuleSpecifier(moduleSpecifier: StringLiteralLike): ResolvedModuleWithFailedLookupLocations | undefined { + const sourceFile = getSourceFileOfNode(moduleSpecifier); + Debug.assertIsDefined(sourceFile, "`moduleSpecifier` must have a `SourceFile` ancestor. Use `program.getResolvedModule` instead to provide the containing file and resolution mode."); + return getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier)); + } + function getResolvedTypeReferenceDirective(file: SourceFile, typeDirectiveName: string, mode: ResolutionMode) { return resolvedTypeReferenceDirectiveNames?.get(file.path)?.get(typeDirectiveName, mode); } @@ -2158,8 +2184,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) { - const mode = getModeForUsageLocation(file, moduleName); - const oldResolution = oldProgram?.getResolvedModule(file, moduleName.text, mode); + const oldResolution = oldProgram?.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName)); if (oldResolution?.resolvedModule) { if (isTraceEnabled(options, host)) { trace( @@ -2521,11 +2546,9 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg // ensure that module resolution results are still correct const resolutionsChanged = hasChangesInResolutions( moduleNames, - newSourceFile, resolutions, - (name, mode) => oldProgram!.getResolvedModule(newSourceFile, name, mode), + name => oldProgram!.getResolvedModule(newSourceFile, name.text, getModeForUsageLocation(newSourceFile, name)), moduleResolutionIsEqualTo, - moduleResolutionNameAndModeGetter, ); if (resolutionsChanged) structureIsReused = StructureIsReused.SafeModules; const typesReferenceDirectives = newSourceFile.typeReferenceDirectives; @@ -2534,11 +2557,9 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg // ensure that types resolutions are still correct const typeReferenceResolutionsChanged = hasChangesInResolutions( typesReferenceDirectives, - newSourceFile, typeReferenceResolutions, - (name, mode) => oldProgram?.getResolvedTypeReferenceDirective(newSourceFile, name, mode), + name => oldProgram!.getResolvedTypeReferenceDirective(newSourceFile, getTypeReferenceResolutionName(name), getModeForFileReference(name, newSourceFile.impliedNodeFormat)), typeDirectiveIsEqualTo, - typeReferenceResolutionNameAndModeGetter, ); if (typeReferenceResolutionsChanged) structureIsReused = StructureIsReused.SafeModules; } @@ -3345,8 +3366,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg collectModuleReferences(node, /*inAmbientModule*/ false); } - const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options); - if ((file.flags & NodeFlags.PossiblyContainsDynamicImport) || shouldProcessRequires) { + if ((file.flags & NodeFlags.PossiblyContainsDynamicImport) || isJavaScriptFile) { collectDynamicImportOrRequireCalls(file); } @@ -3408,7 +3428,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const r = /import|require/g; while (r.exec(file.text) !== null) { // eslint-disable-line no-null/no-null const node = getNodeAtPosition(file, r.lastIndex); - if (shouldProcessRequires && isRequireCall(node, /*requireStringLiteralLikeArgument*/ true)) { + if (isJavaScriptFile && isRequireCall(node, /*requireStringLiteralLikeArgument*/ true)) { setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here imports = append(imports, node.arguments[0]); } @@ -4024,13 +4044,13 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const resolutions = resolvedModulesProcessing?.get(file.path) || resolveModuleNamesReusingOldState(moduleNames, file); Debug.assert(resolutions.length === moduleNames.length); - const optionsForFile = (useSourceOfProjectReferenceRedirect ? getRedirectReferenceForResolution(file)?.commandLine.options : undefined) || options; + const optionsForFile = getRedirectReferenceForResolution(file)?.commandLine.options || options; const resolutionsInFile = createModeAwareCache(); (resolvedModules ??= new Map()).set(file.path, resolutionsInFile); for (let index = 0; index < moduleNames.length; index++) { const resolution = resolutions[index].resolvedModule; const moduleName = moduleNames[index].text; - const mode = getModeForUsageLocation(file, moduleNames[index]); + const mode = getModeForUsageLocationWorker(file, moduleNames[index], optionsForFile); resolutionsInFile.set(moduleName, mode, resolutions[index]); addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode); @@ -4324,9 +4344,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Classic) { createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule"); } - // Any emit other than common js, amd, es2015 or esnext is error else if (!hasJsonModuleEmitEnabled(options)) { - createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module"); + createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module"); } } @@ -4412,7 +4431,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } if (options.preserveValueImports && getEmitModuleKind(options) < ModuleKind.ES2015) { - createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports"); + createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports"); } const moduleKind = getEmitModuleKind(options); @@ -4443,8 +4462,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions"); } - if (moduleResolution === ModuleResolutionKind.Bundler && !emitModuleKindIsNonNodeESM(moduleKind)) { - createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler"); + if (moduleResolution === ModuleResolutionKind.Bundler && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== ModuleKind.Preserve) { + createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler"); } if ( @@ -4981,6 +5000,15 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } return symlinks; } + + function getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode { + const optionsForFile = getRedirectReferenceForResolution(file)?.commandLine.options || options; + return getModeForUsageLocationWorker(file, usage, optionsForFile); + } + + function getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode { + return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index)); + } } interface HostForUseSourceOfProjectReferenceRedirect { diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 4ec9b66031c..375083077b2 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -822,7 +822,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD const seenNamesInFile = createModeAwareCache(); for (const entry of entries) { const name = loader.nameAndMode.getName(entry); - const mode = loader.nameAndMode.getMode(entry, containingSourceFile); + const mode = loader.nameAndMode.getMode(entry, containingSourceFile, redirectedReference?.commandLine.options || options); let resolution = resolutionsInFile.get(name, mode); // Resolution is valid if it is present and not invalidated if ( @@ -881,7 +881,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD reusedNames?.forEach(entry => seenNamesInFile.set( loader.nameAndMode.getName(entry), - loader.nameAndMode.getMode(entry, containingSourceFile), + loader.nameAndMode.getMode(entry, containingSourceFile, redirectedReference?.commandLine.options || options), true, ) ); diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 3a37fe0f2d3..bb49cee8e47 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -82,6 +82,7 @@ function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory { - // Elide `export=` as it is not legal with --module ES6 - return node.isExportEquals ? undefined : node; + function visitExportAssignment(node: ExportAssignment): VisitResult { + if (node.isExportEquals) { + if (getEmitModuleKind(compilerOptions) === ModuleKind.Preserve) { + const statement = setOriginalNode( + factory.createExpressionStatement( + factory.createAssignment( + factory.createPropertyAccessExpression( + factory.createIdentifier("module"), + "exports", + ), + node.expression, + ), + ), + node, + ); + return statement; + } + // Elide `export=` as it is not legal with --module ES6 + return undefined; + } + return node; } function visitExportDeclaration(node: ExportDeclaration) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3003eb43035..e0b88978867 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4698,6 +4698,8 @@ export interface Program extends ScriptReferenceHost { /** @internal */ getResolvedModule(f: SourceFile, moduleName: string, mode: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined; /** @internal */ + getResolvedModuleFromModuleSpecifier(moduleSpecifier: StringLiteralLike): ResolvedModuleWithFailedLookupLocations | undefined; + /** @internal */ getResolvedTypeReferenceDirective(f: SourceFile, typeDirectiveName: string, mode: ResolutionMode): ResolvedTypeReferenceDirectiveWithFailedLookupLocations | undefined; /** @internal */ forEachResolvedModule( @@ -4760,6 +4762,22 @@ export interface Program extends ScriptReferenceHost { /** @internal */ getAutomaticTypeDirectiveResolutions(): ModeAwareCache; isSourceFileFromExternalLibrary(file: SourceFile): boolean; isSourceFileDefaultLibrary(file: SourceFile): boolean; + /** + * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import + * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may + * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other + * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no + * impact on module resolution, emit, or type checking. + */ + getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode; + /** + * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode + * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In + * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the + * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns + * `undefined`, as the result would have no impact on module resolution, emit, or type checking. + */ + getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode; // For testing purposes only. // This is set on created program to let us know how the program was created using old program @@ -4925,6 +4943,7 @@ export interface TypeCheckerHost extends ModuleSpecifierResolutionHost { getResolvedTypeReferenceDirectives(): ModeAwareCache; getProjectReferenceRedirect(fileName: string): string | undefined; isSourceOfProjectReferenceRedirect(fileName: string): boolean; + getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode; getResolvedModule(f: SourceFile, moduleName: string, mode: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined; @@ -7296,6 +7315,9 @@ export enum ModuleKind { // Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext Node16 = 100, NodeNext = 199, + + // Emit as written + Preserve = 200, } export const enum JsxEmit { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f2acc826efa..4680a78c5ac 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -469,7 +469,6 @@ import { RequireOrImportCall, RequireVariableStatement, ResolutionMode, - ResolutionNameAndModeGetter, ResolvedModuleFull, ResolvedModuleWithFailedLookupLocations, ResolvedTypeReferenceDirective, @@ -837,20 +836,16 @@ export function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirec /** @internal */ export function hasChangesInResolutions( names: readonly K[], - newSourceFile: SourceFile, newResolutions: readonly V[], - getOldResolution: (name: string, mode: ResolutionMode) => V | undefined, + getOldResolution: (name: K) => V | undefined, comparer: (oldResolution: V, newResolution: V) => boolean, - nameAndModeGetter: ResolutionNameAndModeGetter, ): boolean { Debug.assert(names.length === newResolutions.length); for (let i = 0; i < names.length; i++) { const newResolution = newResolutions[i]; const entry = names[i]; - const name = nameAndModeGetter.getName(entry); - const mode = nameAndModeGetter.getMode(entry, newSourceFile); - const oldResolution = getOldResolution(name, mode); + const oldResolution = getOldResolution(entry); const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution; @@ -8655,6 +8650,9 @@ export const computedOptions = createComputedCompilerOptions({ case ModuleKind.NodeNext: moduleResolution = ModuleResolutionKind.NodeNext; break; + case ModuleKind.Preserve: + moduleResolution = ModuleResolutionKind.Bundler; + break; default: moduleResolution = ModuleResolutionKind.Classic; break; @@ -8686,6 +8684,7 @@ export const computedOptions = createComputedCompilerOptions({ switch (computedOptions.module.computeValue(compilerOptions)) { case ModuleKind.Node16: case ModuleKind.NodeNext: + case ModuleKind.Preserve: return true; } return false; @@ -8878,18 +8877,12 @@ export function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind) { /** @internal */ export function hasJsonModuleEmitEnabled(options: CompilerOptions) { switch (getEmitModuleKind(options)) { - case ModuleKind.CommonJS: - case ModuleKind.AMD: - case ModuleKind.ES2015: - case ModuleKind.ES2020: - case ModuleKind.ES2022: - case ModuleKind.ESNext: - case ModuleKind.Node16: - case ModuleKind.NodeNext: - return true; - default: + case ModuleKind.None: + case ModuleKind.System: + case ModuleKind.UMD: return false; } + return true; } /** @internal */ @@ -8913,12 +8906,6 @@ export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResol || moduleResolution === ModuleResolutionKind.Bundler; } -/** @internal */ -export function shouldResolveJsRequire(compilerOptions: CompilerOptions): boolean { - // `bundler` doesn't support resolving `require`, but needs to in `noDtsResolution` to support Find Source Definition - return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler; -} - /** @internal */ export type StrictOptionName = | "noImplicitAny" @@ -9595,7 +9582,8 @@ export function usesExtensionsOnImports({ imports }: SourceFile, hasExtension: ( /** @internal */ export function getModuleSpecifierEndingPreference(preference: UserPreferences["importModuleSpecifierEnding"], resolutionMode: ResolutionMode, compilerOptions: CompilerOptions, sourceFile: SourceFile): ModuleSpecifierEnding { - if (preference === "js" || resolutionMode === ModuleKind.ESNext) { + const moduleResolution = getEmitModuleResolutionKind(compilerOptions); + if (preference === "js" || resolutionMode === ModuleKind.ESNext && ModuleResolutionKind.Node16 <= moduleResolution && moduleResolution <= ModuleResolutionKind.NodeNext) { // Extensions are explicitly requested or required. Now choose between .js and .ts. if (!shouldAllowImportingTsExtension(compilerOptions)) { return ModuleSpecifierEnding.JsExtension; diff --git a/src/server/protocol.ts b/src/server/protocol.ts index e0964cea6d9..29d11637cff 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -3751,11 +3751,19 @@ export const enum ModuleKind { ES6 = "ES6", ES2015 = "ES2015", ESNext = "ESNext", + Node16 = "Node16", + NodeNext = "NodeNext", + Preserve = "Preserve", } export const enum ModuleResolutionKind { Classic = "Classic", + /** @deprecated Renamed to `Node10` */ Node = "Node", + Node10 = "Node10", + Node16 = "Node16", + NodeNext = "NodeNext", + Bundler = "Bundler", } export const enum NewLineKind { diff --git a/src/services/codefixes/convertToEsModule.ts b/src/services/codefixes/convertToEsModule.ts index 4c7c6ab8304..b78669dc244 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -26,7 +26,6 @@ import { FunctionDeclaration, FunctionExpression, getEmitScriptTarget, - getModeForUsageLocation, getQuotePreference, getSynthesizedDeepClone, getSynthesizedDeepClones, @@ -107,7 +106,7 @@ function fixImportOfModuleExports( quotePreference: QuotePreference, ) { for (const moduleSpecifier of importingFile.imports) { - const imported = program.getResolvedModule(importingFile, moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))?.resolvedModule; + const imported = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)?.resolvedModule; if (!imported || imported.resolvedFileName !== exportingFile.fileName) { continue; } diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index 376a74663e1..56208667bdb 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -116,10 +116,10 @@ function getInfo(sourceFile: SourceFile, pos: number, program: Program): Info | const importDeclaration = findAncestor(token, isImportDeclaration); if (importDeclaration === undefined) return undefined; - const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined; + const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier : undefined; if (moduleSpecifier === undefined) return undefined; - const resolvedModule = program.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined)?.resolvedModule; + const resolvedModule = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)?.resolvedModule; if (resolvedModule === undefined) return undefined; const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); @@ -136,7 +136,7 @@ function getInfo(sourceFile: SourceFile, pos: number, program: Program): Info | if (node === undefined) return undefined; const exportName = { node: token, isTypeOnly: isTypeDeclaration(node) }; - return { exportName, node, moduleSourceFile, moduleSpecifier }; + return { exportName, node, moduleSourceFile, moduleSpecifier: moduleSpecifier.text }; } return undefined; } diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 7446e4babe1..5ae7d53a894 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_or_nodenext_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_or_nodenext_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_or_nodenext_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_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, ], getCodeActions: function getCodeActionsToFixModuleAndTarget(context) { const compilerOptions = context.program.getCompilerOptions(); diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index ede869cfea9..8c2130ab57c 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -7,7 +7,6 @@ import { getEffectiveBaseTypeNode, getEmitScriptTarget, getMeaningFromLocation, - getModeForUsageLocation, getTextOfNode, getTokenAtPosition, hasOverrideModifier, @@ -119,7 +118,7 @@ function getInfo(sourceFile: SourceFile, pos: number, context: CodeFixContextBas else if (isImportSpecifier(parent) && parent.name === node) { Debug.assertNode(node, isIdentifier, "Expected an identifier for spelling (import)"); const importDeclaration = findAncestor(node, isImportDeclaration)!; - const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration); + const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context, importDeclaration); if (resolvedSourceFile && resolvedSourceFile.symbol) { suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol); } @@ -178,10 +177,10 @@ function convertSemanticMeaningToSymbolFlags(meaning: SemanticMeaning): SymbolFl return flags; } -function getResolvedSourceFileFromImportDeclaration(sourceFile: SourceFile, context: CodeFixContextBase, importDeclaration: ImportDeclaration): SourceFile | undefined { +function getResolvedSourceFileFromImportDeclaration(context: CodeFixContextBase, importDeclaration: ImportDeclaration): SourceFile | undefined { if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier)) return undefined; - const resolvedModule = context.program.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))?.resolvedModule; + const resolvedModule = context.program.getResolvedModuleFromModuleSpecifier(importDeclaration.moduleSpecifier)?.resolvedModule; if (!resolvedModule) return undefined; return context.program.getSourceFile(resolvedModule.resolvedFileName); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 22cd9693ab9..a634ac334a0 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -44,7 +44,6 @@ import { getExportInfoMap, getMeaningFromDeclaration, getMeaningFromLocation, - getModeForUsageLocation, getNameForExportedSymbol, getNodeId, getOutputExtension, @@ -1160,6 +1159,7 @@ function getUmdImportKind(importingFile: SourceFile, compilerOptions: CompilerOp case ModuleKind.ES2022: case ModuleKind.ESNext: case ModuleKind.None: + case ModuleKind.Preserve: // Fall back to the `import * as ns` style import. return ImportKind.Namespace; case ModuleKind.Node16: @@ -1440,7 +1440,7 @@ function promoteFromTypeOnly( // Change .ts extension to .js if necessary if (!compilerOptions.allowImportingTsExtensions) { const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent); - const resolvedModule = moduleSpecifier && program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))?.resolvedModule; + const resolvedModule = moduleSpecifier && program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)?.resolvedModule; if (resolvedModule?.resolvedUsingTsExtension) { const changedExtension = changeAnyExtension(moduleSpecifier!.text, getOutputExtension(moduleSpecifier!.text, compilerOptions)); changes.replaceNode(sourceFile, moduleSpecifier!, factory.createStringLiteral(changedExtension)); diff --git a/src/services/completions.ts b/src/services/completions.ts index eea32845853..349d4066b80 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2807,7 +2807,7 @@ export function getCompletionEntryDetails( const { previousToken, contextToken } = getRelevantTokens(position, sourceFile); if (isInString(sourceFile, position, previousToken)) { - return StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, previousToken, typeChecker, compilerOptions, host, cancellationToken, preferences); + return StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, previousToken, program, host, cancellationToken, preferences); } // Compute all the completion symbols again. diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 826dfe9eb59..fdf81a7edf9 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -65,7 +65,6 @@ import { getLocalSymbolForExportDefault, getMeaningFromDeclaration, getMeaningFromLocation, - getModeForUsageLocation, getNameOfDeclaration, getNameTable, getNextJSDocCommentLocation, @@ -1023,7 +1022,7 @@ export namespace Core { if (!options.implementations && isStringLiteralLike(node)) { if (isModuleSpecifierLike(node)) { const fileIncludeReasons = program.getFileIncludeReasons(); - const referencedFileName = program.getResolvedModule(node.getSourceFile(), node.text, getModeForUsageLocation(node.getSourceFile(), node))?.resolvedModule?.resolvedFileName; + const referencedFileName = program.getResolvedModuleFromModuleSpecifier(node)?.resolvedModule?.resolvedFileName; const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : undefined; if (referencedFile) { return [{ definition: { type: DefinitionKind.String, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }]; diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index d9f386ed7ce..860202a0bb2 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -16,7 +16,6 @@ import { GetCanonicalFileName, getDirectoryPath, getFileMatcherPatterns, - getModeForUsageLocation, getOptionFromName, getRegexFromPattern, getRelativePathFromDirectory, @@ -246,9 +245,9 @@ function getSourceFileToImport( return newFileName === undefined ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true }; } else { - const mode = getModeForUsageLocation(importingSourceFile, importLiteral); + const mode = program.getModeForUsageLocation(importingSourceFile, importLiteral); const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? - program.getResolvedModule(importingSourceFile, importLiteral.text, mode) : + program.getResolvedModuleFromModuleSpecifier(importLiteral) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode); return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles()); } diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 79afa66a4d3..d3148d5ae60 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -29,7 +29,6 @@ import { getDirectoryPath, getEffectiveBaseTypeNode, getInvokedExpression, - getModeForUsageLocation, getNameFromPropertyName, getNameOfDeclaration, getObjectFlags, @@ -203,7 +202,7 @@ export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile if (!symbol && isModuleSpecifierLike(fallbackNode)) { // We couldn't resolve the module specifier as an external module, but it could // be that module resolution succeeded but the target was not a module. - const ref = program.getResolvedModule(sourceFile, fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))?.resolvedModule; + const ref = program.getResolvedModuleFromModuleSpecifier(fallbackNode)?.resolvedModule; if (ref) { return [{ name: fallbackNode.text, @@ -359,7 +358,7 @@ export function getReferenceAtPosition(sourceFile: SourceFile, position: number, if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) { const node = getTouchingToken(sourceFile, position); let resolution: ResolvedModuleWithFailedLookupLocations | undefined; - if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModule(sourceFile, node.text, getModeForUsageLocation(sourceFile, node)))) { + if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModuleFromModuleSpecifier(node))) { const verifiedFileName = resolution.resolvedModule?.resolvedFileName; const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text); return { diff --git a/src/services/refactors/moveToFile.ts b/src/services/refactors/moveToFile.ts index d3801aabac7..1c2a7a6e702 100644 --- a/src/services/refactors/moveToFile.ts +++ b/src/services/refactors/moveToFile.ts @@ -51,7 +51,6 @@ import { getDecorators, getDirectoryPath, getLocaleSpecificMessage, - getModeForUsageLocation, getModifiers, getPropertySymbolFromBindingElement, getQuotePreference, @@ -313,10 +312,11 @@ function getTargetFileImportsAndAddExportInOldFile( forEachImportInStatement(oldStatement, i => { // Recomputing module specifier const moduleSpecifier = moduleSpecifierFromImport(i); - const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier)); + const compilerOptions = program.getCompilerOptions(); + const resolved = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier); const fileName = resolved?.resolvedModule?.resolvedFileName; if (fileName && targetSourceFile) { - const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host)); + const newModuleSpecifier = getModuleSpecifier(compilerOptions, targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host)); append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), name => importsToCopy.has(checker.getSymbolAtLocation(name)!))); } else { diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 474c72be3dd..1c0339f7c14 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -52,7 +52,6 @@ import { getEffectiveTypeRoots, getEmitModuleResolutionKind, getLeadingCommentRanges, - getModeForUsageLocation, getModuleSpecifierEndingPreference, getOwnKeys, getPackageJsonTypesVersionsPaths, @@ -203,7 +202,7 @@ export function getStringLiteralCompletions( } if (isInString(sourceFile, position, contextToken)) { if (!contextToken || !isStringLiteralLike(contextToken)) return undefined; - const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences); + const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences); return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol); } } @@ -281,10 +280,10 @@ function convertStringLiteralCompletions( } /** @internal */ -export function getStringLiteralCompletionDetails(name: string, sourceFile: SourceFile, position: number, contextToken: Node | undefined, checker: TypeChecker, options: CompilerOptions, host: LanguageServiceHost, cancellationToken: CancellationToken, preferences: UserPreferences) { +export function getStringLiteralCompletionDetails(name: string, sourceFile: SourceFile, position: number, contextToken: Node | undefined, program: Program, host: LanguageServiceHost, cancellationToken: CancellationToken, preferences: UserPreferences) { if (!contextToken || !isStringLiteralLike(contextToken)) return undefined; - const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position, checker, options, host, preferences); - return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile, checker, cancellationToken); + const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences); + return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile, program.getTypeChecker(), cancellationToken); } function stringLiteralCompletionDetails(name: string, location: Node, completion: StringLiteralCompletion, sourceFile: SourceFile, checker: TypeChecker, cancellationToken: CancellationToken): CompletionEntryDetails | undefined { @@ -361,13 +360,14 @@ interface StringLiteralCompletionsFromTypes { readonly isNewIdentifier: boolean; } type StringLiteralCompletion = { readonly kind: StringLiteralCompletionKind.Paths; readonly paths: readonly PathCompletion[]; } | StringLiteralCompletionsFromProperties | StringLiteralCompletionsFromTypes; -function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringLiteralLike, position: number, typeChecker: TypeChecker, compilerOptions: CompilerOptions, host: LanguageServiceHost, preferences: UserPreferences): StringLiteralCompletion | undefined { +function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringLiteralLike, position: number, program: Program, host: LanguageServiceHost, preferences: UserPreferences): StringLiteralCompletion | undefined { + const typeChecker = program.getTypeChecker(); const parent = walkUpParentheses(node.parent); switch (parent.kind) { case SyntaxKind.LiteralType: { const grandParent = walkUpParentheses(parent.parent); if (grandParent.kind === SyntaxKind.ImportType) { - return { kind: StringLiteralCompletionKind.Paths, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; + return { kind: StringLiteralCompletionKind.Paths, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) }; } return fromUnionableLiteralType(grandParent); } @@ -424,7 +424,7 @@ function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringL // import x = require("/*completion position*/"); // var y = require("/*completion position*/"); // export * from "/*completion position*/"; - return { kind: StringLiteralCompletionKind.Paths, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; + return { kind: StringLiteralCompletionKind.Paths, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) }; case SyntaxKind.CaseClause: const tracker = newCaseClauseTracker(typeChecker, (parent as CaseClause).parent.clauses); const contextualTypes = fromContextualType(); @@ -577,16 +577,18 @@ function addReplacementSpans(text: string, textStart: number, names: readonly Na return names.map(({ name, kind, extension }): PathCompletion => (name.includes(directorySeparator) || name.includes(altDirectorySeparator)) ? { name, kind, extension, span: wholeSpan } : { name, kind, extension, span }); } -function getStringLiteralCompletionsFromModuleNames(sourceFile: SourceFile, node: LiteralExpression, compilerOptions: CompilerOptions, host: LanguageServiceHost, typeChecker: TypeChecker, preferences: UserPreferences): readonly PathCompletion[] { - return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, compilerOptions, host, typeChecker, preferences)); +function getStringLiteralCompletionsFromModuleNames(sourceFile: SourceFile, node: LiteralExpression, program: Program, host: LanguageServiceHost, preferences: UserPreferences): readonly PathCompletion[] { + return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, program, host, preferences)); } -function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile: SourceFile, node: LiteralExpression, compilerOptions: CompilerOptions, host: LanguageServiceHost, typeChecker: TypeChecker, preferences: UserPreferences): readonly NameAndKind[] { +function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile: SourceFile, node: LiteralExpression, program: Program, host: LanguageServiceHost, preferences: UserPreferences): readonly NameAndKind[] { const literalValue = normalizeSlashes(node.text); - const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : undefined; + const mode = isStringLiteralLike(node) ? program.getModeForUsageLocation(sourceFile, node) : undefined; const scriptPath = sourceFile.path; const scriptDirectory = getDirectoryPath(scriptPath); + const compilerOptions = program.getCompilerOptions(); + const typeChecker = program.getTypeChecker(); const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode); return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index 5d89f61c93b..cc597320d58 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -23,7 +23,6 @@ import { getAllowSyntheticDefaultImports, getAssignmentDeclarationKind, getFunctionFlags, - getModeForUsageLocation, hasInitializer, hasPropertyAccessExpressionWithName, Identifier, @@ -88,7 +87,7 @@ export function computeSuggestionDiagnostics(sourceFile: SourceFile, program: Pr const importNode = importFromModuleSpecifier(moduleSpecifier); const name = importNameForConvertToDefaultImport(importNode); if (!name) continue; - const module = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))?.resolvedModule; + const module = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)?.resolvedModule; const resolvedFile = module && program.getSourceFile(module.resolvedFileName); if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) { diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import)); diff --git a/tests/baselines/reference/allowImportingTsExtensions(moduleresolution=bundler).errors.txt b/tests/baselines/reference/allowImportingTsExtensions(moduleresolution=bundler).errors.txt index e9f61d8d6af..9cd62ffe3c0 100644 --- a/tests/baselines/reference/allowImportingTsExtensions(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/allowImportingTsExtensions(moduleresolution=bundler).errors.txt @@ -1,8 +1,8 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. /c.ts(1,16): error TS2307: Cannot find module './thisfiledoesnotexist.ts' or its corresponding type declarations. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /ts.ts (0 errors) ==== export {}; diff --git a/tests/baselines/reference/ambientRequireFunction.js b/tests/baselines/reference/ambientRequireFunction(module=commonjs).js similarity index 100% rename from tests/baselines/reference/ambientRequireFunction.js rename to tests/baselines/reference/ambientRequireFunction(module=commonjs).js diff --git a/tests/baselines/reference/ambientRequireFunction.symbols b/tests/baselines/reference/ambientRequireFunction(module=commonjs).symbols similarity index 100% rename from tests/baselines/reference/ambientRequireFunction.symbols rename to tests/baselines/reference/ambientRequireFunction(module=commonjs).symbols diff --git a/tests/baselines/reference/ambientRequireFunction.types b/tests/baselines/reference/ambientRequireFunction(module=commonjs).types similarity index 100% rename from tests/baselines/reference/ambientRequireFunction.types rename to tests/baselines/reference/ambientRequireFunction(module=commonjs).types diff --git a/tests/baselines/reference/ambientRequireFunction(module=preserve).js b/tests/baselines/reference/ambientRequireFunction(module=preserve).js new file mode 100644 index 00000000000..348ee0a1443 --- /dev/null +++ b/tests/baselines/reference/ambientRequireFunction(module=preserve).js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/ambientRequireFunction.ts] //// + +//// [node.d.ts] +declare function require(moduleName: string): any; + +declare module "fs" { + export function readFileSync(s: string): string; +} + +//// [app.js] +/// + +const fs = require("fs"); +const text = fs.readFileSync("/a/b/c"); + +//// [app.js] +/// +var fs = require("fs"); +var text = fs.readFileSync("/a/b/c"); diff --git a/tests/baselines/reference/ambientRequireFunction(module=preserve).symbols b/tests/baselines/reference/ambientRequireFunction(module=preserve).symbols new file mode 100644 index 00000000000..c9c5a0cf279 --- /dev/null +++ b/tests/baselines/reference/ambientRequireFunction(module=preserve).symbols @@ -0,0 +1,29 @@ +//// [tests/cases/compiler/ambientRequireFunction.ts] //// + +=== app.js === +/// + +const fs = require("fs"); +>fs : Symbol(fs, Decl(app.js, 2, 5)) +>require : Symbol(require, Decl(node.d.ts, 0, 0)) +>"fs" : Symbol(fs, Decl(node.d.ts, 0, 50)) + +const text = fs.readFileSync("/a/b/c"); +>text : Symbol(text, Decl(app.js, 3, 5)) +>fs.readFileSync : Symbol(fs.readFileSync, Decl(node.d.ts, 2, 21)) +>fs : Symbol(fs, Decl(app.js, 2, 5)) +>readFileSync : Symbol(fs.readFileSync, Decl(node.d.ts, 2, 21)) + +=== node.d.ts === +declare function require(moduleName: string): any; +>require : Symbol(require, Decl(node.d.ts, 0, 0)) +>moduleName : Symbol(moduleName, Decl(node.d.ts, 0, 25)) + +declare module "fs" { +>"fs" : Symbol("fs", Decl(node.d.ts, 0, 50)) + + export function readFileSync(s: string): string; +>readFileSync : Symbol(readFileSync, Decl(node.d.ts, 2, 21)) +>s : Symbol(s, Decl(node.d.ts, 3, 33)) +} + diff --git a/tests/baselines/reference/ambientRequireFunction(module=preserve).types b/tests/baselines/reference/ambientRequireFunction(module=preserve).types new file mode 100644 index 00000000000..f395972c32b --- /dev/null +++ b/tests/baselines/reference/ambientRequireFunction(module=preserve).types @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/ambientRequireFunction.ts] //// + +=== app.js === +/// + +const fs = require("fs"); +>fs : typeof fs +>require("fs") : typeof fs +>require : (moduleName: string) => any +>"fs" : "fs" + +const text = fs.readFileSync("/a/b/c"); +>text : string +>fs.readFileSync("/a/b/c") : string +>fs.readFileSync : (s: string) => string +>fs : typeof fs +>readFileSync : (s: string) => string +>"/a/b/c" : "/a/b/c" + +=== node.d.ts === +declare function require(moduleName: string): any; +>require : (moduleName: string) => any +>moduleName : string + +declare module "fs" { +>"fs" : typeof import("fs") + + export function readFileSync(s: string): string; +>readFileSync : (s: string) => string +>s : string +} + diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1e433e55d63..d4e51ed1759 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3036,10 +3036,18 @@ declare namespace ts { ES6 = "ES6", ES2015 = "ES2015", ESNext = "ESNext", + Node16 = "Node16", + NodeNext = "NodeNext", + Preserve = "Preserve", } enum ModuleResolutionKind { Classic = "Classic", + /** @deprecated Renamed to `Node10` */ Node = "Node", + Node10 = "Node10", + Node16 = "Node16", + NodeNext = "NodeNext", + Bundler = "Bundler", } enum NewLineKind { Crlf = "Crlf", @@ -6660,6 +6668,22 @@ declare namespace ts { }; isSourceFileFromExternalLibrary(file: SourceFile): boolean; isSourceFileDefaultLibrary(file: SourceFile): boolean; + /** + * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import + * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may + * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other + * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no + * impact on module resolution, emit, or type checking. + */ + getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode; + /** + * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode + * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In + * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the + * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns + * `undefined`, as the result would have no impact on module resolution, emit, or type checking. + */ + getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode; getProjectReferences(): readonly ProjectReference[] | undefined; getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined; } @@ -7641,6 +7665,7 @@ declare namespace ts { ESNext = 99, Node16 = 100, NodeNext = 199, + Preserve = 200, } enum JsxEmit { None = 0, @@ -9902,25 +9927,38 @@ declare namespace ts { */ function getModeForFileReference(ref: FileReference | string, containingFileMode: ResolutionMode): ResolutionMode; /** - * Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly - * defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm). - * If you have an actual import node, prefer using getModeForUsageLocation on the reference string node. + * Use `program.getModeForResolutionAtIndex`, which retrieves the correct `compilerOptions`, instead of this function whenever possible. + * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode + * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In + * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the + * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns + * `undefined`, as the result would have no impact on module resolution, emit, or type checking. * @param file File to fetch the resolution mode within * @param index Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations + * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options + * should be the options of the referenced project, not the referencing project. */ - function getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode; + function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode; /** - * Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if - * one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm). - * Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when - * `moduleResolution` is `node16`+. + * Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible. + * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import + * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may + * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other + * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no + * impact on module resolution, emit, or type checking. * @param file The file the import or import-like reference is contained within * @param usage The module reference string + * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options + * should be the options of the referenced project, not the referencing project. * @returns The final resolution mode of the import */ - function getModeForUsageLocation(file: { - impliedNodeFormat?: ResolutionMode; - }, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined; + function getModeForUsageLocation( + file: { + impliedNodeFormat?: ResolutionMode; + }, + usage: StringLiteralLike, + compilerOptions: CompilerOptions, + ): ModuleKind.CommonJS | ModuleKind.ESNext | undefined; function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[]; /** * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the diff --git a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt index 2af730bfb9e..03d2b46a320 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', or 'nodenext', 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', or 'nodenext', 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', '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 (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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 52470b2456f..0ff7a8868b0 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', '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 (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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 52470b2456f..0ff7a8868b0 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', '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 (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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 b6d2d529f8b..b04ba9319bd 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 b6d2d529f8b..b04ba9319bd 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 955e5041b78..812d27fbe1a 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 955e5041b78..812d27fbe1a 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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/bundlerConditionsExcludesNode.errors.txt b/tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).errors.txt similarity index 100% rename from tests/baselines/reference/bundlerConditionsExcludesNode.errors.txt rename to tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).errors.txt diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode.js b/tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).js similarity index 100% rename from tests/baselines/reference/bundlerConditionsExcludesNode.js rename to tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).js diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode.symbols b/tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).symbols similarity index 100% rename from tests/baselines/reference/bundlerConditionsExcludesNode.symbols rename to tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).symbols diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode.trace.json b/tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).trace.json similarity index 100% rename from tests/baselines/reference/bundlerConditionsExcludesNode.trace.json rename to tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).trace.json diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode.types b/tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).types similarity index 100% rename from tests/baselines/reference/bundlerConditionsExcludesNode.types rename to tests/baselines/reference/bundlerConditionsExcludesNode(module=esnext).types diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).errors.txt b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).errors.txt new file mode 100644 index 00000000000..7a843cb155e --- /dev/null +++ b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).errors.txt @@ -0,0 +1,44 @@ +error TS6504: File '/node_modules/conditions/index.node.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 +error TS6504: File '/node_modules/conditions/index.web.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 + + +!!! error TS6504: File '/node_modules/conditions/index.node.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 +!!! error TS6504: File '/node_modules/conditions/index.web.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/conditions/package.json (0 errors) ==== + { + "name": "conditions", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "node": "./index.node.js", + "default": "./index.web.js" + } + } + } + +==== /node_modules/conditions/index.node.js (0 errors) ==== + export const node = 0; + +==== /node_modules/conditions/index.node.d.ts (0 errors) ==== + export const node: number; + +==== /node_modules/conditions/index.web.js (0 errors) ==== + export const web = 0; + +==== /node_modules/conditions/index.web.d.ts (0 errors) ==== + export const web: number; + +==== /main.ts (0 errors) ==== + import { web } from "conditions"; + \ No newline at end of file diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).js b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).js new file mode 100644 index 00000000000..6ec6fb5080f --- /dev/null +++ b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).js @@ -0,0 +1,34 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts] //// + +//// [package.json] +{ + "name": "conditions", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "node": "./index.node.js", + "default": "./index.web.js" + } + } + } + +//// [index.node.js] +export const node = 0; + +//// [index.node.d.ts] +export const node: number; + +//// [index.web.js] +export const web = 0; + +//// [index.web.d.ts] +export const web: number; + +//// [main.ts] +import { web } from "conditions"; + + +//// [main.js] diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).symbols b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).symbols new file mode 100644 index 00000000000..4d4c9b1d57d --- /dev/null +++ b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts] //// + +=== /node_modules/conditions/index.node.d.ts === +export const node: number; +>node : Symbol(node, Decl(index.node.d.ts, 0, 12)) + +=== /node_modules/conditions/index.web.d.ts === +export const web: number; +>web : Symbol(web, Decl(index.web.d.ts, 0, 12)) + +=== /main.ts === +import { web } from "conditions"; +>web : Symbol(web, Decl(main.ts, 0, 8)) + diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).trace.json b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).trace.json new file mode 100644 index 00000000000..0e5cd2eb567 --- /dev/null +++ b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).trace.json @@ -0,0 +1,93 @@ +[ + "======== Resolving module 'conditions' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "File '/package.json' does not exist.", + "Loading module 'conditions' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Found 'package.json' at '/node_modules/conditions/package.json'.", + "Entering conditional exports.", + "Saw non-matching condition 'node'.", + "Matched 'exports' condition 'default'.", + "Using 'exports' subpath '.' with target './index.web.js'.", + "File name '/node_modules/conditions/index.web.js' has a '.js' extension - stripping it.", + "File '/node_modules/conditions/index.web.ts' does not exist.", + "File '/node_modules/conditions/index.web.tsx' does not exist.", + "File '/node_modules/conditions/index.web.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'default'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/conditions/index.web.d.ts', result '/node_modules/conditions/index.web.d.ts'.", + "======== Module name 'conditions' was successfully resolved to '/node_modules/conditions/index.web.d.ts' with Package ID 'conditions/index.web.d.ts@1.0.0'. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).types b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).types new file mode 100644 index 00000000000..78f74b5c536 --- /dev/null +++ b/tests/baselines/reference/bundlerConditionsExcludesNode(module=preserve).types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts] //// + +=== /node_modules/conditions/index.node.d.ts === +export const node: number; +>node : number + +=== /node_modules/conditions/index.web.d.ts === +export const web: number; +>web : number + +=== /main.ts === +import { web } from "conditions"; +>web : number + diff --git a/tests/baselines/reference/bundlerImportESM.js b/tests/baselines/reference/bundlerImportESM(module=esnext).js similarity index 100% rename from tests/baselines/reference/bundlerImportESM.js rename to tests/baselines/reference/bundlerImportESM(module=esnext).js diff --git a/tests/baselines/reference/bundlerImportESM.symbols b/tests/baselines/reference/bundlerImportESM(module=esnext).symbols similarity index 100% rename from tests/baselines/reference/bundlerImportESM.symbols rename to tests/baselines/reference/bundlerImportESM(module=esnext).symbols diff --git a/tests/baselines/reference/bundlerImportESM.types b/tests/baselines/reference/bundlerImportESM(module=esnext).types similarity index 100% rename from tests/baselines/reference/bundlerImportESM.types rename to tests/baselines/reference/bundlerImportESM(module=esnext).types diff --git a/tests/baselines/reference/bundlerImportESM(module=preserve).js b/tests/baselines/reference/bundlerImportESM(module=preserve).js new file mode 100644 index 00000000000..ed877b14da7 --- /dev/null +++ b/tests/baselines/reference/bundlerImportESM(module=preserve).js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts] //// + +//// [esm.mts] +export const esm = 0; + +//// [not-actually-cjs.cts] +import { esm } from "./esm.mjs"; + +//// [package.json] +{ "type": "commonjs" } + +//// [still-not-cjs.ts] +import { esm } from "./esm.mjs"; + + +//// [esm.mjs] +export var esm = 0; +//// [not-actually-cjs.cjs] +//// [still-not-cjs.js] diff --git a/tests/baselines/reference/bundlerImportESM(module=preserve).symbols b/tests/baselines/reference/bundlerImportESM(module=preserve).symbols new file mode 100644 index 00000000000..d143f99424c --- /dev/null +++ b/tests/baselines/reference/bundlerImportESM(module=preserve).symbols @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts] //// + +=== /esm.mts === +export const esm = 0; +>esm : Symbol(esm, Decl(esm.mts, 0, 12)) + +=== /not-actually-cjs.cts === +import { esm } from "./esm.mjs"; +>esm : Symbol(esm, Decl(not-actually-cjs.cts, 0, 8)) + +=== /still-not-cjs.ts === +import { esm } from "./esm.mjs"; +>esm : Symbol(esm, Decl(still-not-cjs.ts, 0, 8)) + diff --git a/tests/baselines/reference/bundlerImportESM(module=preserve).types b/tests/baselines/reference/bundlerImportESM(module=preserve).types new file mode 100644 index 00000000000..5f0da560436 --- /dev/null +++ b/tests/baselines/reference/bundlerImportESM(module=preserve).types @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts] //// + +=== /esm.mts === +export const esm = 0; +>esm : 0 +>0 : 0 + +=== /not-actually-cjs.cts === +import { esm } from "./esm.mjs"; +>esm : 0 + +=== /still-not-cjs.ts === +import { esm } from "./esm.mjs"; +>esm : 0 + diff --git a/tests/baselines/reference/bundlerNodeModules1.errors.txt b/tests/baselines/reference/bundlerNodeModules1(module=esnext).errors.txt similarity index 100% rename from tests/baselines/reference/bundlerNodeModules1.errors.txt rename to tests/baselines/reference/bundlerNodeModules1(module=esnext).errors.txt diff --git a/tests/baselines/reference/bundlerNodeModules1.js b/tests/baselines/reference/bundlerNodeModules1(module=esnext).js similarity index 100% rename from tests/baselines/reference/bundlerNodeModules1.js rename to tests/baselines/reference/bundlerNodeModules1(module=esnext).js diff --git a/tests/baselines/reference/bundlerNodeModules1.symbols b/tests/baselines/reference/bundlerNodeModules1(module=esnext).symbols similarity index 100% rename from tests/baselines/reference/bundlerNodeModules1.symbols rename to tests/baselines/reference/bundlerNodeModules1(module=esnext).symbols diff --git a/tests/baselines/reference/bundlerNodeModules1.trace.json b/tests/baselines/reference/bundlerNodeModules1(module=esnext).trace.json similarity index 100% rename from tests/baselines/reference/bundlerNodeModules1.trace.json rename to tests/baselines/reference/bundlerNodeModules1(module=esnext).trace.json diff --git a/tests/baselines/reference/bundlerNodeModules1.types b/tests/baselines/reference/bundlerNodeModules1(module=esnext).types similarity index 100% rename from tests/baselines/reference/bundlerNodeModules1.types rename to tests/baselines/reference/bundlerNodeModules1(module=esnext).types diff --git a/tests/baselines/reference/bundlerNodeModules1(module=preserve).errors.txt b/tests/baselines/reference/bundlerNodeModules1(module=preserve).errors.txt new file mode 100644 index 00000000000..69921a8ce14 --- /dev/null +++ b/tests/baselines/reference/bundlerNodeModules1(module=preserve).errors.txt @@ -0,0 +1,59 @@ +error TS6504: File '/node_modules/dual/index.cjs' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Root file specified for compilation +error TS6504: File '/node_modules/dual/index.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,15): error TS2305: Module '"dual"' has no exported member 'cjs'. +/main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. +/main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. + + +!!! error TS6504: File '/node_modules/dual/index.cjs' 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 +!!! error TS6504: File '/node_modules/dual/index.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/dual/package.json (0 errors) ==== + { + "name": "dual", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "import": "./index.js", + "require": "./index.cjs" + } + } + } + +==== /node_modules/dual/index.js (0 errors) ==== + export const esm = 0; + +==== /node_modules/dual/index.d.ts (0 errors) ==== + export const esm: number; + +==== /node_modules/dual/index.cjs (0 errors) ==== + exports.cjs = 0; + +==== /node_modules/dual/index.d.cts (0 errors) ==== + export const cjs: number; + +==== /main.ts (1 errors) ==== + import { esm, cjs } from "dual"; + ~~~ +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. + +==== /main.mts (1 errors) ==== + import { esm, cjs } from "dual"; + ~~~ +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. + +==== /main.cts (1 errors) ==== + import { esm, cjs } from "dual"; + ~~~ +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. + \ No newline at end of file diff --git a/tests/baselines/reference/bundlerNodeModules1(module=preserve).js b/tests/baselines/reference/bundlerNodeModules1(module=preserve).js new file mode 100644 index 00000000000..6ba7482a647 --- /dev/null +++ b/tests/baselines/reference/bundlerNodeModules1(module=preserve).js @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts] //// + +//// [package.json] +{ + "name": "dual", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "import": "./index.js", + "require": "./index.cjs" + } + } +} + +//// [index.js] +export const esm = 0; + +//// [index.d.ts] +export const esm: number; + +//// [index.cjs] +exports.cjs = 0; + +//// [index.d.cts] +export const cjs: number; + +//// [main.ts] +import { esm, cjs } from "dual"; + +//// [main.mts] +import { esm, cjs } from "dual"; + +//// [main.cts] +import { esm, cjs } from "dual"; + + +//// [main.js] +//// [main.mjs] +//// [main.cjs] diff --git a/tests/baselines/reference/bundlerNodeModules1(module=preserve).symbols b/tests/baselines/reference/bundlerNodeModules1(module=preserve).symbols new file mode 100644 index 00000000000..04471bcc931 --- /dev/null +++ b/tests/baselines/reference/bundlerNodeModules1(module=preserve).symbols @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts] //// + +=== /node_modules/dual/index.d.ts === +export const esm: number; +>esm : Symbol(esm, Decl(index.d.ts, 0, 12)) + +=== /node_modules/dual/index.d.cts === +export const cjs: number; +>cjs : Symbol(cjs, Decl(index.d.cts, 0, 12)) + +=== /main.ts === +import { esm, cjs } from "dual"; +>esm : Symbol(esm, Decl(main.ts, 0, 8)) +>cjs : Symbol(cjs, Decl(main.ts, 0, 13)) + +=== /main.mts === +import { esm, cjs } from "dual"; +>esm : Symbol(esm, Decl(main.mts, 0, 8)) +>cjs : Symbol(cjs, Decl(main.mts, 0, 13)) + +=== /main.cts === +import { esm, cjs } from "dual"; +>esm : Symbol(esm, Decl(main.cts, 0, 8)) +>cjs : Symbol(cjs, Decl(main.cts, 0, 13)) + diff --git a/tests/baselines/reference/bundlerNodeModules1(module=preserve).trace.json b/tests/baselines/reference/bundlerNodeModules1(module=preserve).trace.json new file mode 100644 index 00000000000..b6d35e104cd --- /dev/null +++ b/tests/baselines/reference/bundlerNodeModules1(module=preserve).trace.json @@ -0,0 +1,98 @@ +[ + "======== Resolving module 'dual' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "File '/package.json' does not exist.", + "Loading module 'dual' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Found 'package.json' at '/node_modules/dual/package.json'.", + "Entering conditional exports.", + "Matched 'exports' condition 'import'.", + "Using 'exports' subpath '.' with target './index.js'.", + "File name '/node_modules/dual/index.js' has a '.js' extension - stripping it.", + "File '/node_modules/dual/index.ts' does not exist.", + "File '/node_modules/dual/index.tsx' does not exist.", + "File '/node_modules/dual/index.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'import'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/dual/index.d.ts', result '/node_modules/dual/index.d.ts'.", + "======== Module name 'dual' was successfully resolved to '/node_modules/dual/index.d.ts' with Package ID 'dual/index.d.ts@1.0.0'. ========", + "======== Resolving module 'dual' from '/main.mts'. ========", + "Resolution for module 'dual' was found in cache from location '/'.", + "======== Module name 'dual' was successfully resolved to '/node_modules/dual/index.d.ts' with Package ID 'dual/index.d.ts@1.0.0'. ========", + "======== Resolving module 'dual' from '/main.cts'. ========", + "Resolution for module 'dual' was found in cache from location '/'.", + "======== Module name 'dual' was successfully resolved to '/node_modules/dual/index.d.ts' with Package ID 'dual/index.d.ts@1.0.0'. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/bundlerNodeModules1(module=preserve).types b/tests/baselines/reference/bundlerNodeModules1(module=preserve).types new file mode 100644 index 00000000000..4fd828baaa4 --- /dev/null +++ b/tests/baselines/reference/bundlerNodeModules1(module=preserve).types @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts] //// + +=== /node_modules/dual/index.d.ts === +export const esm: number; +>esm : number + +=== /node_modules/dual/index.d.cts === +export const cjs: number; +>cjs : number + +=== /main.ts === +import { esm, cjs } from "dual"; +>esm : number +>cjs : any + +=== /main.mts === +import { esm, cjs } from "dual"; +>esm : number +>cjs : any + +=== /main.cts === +import { esm, cjs } from "dual"; +>esm : number +>cjs : any + diff --git a/tests/baselines/reference/bundlerOptionsCompat.errors.txt b/tests/baselines/reference/bundlerOptionsCompat.errors.txt index 7e765e198c6..ad59afcd2e6 100644 --- a/tests/baselines/reference/bundlerOptionsCompat.errors.txt +++ b/tests/baselines/reference/bundlerOptionsCompat.errors.txt @@ -1,4 +1,4 @@ -/tsconfig.json(4,25): error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +/tsconfig.json(4,25): error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /tsconfig.json (1 errors) ==== @@ -7,7 +7,7 @@ "module": "commonjs", "moduleResolution": "bundler", ~~~~~~~~~ -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. "noEmit": true } } diff --git a/tests/baselines/reference/bundlerRelative1.errors.txt b/tests/baselines/reference/bundlerRelative1(module=esnext).errors.txt similarity index 100% rename from tests/baselines/reference/bundlerRelative1.errors.txt rename to tests/baselines/reference/bundlerRelative1(module=esnext).errors.txt diff --git a/tests/baselines/reference/bundlerRelative1.js b/tests/baselines/reference/bundlerRelative1(module=esnext).js similarity index 100% rename from tests/baselines/reference/bundlerRelative1.js rename to tests/baselines/reference/bundlerRelative1(module=esnext).js diff --git a/tests/baselines/reference/bundlerRelative1.symbols b/tests/baselines/reference/bundlerRelative1(module=esnext).symbols similarity index 100% rename from tests/baselines/reference/bundlerRelative1.symbols rename to tests/baselines/reference/bundlerRelative1(module=esnext).symbols diff --git a/tests/baselines/reference/bundlerRelative1.trace.json b/tests/baselines/reference/bundlerRelative1(module=esnext).trace.json similarity index 100% rename from tests/baselines/reference/bundlerRelative1.trace.json rename to tests/baselines/reference/bundlerRelative1(module=esnext).trace.json diff --git a/tests/baselines/reference/bundlerRelative1.types b/tests/baselines/reference/bundlerRelative1(module=esnext).types similarity index 100% rename from tests/baselines/reference/bundlerRelative1.types rename to tests/baselines/reference/bundlerRelative1(module=esnext).types diff --git a/tests/baselines/reference/bundlerRelative1(module=preserve).errors.txt b/tests/baselines/reference/bundlerRelative1(module=preserve).errors.txt new file mode 100644 index 00000000000..738eafa1930 --- /dev/null +++ b/tests/baselines/reference/bundlerRelative1(module=preserve).errors.txt @@ -0,0 +1,39 @@ +/main.ts(4,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/main.ts(7,16): error TS2307: Cannot find module './redirect/index' or its corresponding type declarations. + + +==== /dir/index.ts (0 errors) ==== + export const x = 0; + +==== /redirect/package.json (0 errors) ==== + { "main": "../foo" } + +==== /foo/index.ts (0 errors) ==== + export const y = 0; + +==== /types/esm.d.ts (0 errors) ==== + declare const _: string; + export default _; + +==== /types/cjs.d.ts (0 errors) ==== + declare const _: string; + export = _; + +==== /main.ts (2 errors) ==== + import { x } from "./dir"; + import {} from "./dir/index"; + import {} from "./dir/index.js"; + import {} from "./dir/index.ts"; + ~~~~~~~~~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + + import { y } from "./redirect"; + import {} from "./redirect/index"; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './redirect/index' or its corresponding type declarations. + + import a from "./types/esm"; + import * as esm from "./types/esm"; + import b from "./types/cjs"; + import * as cjs from "./types/cjs"; + \ No newline at end of file diff --git a/tests/baselines/reference/bundlerRelative1(module=preserve).js b/tests/baselines/reference/bundlerRelative1(module=preserve).js new file mode 100644 index 00000000000..28c5ac26a7d --- /dev/null +++ b/tests/baselines/reference/bundlerRelative1(module=preserve).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts] //// + +//// [index.ts] +export const x = 0; + +//// [package.json] +{ "main": "../foo" } + +//// [index.ts] +export const y = 0; + +//// [esm.d.ts] +declare const _: string; +export default _; + +//// [cjs.d.ts] +declare const _: string; +export = _; + +//// [main.ts] +import { x } from "./dir"; +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +import {} from "./redirect/index"; + +import a from "./types/esm"; +import * as esm from "./types/esm"; +import b from "./types/cjs"; +import * as cjs from "./types/cjs"; + + +//// [index.js] +export var x = 0; +//// [index.js] +export var y = 0; +//// [main.js] diff --git a/tests/baselines/reference/bundlerRelative1(module=preserve).symbols b/tests/baselines/reference/bundlerRelative1(module=preserve).symbols new file mode 100644 index 00000000000..41db8dac77e --- /dev/null +++ b/tests/baselines/reference/bundlerRelative1(module=preserve).symbols @@ -0,0 +1,49 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts] //// + +=== /dir/index.ts === +export const x = 0; +>x : Symbol(x, Decl(index.ts, 0, 12)) + +=== /foo/index.ts === +export const y = 0; +>y : Symbol(y, Decl(index.ts, 0, 12)) + +=== /types/esm.d.ts === +declare const _: string; +>_ : Symbol(_, Decl(esm.d.ts, 0, 13)) + +export default _; +>_ : Symbol(_, Decl(esm.d.ts, 0, 13)) + +=== /types/cjs.d.ts === +declare const _: string; +>_ : Symbol(_, Decl(cjs.d.ts, 0, 13)) + +export = _; +>_ : Symbol(_, Decl(cjs.d.ts, 0, 13)) + +=== /main.ts === +import { x } from "./dir"; +>x : Symbol(x, Decl(main.ts, 0, 8)) + +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +>y : Symbol(y, Decl(main.ts, 5, 8)) + +import {} from "./redirect/index"; + +import a from "./types/esm"; +>a : Symbol(a, Decl(main.ts, 8, 6)) + +import * as esm from "./types/esm"; +>esm : Symbol(esm, Decl(main.ts, 9, 6)) + +import b from "./types/cjs"; +>b : Symbol(b, Decl(main.ts, 10, 6)) + +import * as cjs from "./types/cjs"; +>cjs : Symbol(cjs, Decl(main.ts, 11, 6)) + diff --git a/tests/baselines/reference/bundlerRelative1(module=preserve).trace.json b/tests/baselines/reference/bundlerRelative1(module=preserve).trace.json new file mode 100644 index 00000000000..c90d2d5fcf7 --- /dev/null +++ b/tests/baselines/reference/bundlerRelative1(module=preserve).trace.json @@ -0,0 +1,162 @@ +[ + "======== Resolving module './dir' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/dir', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/dir.ts' does not exist.", + "File '/dir.tsx' does not exist.", + "File '/dir.d.ts' does not exist.", + "File '/dir.js' does not exist.", + "File '/dir.jsx' does not exist.", + "File '/dir/package.json' does not exist.", + "File '/dir/index.ts' exists - use it as a name resolution result.", + "======== Module name './dir' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './dir/index' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/dir/index', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/dir/index.ts' exists - use it as a name resolution result.", + "======== Module name './dir/index' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './dir/index.js' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/dir/index.js', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File name '/dir/index.js' has a '.js' extension - stripping it.", + "File '/dir/index.ts' exists - use it as a name resolution result.", + "======== Module name './dir/index.js' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './dir/index.ts' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/dir/index.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File name '/dir/index.ts' has a '.ts' extension - stripping it.", + "File '/dir/index.ts' exists - use it as a name resolution result.", + "======== Module name './dir/index.ts' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './redirect' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/redirect', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/redirect.ts' does not exist.", + "File '/redirect.tsx' does not exist.", + "File '/redirect.d.ts' does not exist.", + "File '/redirect.js' does not exist.", + "File '/redirect.jsx' does not exist.", + "Found 'package.json' at '/redirect/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "'package.json' does not have a 'typings' field.", + "'package.json' does not have a 'types' field.", + "'package.json' has 'main' field '../foo' that references '/foo'.", + "File '/foo' does not exist.", + "Loading module as file / folder, candidate module location '/foo', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/foo.ts' does not exist.", + "File '/foo.tsx' does not exist.", + "File '/foo.d.ts' does not exist.", + "File '/foo.js' does not exist.", + "File '/foo.jsx' does not exist.", + "File '/foo/index.ts' exists - use it as a name resolution result.", + "======== Module name './redirect' was successfully resolved to '/foo/index.ts'. ========", + "======== Resolving module './redirect/index' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/redirect/index', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/redirect/index.ts' does not exist.", + "File '/redirect/index.tsx' does not exist.", + "File '/redirect/index.d.ts' does not exist.", + "File '/redirect/index.js' does not exist.", + "File '/redirect/index.jsx' does not exist.", + "Directory '/redirect/index' does not exist, skipping all lookups in it.", + "======== Module name './redirect/index' was not resolved. ========", + "======== Resolving module './types/esm' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/types/esm', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/types/esm.ts' does not exist.", + "File '/types/esm.tsx' does not exist.", + "File '/types/esm.d.ts' exists - use it as a name resolution result.", + "======== Module name './types/esm' was successfully resolved to '/types/esm.d.ts'. ========", + "======== Resolving module './types/cjs' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "Loading module as file / folder, candidate module location '/types/cjs', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/types/cjs.ts' does not exist.", + "File '/types/cjs.tsx' does not exist.", + "File '/types/cjs.d.ts' exists - use it as a name resolution result.", + "======== Module name './types/cjs' was successfully resolved to '/types/cjs.d.ts'. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/bundlerRelative1(module=preserve).types b/tests/baselines/reference/bundlerRelative1(module=preserve).types new file mode 100644 index 00000000000..50663cfe46e --- /dev/null +++ b/tests/baselines/reference/bundlerRelative1(module=preserve).types @@ -0,0 +1,51 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts] //// + +=== /dir/index.ts === +export const x = 0; +>x : 0 +>0 : 0 + +=== /foo/index.ts === +export const y = 0; +>y : 0 +>0 : 0 + +=== /types/esm.d.ts === +declare const _: string; +>_ : string + +export default _; +>_ : string + +=== /types/cjs.d.ts === +declare const _: string; +>_ : string + +export = _; +>_ : string + +=== /main.ts === +import { x } from "./dir"; +>x : 0 + +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +>y : 0 + +import {} from "./redirect/index"; + +import a from "./types/esm"; +>a : string + +import * as esm from "./types/esm"; +>esm : typeof esm + +import b from "./types/cjs"; +>b : string + +import * as cjs from "./types/cjs"; +>cjs : string + diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions.errors.txt b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).errors.txt similarity index 93% rename from tests/baselines/reference/bundlerSyntaxRestrictions.errors.txt rename to tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).errors.txt index e2f27150dcc..0883750c3d1 100644 --- a/tests/baselines/reference/bundlerSyntaxRestrictions.errors.txt +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).errors.txt @@ -25,12 +25,12 @@ error TS2468: Cannot find global value 'Promise'. import("./a"); ~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _ = require("./a"); // No resolution + const _ = require("./a"); _.a; // any ==== /main.ts (2 errors) ==== import {} from "./a"; - import _ = require("./a"); // Error + import _ = require("./a"); // Error in esnext ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. export = {}; // Error diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions.js b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js similarity index 83% rename from tests/baselines/reference/bundlerSyntaxRestrictions.js rename to tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js index a789516ae9a..ab856841dba 100644 --- a/tests/baselines/reference/bundlerSyntaxRestrictions.js +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).js @@ -18,12 +18,12 @@ declare module "path" { //// [mainJs.js] import {} from "./a"; import("./a"); -const _ = require("./a"); // No resolution +const _ = require("./a"); _.a; // any //// [main.ts] import {} from "./a"; -import _ = require("./a"); // Error +import _ = require("./a"); // Error in esnext export = {}; // Error export {}; @@ -35,7 +35,7 @@ export const a = "a"; export var a = "a"; //// [mainJs.js] import("./a"); -var _ = require("./a"); // No resolution +var _ = require("./a"); _.a; // any export {}; //// [main.js] diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions.symbols b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).symbols similarity index 83% rename from tests/baselines/reference/bundlerSyntaxRestrictions.symbols rename to tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).symbols index 84ff7ff9449..9f5246891c6 100644 --- a/tests/baselines/reference/bundlerSyntaxRestrictions.symbols +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).symbols @@ -33,18 +33,21 @@ declare module "path" { === /mainJs.js === import {} from "./a"; import("./a"); ->"./a" : Symbol("/a", Decl(a.ts, 0, 0)) +>"./a" : Symbol(_, Decl(a.ts, 0, 0)) -const _ = require("./a"); // No resolution +const _ = require("./a"); >_ : Symbol(_, Decl(mainJs.js, 2, 5)) >require : Symbol(require, Decl(index.d.ts, 0, 11)) +>"./a" : Symbol(_, Decl(a.ts, 0, 0)) _.a; // any +>_.a : Symbol(_.a, Decl(a.ts, 0, 12)) >_ : Symbol(_, Decl(mainJs.js, 2, 5)) +>a : Symbol(_.a, Decl(a.ts, 0, 12)) === /main.ts === import {} from "./a"; -import _ = require("./a"); // Error +import _ = require("./a"); // Error in esnext >_ : Symbol(_, Decl(main.ts, 0, 21)) export = {}; // Error diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions.types b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).types similarity index 80% rename from tests/baselines/reference/bundlerSyntaxRestrictions.types rename to tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).types index 7f0b80dac1d..310b8a83d26 100644 --- a/tests/baselines/reference/bundlerSyntaxRestrictions.types +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=esnext).types @@ -33,23 +33,23 @@ declare module "path" { === /mainJs.js === import {} from "./a"; import("./a"); ->import("./a") : Promise +>import("./a") : Promise >"./a" : "./a" -const _ = require("./a"); // No resolution ->_ : any ->require("./a") : any +const _ = require("./a"); +>_ : typeof _ +>require("./a") : typeof _ >require : (...args: any[]) => any >"./a" : "./a" _.a; // any ->_.a : any ->_ : any ->a : any +>_.a : "a" +>_ : typeof _ +>a : "a" === /main.ts === import {} from "./a"; -import _ = require("./a"); // Error +import _ = require("./a"); // Error in esnext >_ : typeof _ export = {}; // Error diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).errors.txt b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).errors.txt new file mode 100644 index 00000000000..7f3ea371532 --- /dev/null +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).errors.txt @@ -0,0 +1,37 @@ +error TS2468: Cannot find global value 'Promise'. +/mainJs.js(2,1): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + + +!!! error TS2468: Cannot find global value 'Promise'. +==== /node_modules/@types/node/index.d.ts (0 errors) ==== + declare var require: (...args: any[]) => any; + +==== /ambient.d.ts (0 errors) ==== + declare module "fs" { + export function readFileSync(path: string, encoding?: string): string; + } + declare module "path" { + import fs = require("fs"); // ok + namespace path { + export const sep: string; + } + export = path; // ok + } + +==== /mainJs.js (1 errors) ==== + import {} from "./a"; + import("./a"); + ~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + const _ = require("./a"); + _.a; // any + +==== /main.ts (0 errors) ==== + import {} from "./a"; + import _ = require("./a"); // Error in esnext + export = {}; // Error + export {}; + +==== /a.ts (0 errors) ==== + export const a = "a"; + \ No newline at end of file diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js new file mode 100644 index 00000000000..9a8cd79f58e --- /dev/null +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).js @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts] //// + +//// [index.d.ts] +declare var require: (...args: any[]) => any; + +//// [ambient.d.ts] +declare module "fs" { + export function readFileSync(path: string, encoding?: string): string; +} +declare module "path" { + import fs = require("fs"); // ok + namespace path { + export const sep: string; + } + export = path; // ok +} + +//// [mainJs.js] +import {} from "./a"; +import("./a"); +const _ = require("./a"); +_.a; // any + +//// [main.ts] +import {} from "./a"; +import _ = require("./a"); // Error in esnext +export = {}; // Error +export {}; + +//// [a.ts] +export const a = "a"; + + +//// [a.js] +export var a = "a"; +//// [mainJs.js] +import("./a"); +var _ = require("./a"); +_.a; // any +//// [main.js] +module.exports = {}; diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).symbols b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).symbols new file mode 100644 index 00000000000..9f5246891c6 --- /dev/null +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).symbols @@ -0,0 +1,59 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts] //// + +=== /node_modules/@types/node/index.d.ts === +declare var require: (...args: any[]) => any; +>require : Symbol(require, Decl(index.d.ts, 0, 11)) +>args : Symbol(args, Decl(index.d.ts, 0, 22)) + +=== /ambient.d.ts === +declare module "fs" { +>"fs" : Symbol("fs", Decl(ambient.d.ts, 0, 0)) + + export function readFileSync(path: string, encoding?: string): string; +>readFileSync : Symbol(readFileSync, Decl(ambient.d.ts, 0, 21)) +>path : Symbol(path, Decl(ambient.d.ts, 1, 33)) +>encoding : Symbol(encoding, Decl(ambient.d.ts, 1, 46)) +} +declare module "path" { +>"path" : Symbol("path", Decl(ambient.d.ts, 2, 1)) + + import fs = require("fs"); // ok +>fs : Symbol(fs, Decl(ambient.d.ts, 3, 23)) + + namespace path { +>path : Symbol(path, Decl(ambient.d.ts, 4, 30)) + + export const sep: string; +>sep : Symbol(sep, Decl(ambient.d.ts, 6, 20)) + } + export = path; // ok +>path : Symbol(path, Decl(ambient.d.ts, 4, 30)) +} + +=== /mainJs.js === +import {} from "./a"; +import("./a"); +>"./a" : Symbol(_, Decl(a.ts, 0, 0)) + +const _ = require("./a"); +>_ : Symbol(_, Decl(mainJs.js, 2, 5)) +>require : Symbol(require, Decl(index.d.ts, 0, 11)) +>"./a" : Symbol(_, Decl(a.ts, 0, 0)) + +_.a; // any +>_.a : Symbol(_.a, Decl(a.ts, 0, 12)) +>_ : Symbol(_, Decl(mainJs.js, 2, 5)) +>a : Symbol(_.a, Decl(a.ts, 0, 12)) + +=== /main.ts === +import {} from "./a"; +import _ = require("./a"); // Error in esnext +>_ : Symbol(_, Decl(main.ts, 0, 21)) + +export = {}; // Error +export {}; + +=== /a.ts === +export const a = "a"; +>a : Symbol(a, Decl(a.ts, 0, 12)) + diff --git a/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).types b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).types new file mode 100644 index 00000000000..310b8a83d26 --- /dev/null +++ b/tests/baselines/reference/bundlerSyntaxRestrictions(module=preserve).types @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts] //// + +=== /node_modules/@types/node/index.d.ts === +declare var require: (...args: any[]) => any; +>require : (...args: any[]) => any +>args : any[] + +=== /ambient.d.ts === +declare module "fs" { +>"fs" : typeof import("fs") + + export function readFileSync(path: string, encoding?: string): string; +>readFileSync : (path: string, encoding?: string) => string +>path : string +>encoding : string +} +declare module "path" { +>"path" : typeof import("path") + + import fs = require("fs"); // ok +>fs : typeof fs + + namespace path { +>path : typeof path + + export const sep: string; +>sep : string + } + export = path; // ok +>path : typeof path +} + +=== /mainJs.js === +import {} from "./a"; +import("./a"); +>import("./a") : Promise +>"./a" : "./a" + +const _ = require("./a"); +>_ : typeof _ +>require("./a") : typeof _ +>require : (...args: any[]) => any +>"./a" : "./a" + +_.a; // any +>_.a : "a" +>_ : typeof _ +>a : "a" + +=== /main.ts === +import {} from "./a"; +import _ = require("./a"); // Error in esnext +>_ : typeof _ + +export = {}; // Error +>{} : {} + +export {}; + +=== /a.ts === +export const a = "a"; +>a : "a" +>"a" : "a" + diff --git a/tests/baselines/reference/conditionalExportsResolutionFallback(moduleresolution=bundler).errors.txt b/tests/baselines/reference/conditionalExportsResolutionFallback(moduleresolution=bundler).errors.txt index 71d5b10190e..9c25a06c9c1 100644 --- a/tests/baselines/reference/conditionalExportsResolutionFallback(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/conditionalExportsResolutionFallback(moduleresolution=bundler).errors.txt @@ -1,7 +1,7 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /node_modules/dep/package.json (0 errors) ==== // This documents bug https://github.com/microsoft/TypeScript/issues/50762. 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 6eac0259505..1b39c0ab91d 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'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', '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 09dde5cc6ad..256ff72a951 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": "tsconfig.json" } Errors:: -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', '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 85fd807b945..c37fd14ef9c 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": "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'. +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'. 3 "module": "",    ~~ diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).errors.txt b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).errors.txt index 172906d3dc8..9e462a35eaf 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).errors.txt +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).errors.txt @@ -1,7 +1,7 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /node_modules/lodash/package.json (0 errors) ==== { "name": "lodash", diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).errors.txt b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).errors.txt index 172906d3dc8..9e462a35eaf 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).errors.txt +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).errors.txt @@ -1,7 +1,7 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /node_modules/lodash/package.json (0 errors) ==== { "name": "lodash", diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=preserve).js b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=preserve).js new file mode 100644 index 00000000000..47204b7a76f --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=preserve).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/extensionLoadingPriority(moduleresolution=bundler).errors.txt b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).errors.txt index bcb61b45b12..3ce0386d486 100644 --- a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).errors.txt @@ -1,7 +1,7 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /project/a.js (0 errors) ==== export default "a.js"; diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index c937b513914..f82c3d583d8 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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', or 'nodenext'. 3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. @@ -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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. a; b; c; diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index 44aeede5b99..90dc6fb333c 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. @@ -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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. a; b; c; diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt index e902dce6562..beba23ce610 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' or 'nodenext'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. ==== 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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export * from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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 e902dce6562..beba23ce610 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' or 'nodenext'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. ==== 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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export * from './0' assert { type: "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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 05054102cd7..dfd16488102 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' or 'nodenext'. -1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. ==== 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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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 88b174f0b1a..41f8ab32df2 100644 --- a/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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', or 'nodenext'. 3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. @@ -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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. a; b; c; diff --git a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt index e8259d6d217..960f5255433 100644 --- a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. @@ -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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. a; b; c; diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt index 0d4945bf1e5..144a6f27793 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' or 'nodenext'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. ==== 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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export * from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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 0d4945bf1e5..144a6f27793 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' or 'nodenext'. -1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. ==== 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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export * from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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 f34fea44998..23d166416e0 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' or 'nodenext'. -1.ts(2,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,31): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. ==== 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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/modulePreserve1.js b/tests/baselines/reference/modulePreserve1.js new file mode 100644 index 00000000000..f545b031d7d --- /dev/null +++ b/tests/baselines/reference/modulePreserve1.js @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/modulePreserve1.ts] //// + +//// [a.ts] +export class A {} + +//// [b.ts] +export = class B {} + +//// [main.ts] +import { A } from "./a"; +import B = require("./b"); +export { A, B }; + + +//// [a.js] +export class A { +} +//// [b.js] +module.exports = class B { +}; +//// [main.js] +import { A } from "./a"; +const B = require("./b"); +export { A, B }; diff --git a/tests/baselines/reference/modulePreserve1.symbols b/tests/baselines/reference/modulePreserve1.symbols new file mode 100644 index 00000000000..2e5f426bdf6 --- /dev/null +++ b/tests/baselines/reference/modulePreserve1.symbols @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/modulePreserve1.ts] //// + +=== /main.ts === +import { A } from "./a"; +>A : Symbol(A, Decl(main.ts, 0, 8)) + +import B = require("./b"); +>B : Symbol(B, Decl(main.ts, 0, 24)) + +export { A, B }; +>A : Symbol(A, Decl(main.ts, 2, 8)) +>B : Symbol(B, Decl(main.ts, 2, 11)) + +=== /a.ts === +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0)) + +=== /b.ts === +export = class B {} +>B : Symbol(B, Decl(b.ts, 0, 8)) + diff --git a/tests/baselines/reference/modulePreserve1.types b/tests/baselines/reference/modulePreserve1.types new file mode 100644 index 00000000000..1cd6b13296f --- /dev/null +++ b/tests/baselines/reference/modulePreserve1.types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/modulePreserve1.ts] //// + +=== /main.ts === +import { A } from "./a"; +>A : typeof A + +import B = require("./b"); +>B : typeof B + +export { A, B }; +>A : typeof A +>B : typeof B + +=== /a.ts === +export class A {} +>A : A + +=== /b.ts === +export = class B {} +>class B {} : typeof B +>B : typeof B + diff --git a/tests/baselines/reference/modulePreserve2.symbols b/tests/baselines/reference/modulePreserve2.symbols new file mode 100644 index 00000000000..57e9232fef1 --- /dev/null +++ b/tests/baselines/reference/modulePreserve2.symbols @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/modulePreserve2.ts] //// + +=== /main.js === +import { esm } from "dep"; +>esm : Symbol(esm, Decl(main.js, 0, 8)) + +const cjs = require("dep"); +>cjs : Symbol(cjs, Decl(main.js, 1, 5)) +>require : Symbol(require) +>"dep" : Symbol("/node_modules/dep/require", Decl(require.d.ts, 0, 0)) + +=== /node_modules/dep/import.d.mts === +export const esm: "esm"; +>esm : Symbol(esm, Decl(import.d.mts, 0, 12)) + +=== /node_modules/dep/require.d.ts === +declare const cjs: "cjs"; +>cjs : Symbol(cjs, Decl(require.d.ts, 0, 13)) + +export = cjs; +>cjs : Symbol(cjs, Decl(require.d.ts, 0, 13)) + diff --git a/tests/baselines/reference/modulePreserve2.trace.json b/tests/baselines/reference/modulePreserve2.trace.json new file mode 100644 index 00000000000..e8f128fcc14 --- /dev/null +++ b/tests/baselines/reference/modulePreserve2.trace.json @@ -0,0 +1,902 @@ +[ + "======== Resolving module 'dep' from '/main.js'. ========", + "Module resolution kind is not specified, using 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "File '/package.json' does not exist.", + "Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Found 'package.json' at '/node_modules/dep/package.json'.", + "Entering conditional exports.", + "Matched 'exports' condition 'import'.", + "Using 'exports' subpath '.' with target './import.mjs'.", + "File name '/node_modules/dep/import.mjs' has a '.mjs' extension - stripping it.", + "File '/node_modules/dep/import.mts' does not exist.", + "File '/node_modules/dep/import.d.mts' exists - use it as a name resolution result.", + "Resolved under condition 'import'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/dep/import.d.mts', result '/node_modules/dep/import.d.mts'.", + "======== Module name 'dep' was successfully resolved to '/node_modules/dep/import.d.mts'. ========", + "======== Resolving module 'dep' from '/main.js'. ========", + "Module resolution kind is not specified, using 'Bundler'.", + "Resolving in CJS mode with conditions 'require', 'types'.", + "File '/package.json' does not exist according to earlier cached lookups.", + "Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/dep/package.json' exists according to earlier cached lookups.", + "Entering conditional exports.", + "Saw non-matching condition 'import'.", + "Matched 'exports' condition 'require'.", + "Using 'exports' subpath '.' with target './require.js'.", + "File name '/node_modules/dep/require.js' has a '.js' extension - stripping it.", + "File '/node_modules/dep/require.ts' does not exist.", + "File '/node_modules/dep/require.tsx' does not exist.", + "File '/node_modules/dep/require.d.ts' exists - use it as a name resolution result.", + "Resolved under condition 'require'.", + "Exiting conditional exports.", + "Resolving real path for '/node_modules/dep/require.d.ts', result '/node_modules/dep/require.d.ts'.", + "======== Module name 'dep' was successfully resolved to '/node_modules/dep/require.d.ts'. ========", + "======== Resolving module '@typescript/lib-esnext' from '/.src/__lib_node_modules_lookup_lib.esnext.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext' 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-esnext'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext'", + "Loading module '@typescript/lib-esnext' 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-esnext' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023' from '/.src/__lib_node_modules_lookup_lib.es2023.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023' 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-es2023'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023'", + "Loading module '@typescript/lib-es2023' 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-es2023' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/object' from '/.src/__lib_node_modules_lookup_lib.es2017.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/intl' from '/.src/__lib_node_modules_lookup_lib.es2017.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/typedarrays' from '/.src/__lib_node_modules_lookup_lib.es2017.typedarrays.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/date' from '/.src/__lib_node_modules_lookup_lib.es2017.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asynciterable' from '/.src/__lib_node_modules_lookup_lib.es2018.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2022.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/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-es2022/sharedmemory'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/sharedmemory'", + "Loading module '@typescript/lib-es2022/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-es2022/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/regexp' from '/.src/__lib_node_modules_lookup_lib.es2022.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/array' from '/.src/__lib_node_modules_lookup_lib.es2023.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/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-es2023/array'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/array'", + "Loading module '@typescript/lib-es2023/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-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/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-es2023/collection'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/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-es2023/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/intl'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext/intl'", + "Loading module '@typescript/lib-esnext/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-esnext/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/decorators' from '/.src/__lib_node_modules_lookup_lib.esnext.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/decorators'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext/decorators'", + "Loading module '@typescript/lib-esnext/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-esnext/decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/disposable' from '/.src/__lib_node_modules_lookup_lib.esnext.disposable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/disposable' 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-esnext/disposable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext/disposable'", + "Loading module '@typescript/lib-esnext/disposable' 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-esnext/disposable' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/promise'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext/promise'", + "Loading module '@typescript/lib-esnext/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-esnext/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/object' from '/.src/__lib_node_modules_lookup_lib.esnext.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/object'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext/object'", + "Loading module '@typescript/lib-esnext/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-esnext/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/collection' from '/.src/__lib_node_modules_lookup_lib.esnext.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/collection'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-esnext/collection'", + "Loading module '@typescript/lib-esnext/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-esnext/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/modulePreserve2.types b/tests/baselines/reference/modulePreserve2.types new file mode 100644 index 00000000000..50d0cfeb389 --- /dev/null +++ b/tests/baselines/reference/modulePreserve2.types @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/modulePreserve2.ts] //// + +=== /main.js === +import { esm } from "dep"; +>esm : "esm" + +const cjs = require("dep"); +>cjs : "cjs" +>require("dep") : "cjs" +>require : any +>"dep" : "dep" + +=== /node_modules/dep/import.d.mts === +export const esm: "esm"; +>esm : "esm" + +=== /node_modules/dep/require.d.ts === +declare const cjs: "cjs"; +>cjs : "cjs" + +export = cjs; +>cjs : "cjs" + diff --git a/tests/baselines/reference/modulePreserve3.errors.txt b/tests/baselines/reference/modulePreserve3.errors.txt new file mode 100644 index 00000000000..4a322679eb9 --- /dev/null +++ b/tests/baselines/reference/modulePreserve3.errors.txt @@ -0,0 +1,15 @@ +error TS2688: Cannot find type definition file for 'react'. + The file is in the program because: + Entry point for implicit type library 'react' + + +!!! error TS2688: Cannot find type definition file for 'react'. +!!! error TS2688: The file is in the program because: +!!! error TS2688: Entry point for implicit type library 'react' +==== /node_modules/@types/react/jsx-runtime.d.ts (0 errors) ==== + export namespace JSX {} + +==== /index.tsx (0 errors) ==== + export {}; + (
); + \ No newline at end of file diff --git a/tests/baselines/reference/modulePreserve3.trace.json b/tests/baselines/reference/modulePreserve3.trace.json new file mode 100644 index 00000000000..35f43171f4a --- /dev/null +++ b/tests/baselines/reference/modulePreserve3.trace.json @@ -0,0 +1,831 @@ +[ + "======== Resolving module 'react/jsx-runtime' from '/index.tsx'. ========", + "Module resolution kind is not specified, using 'Bundler'.", + "Resolving in CJS mode with conditions 'import', 'types'.", + "File '/package.json' does not exist.", + "Loading module 'react/jsx-runtime' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "File '/node_modules/@types/react/package.json' does not exist.", + "File '/node_modules/@types/react/jsx-runtime.d.ts' exists - use it as a name resolution result.", + "Resolving real path for '/node_modules/@types/react/jsx-runtime.d.ts', result '/node_modules/@types/react/jsx-runtime.d.ts'.", + "======== Module name 'react/jsx-runtime' was successfully resolved to '/node_modules/@types/react/jsx-runtime.d.ts'. ========", + "======== Resolving type reference directive 'react', containing file '/.src/__inferred type names__.ts', root directory '/.src/node_modules/@types,/node_modules/@types'. ========", + "Resolving with primary search path '/.src/node_modules/@types, /node_modules/@types'.", + "Directory '/.src/node_modules/@types' does not exist, skipping all lookups in it.", + "File '/node_modules/@types/react/package.json' does not exist according to earlier cached lookups.", + "File '/node_modules/@types/react/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/.src'.", + "Searching all ancestor node_modules directories for preferred extensions: Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "File '/node_modules/react.d.ts' does not exist.", + "File '/node_modules/@types/react/package.json' does not exist according to earlier cached lookups.", + "File '/node_modules/@types/react.d.ts' does not exist.", + "File '/node_modules/@types/react/index.d.ts' does not exist.", + "======== Type reference directive 'react' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext' from '/.src/__lib_node_modules_lookup_lib.esnext.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext' 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-esnext'", + "Scoped package detected, looking in 'typescript__lib-esnext'", + "File '/node_modules/@types/typescript__lib-esnext.d.ts' does not exist.", + "Loading module '@typescript/lib-esnext' 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-esnext' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023' from '/.src/__lib_node_modules_lookup_lib.es2023.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023' 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-es2023'", + "Scoped package detected, looking in 'typescript__lib-es2023'", + "File '/node_modules/@types/typescript__lib-es2023.d.ts' does not exist.", + "Loading module '@typescript/lib-es2023' 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-es2023' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "Scoped package detected, looking in 'typescript__lib-es2022'", + "File '/node_modules/@types/typescript__lib-es2022.d.ts' does not exist.", + "Loading module '@typescript/lib-es2022' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021' from '/.src/__lib_node_modules_lookup_lib.es2021.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "Scoped package detected, looking in 'typescript__lib-es2021'", + "File '/node_modules/@types/typescript__lib-es2021.d.ts' does not exist.", + "Loading module '@typescript/lib-es2021' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020' from '/.src/__lib_node_modules_lookup_lib.es2020.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "Scoped package detected, looking in 'typescript__lib-es2020'", + "File '/node_modules/@types/typescript__lib-es2020.d.ts' does not exist.", + "Loading module '@typescript/lib-es2020' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019' from '/.src/__lib_node_modules_lookup_lib.es2019.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "Scoped package detected, looking in 'typescript__lib-es2019'", + "File '/node_modules/@types/typescript__lib-es2019.d.ts' does not exist.", + "Loading module '@typescript/lib-es2019' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018' from '/.src/__lib_node_modules_lookup_lib.es2018.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "Scoped package detected, looking in 'typescript__lib-es2018'", + "File '/node_modules/@types/typescript__lib-es2018.d.ts' does not exist.", + "Loading module '@typescript/lib-es2018' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017' from '/.src/__lib_node_modules_lookup_lib.es2017.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "Scoped package detected, looking in 'typescript__lib-es2017'", + "File '/node_modules/@types/typescript__lib-es2017.d.ts' does not exist.", + "Loading module '@typescript/lib-es2017' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016' from '/.src/__lib_node_modules_lookup_lib.es2016.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "Scoped package detected, looking in 'typescript__lib-es2016'", + "File '/node_modules/@types/typescript__lib-es2016.d.ts' does not exist.", + "Loading module '@typescript/lib-es2016' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015' from '/.src/__lib_node_modules_lookup_lib.es2015.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "Scoped package detected, looking in 'typescript__lib-es2015'", + "File '/node_modules/@types/typescript__lib-es2015.d.ts' does not exist.", + "Loading module '@typescript/lib-es2015' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015' was not resolved. ========", + "======== Resolving module '@typescript/lib-es5' from '/.src/__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es5'", + "Scoped package detected, looking in 'typescript__lib-es5'", + "File '/node_modules/@types/typescript__lib-es5.d.ts' does not exist.", + "Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es5' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators' from '/.src/__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "Scoped package detected, looking in 'typescript__lib-decorators'", + "File '/node_modules/@types/typescript__lib-decorators.d.ts' does not exist.", + "Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-decorators/legacy' from '/.src/__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Scoped package detected, looking in 'typescript__lib-decorators/legacy'", + "Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/core' from '/.src/__lib_node_modules_lookup_lib.es2015.core.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Scoped package detected, looking in 'typescript__lib-es2015/core'", + "Loading module '@typescript/lib-es2015/core' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/core' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/collection' from '/.src/__lib_node_modules_lookup_lib.es2015.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Scoped package detected, looking in 'typescript__lib-es2015/collection'", + "Loading module '@typescript/lib-es2015/collection' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/iterable' from '/.src/__lib_node_modules_lookup_lib.es2015.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Scoped package detected, looking in 'typescript__lib-es2015/iterable'", + "Loading module '@typescript/lib-es2015/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol'", + "Loading module '@typescript/lib-es2015/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/generator' from '/.src/__lib_node_modules_lookup_lib.es2015.generator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Scoped package detected, looking in 'typescript__lib-es2015/generator'", + "Loading module '@typescript/lib-es2015/generator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/generator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/promise' from '/.src/__lib_node_modules_lookup_lib.es2015.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Scoped package detected, looking in 'typescript__lib-es2015/promise'", + "Loading module '@typescript/lib-es2015/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/proxy' from '/.src/__lib_node_modules_lookup_lib.es2015.proxy.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Scoped package detected, looking in 'typescript__lib-es2015/proxy'", + "Loading module '@typescript/lib-es2015/proxy' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/proxy' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/reflect' from '/.src/__lib_node_modules_lookup_lib.es2015.reflect.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Scoped package detected, looking in 'typescript__lib-es2015/reflect'", + "Loading module '@typescript/lib-es2015/reflect' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/reflect' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2015/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2015.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Scoped package detected, looking in 'typescript__lib-es2015/symbol-wellknown'", + "Loading module '@typescript/lib-es2015/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2015/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/array-include' from '/.src/__lib_node_modules_lookup_lib.es2016.array.include.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Scoped package detected, looking in 'typescript__lib-es2016/array-include'", + "Loading module '@typescript/lib-es2016/array-include' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/array-include' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2016/intl' from '/.src/__lib_node_modules_lookup_lib.es2016.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Scoped package detected, looking in 'typescript__lib-es2016/intl'", + "Loading module '@typescript/lib-es2016/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2016/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/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'", + "Scoped package detected, looking in 'typescript__lib-es2017/object'", + "Loading module '@typescript/lib-es2017/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2017.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Scoped package detected, looking in 'typescript__lib-es2017/sharedmemory'", + "Loading module '@typescript/lib-es2017/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/string' from '/.src/__lib_node_modules_lookup_lib.es2017.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Scoped package detected, looking in 'typescript__lib-es2017/string'", + "Loading module '@typescript/lib-es2017/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/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'", + "Scoped package detected, looking in 'typescript__lib-es2017/intl'", + "Loading module '@typescript/lib-es2017/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2017/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'", + "Scoped package detected, looking in 'typescript__lib-es2017/typedarrays'", + "Loading module '@typescript/lib-es2017/typedarrays' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/typedarrays' was not resolved. ========", + "======== Resolving module '@typescript/lib-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'", + "Scoped package detected, looking in 'typescript__lib-es2017/date'", + "Loading module '@typescript/lib-es2017/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2017/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-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'", + "Scoped package detected, looking in 'typescript__lib-es2018/asynciterable'", + "Loading module '@typescript/lib-es2018/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asynciterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/asyncgenerator' from '/.src/__lib_node_modules_lookup_lib.es2018.asyncgenerator.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Scoped package detected, looking in 'typescript__lib-es2018/asyncgenerator'", + "Loading module '@typescript/lib-es2018/asyncgenerator' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/asyncgenerator' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/promise' from '/.src/__lib_node_modules_lookup_lib.es2018.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Scoped package detected, looking in 'typescript__lib-es2018/promise'", + "Loading module '@typescript/lib-es2018/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/regexp' from '/.src/__lib_node_modules_lookup_lib.es2018.regexp.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Scoped package detected, looking in 'typescript__lib-es2018/regexp'", + "Loading module '@typescript/lib-es2018/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2018/intl' from '/.src/__lib_node_modules_lookup_lib.es2018.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Scoped package detected, looking in 'typescript__lib-es2018/intl'", + "Loading module '@typescript/lib-es2018/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2018/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/array' from '/.src/__lib_node_modules_lookup_lib.es2019.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Scoped package detected, looking in 'typescript__lib-es2019/array'", + "Loading module '@typescript/lib-es2019/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/object' from '/.src/__lib_node_modules_lookup_lib.es2019.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Scoped package detected, looking in 'typescript__lib-es2019/object'", + "Loading module '@typescript/lib-es2019/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/string' from '/.src/__lib_node_modules_lookup_lib.es2019.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Scoped package detected, looking in 'typescript__lib-es2019/string'", + "Loading module '@typescript/lib-es2019/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/symbol' from '/.src/__lib_node_modules_lookup_lib.es2019.symbol.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Scoped package detected, looking in 'typescript__lib-es2019/symbol'", + "Loading module '@typescript/lib-es2019/symbol' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/symbol' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2019/intl' from '/.src/__lib_node_modules_lookup_lib.es2019.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Scoped package detected, looking in 'typescript__lib-es2019/intl'", + "Loading module '@typescript/lib-es2019/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2019/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/bigint' from '/.src/__lib_node_modules_lookup_lib.es2020.bigint.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Scoped package detected, looking in 'typescript__lib-es2020/bigint'", + "Loading module '@typescript/lib-es2020/bigint' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/bigint' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/intl' from '/.src/__lib_node_modules_lookup_lib.es2020.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Scoped package detected, looking in 'typescript__lib-es2020/intl'", + "Loading module '@typescript/lib-es2020/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/date' from '/.src/__lib_node_modules_lookup_lib.es2020.date.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Scoped package detected, looking in 'typescript__lib-es2020/date'", + "Loading module '@typescript/lib-es2020/date' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/date' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/number' from '/.src/__lib_node_modules_lookup_lib.es2020.number.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Scoped package detected, looking in 'typescript__lib-es2020/number'", + "Loading module '@typescript/lib-es2020/number' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/number' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/promise' from '/.src/__lib_node_modules_lookup_lib.es2020.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Scoped package detected, looking in 'typescript__lib-es2020/promise'", + "Loading module '@typescript/lib-es2020/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2020.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Scoped package detected, looking in 'typescript__lib-es2020/sharedmemory'", + "Loading module '@typescript/lib-es2020/sharedmemory' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/string' from '/.src/__lib_node_modules_lookup_lib.es2020.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Scoped package detected, looking in 'typescript__lib-es2020/string'", + "Loading module '@typescript/lib-es2020/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2020/symbol-wellknown' from '/.src/__lib_node_modules_lookup_lib.es2020.symbol.wellknown.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Scoped package detected, looking in 'typescript__lib-es2020/symbol-wellknown'", + "Loading module '@typescript/lib-es2020/symbol-wellknown' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2020/symbol-wellknown' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/promise' from '/.src/__lib_node_modules_lookup_lib.es2021.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Scoped package detected, looking in 'typescript__lib-es2021/promise'", + "Loading module '@typescript/lib-es2021/promise' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/string' from '/.src/__lib_node_modules_lookup_lib.es2021.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Scoped package detected, looking in 'typescript__lib-es2021/string'", + "Loading module '@typescript/lib-es2021/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/weakref' from '/.src/__lib_node_modules_lookup_lib.es2021.weakref.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Scoped package detected, looking in 'typescript__lib-es2021/weakref'", + "Loading module '@typescript/lib-es2021/weakref' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/weakref' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2021/intl' from '/.src/__lib_node_modules_lookup_lib.es2021.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Scoped package detected, looking in 'typescript__lib-es2021/intl'", + "Loading module '@typescript/lib-es2021/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2021/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/array' from '/.src/__lib_node_modules_lookup_lib.es2022.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Scoped package detected, looking in 'typescript__lib-es2022/array'", + "Loading module '@typescript/lib-es2022/array' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/error' from '/.src/__lib_node_modules_lookup_lib.es2022.error.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Scoped package detected, looking in 'typescript__lib-es2022/error'", + "Loading module '@typescript/lib-es2022/error' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/error' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/intl' from '/.src/__lib_node_modules_lookup_lib.es2022.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Scoped package detected, looking in 'typescript__lib-es2022/intl'", + "Loading module '@typescript/lib-es2022/intl' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/object' from '/.src/__lib_node_modules_lookup_lib.es2022.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Scoped package detected, looking in 'typescript__lib-es2022/object'", + "Loading module '@typescript/lib-es2022/object' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/sharedmemory' from '/.src/__lib_node_modules_lookup_lib.es2022.sharedmemory.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/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-es2022/sharedmemory'", + "Scoped package detected, looking in 'typescript__lib-es2022/sharedmemory'", + "Loading module '@typescript/lib-es2022/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-es2022/sharedmemory' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2022/string' from '/.src/__lib_node_modules_lookup_lib.es2022.string.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Scoped package detected, looking in 'typescript__lib-es2022/string'", + "Loading module '@typescript/lib-es2022/string' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/string' was not resolved. ========", + "======== Resolving module '@typescript/lib-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'", + "Scoped package detected, looking in 'typescript__lib-es2022/regexp'", + "Loading module '@typescript/lib-es2022/regexp' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-es2022/regexp' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/array' from '/.src/__lib_node_modules_lookup_lib.es2023.array.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/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-es2023/array'", + "Scoped package detected, looking in 'typescript__lib-es2023/array'", + "Loading module '@typescript/lib-es2023/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-es2023/array' was not resolved. ========", + "======== Resolving module '@typescript/lib-es2023/collection' from '/.src/__lib_node_modules_lookup_lib.es2023.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-es2023/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-es2023/collection'", + "Scoped package detected, looking in 'typescript__lib-es2023/collection'", + "Loading module '@typescript/lib-es2023/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-es2023/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/intl' from '/.src/__lib_node_modules_lookup_lib.esnext.intl.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/intl'", + "Scoped package detected, looking in 'typescript__lib-esnext/intl'", + "Loading module '@typescript/lib-esnext/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-esnext/intl' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/decorators' from '/.src/__lib_node_modules_lookup_lib.esnext.decorators.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/decorators'", + "Scoped package detected, looking in 'typescript__lib-esnext/decorators'", + "Loading module '@typescript/lib-esnext/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-esnext/decorators' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/disposable' from '/.src/__lib_node_modules_lookup_lib.esnext.disposable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/disposable' 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-esnext/disposable'", + "Scoped package detected, looking in 'typescript__lib-esnext/disposable'", + "Loading module '@typescript/lib-esnext/disposable' 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-esnext/disposable' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/promise'", + "Scoped package detected, looking in 'typescript__lib-esnext/promise'", + "Loading module '@typescript/lib-esnext/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-esnext/promise' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/object' from '/.src/__lib_node_modules_lookup_lib.esnext.object.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/object'", + "Scoped package detected, looking in 'typescript__lib-esnext/object'", + "Loading module '@typescript/lib-esnext/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-esnext/object' was not resolved. ========", + "======== Resolving module '@typescript/lib-esnext/collection' from '/.src/__lib_node_modules_lookup_lib.esnext.collection.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-esnext/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-esnext/collection'", + "Scoped package detected, looking in 'typescript__lib-esnext/collection'", + "Loading module '@typescript/lib-esnext/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-esnext/collection' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom' from '/.src/__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom'", + "Scoped package detected, looking in 'typescript__lib-dom'", + "File '/node_modules/@types/typescript__lib-dom.d.ts' does not exist.", + "Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom' was not resolved. ========", + "======== Resolving module '@typescript/lib-webworker/importscripts' from '/.src/__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Scoped package detected, looking in 'typescript__lib-webworker/importscripts'", + "Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========", + "======== Resolving module '@typescript/lib-scripthost' from '/.src/__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "Scoped package detected, looking in 'typescript__lib-scripthost'", + "File '/node_modules/@types/typescript__lib-scripthost.d.ts' does not exist.", + "Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-scripthost' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/iterable' from '/.src/__lib_node_modules_lookup_lib.dom.iterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Scoped package detected, looking in 'typescript__lib-dom/iterable'", + "Loading module '@typescript/lib-dom/iterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/iterable' was not resolved. ========", + "======== Resolving module '@typescript/lib-dom/asynciterable' from '/.src/__lib_node_modules_lookup_lib.dom.asynciterable.d.ts__.ts'. ========", + "Explicitly specified module resolution kind: 'Node10'.", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: TypeScript, Declaration.", + "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Scoped package detected, looking in 'typescript__lib-dom/asynciterable'", + "Loading module '@typescript/lib-dom/asynciterable' from 'node_modules' folder, target file types: JavaScript.", + "Searching all ancestor node_modules directories for fallback extensions: JavaScript.", + "Directory '/.src/node_modules' does not exist, skipping all lookups in it.", + "======== Module name '@typescript/lib-dom/asynciterable' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/modulePreserve4.errors.txt b/tests/baselines/reference/modulePreserve4.errors.txt new file mode 100644 index 00000000000..fa8baeb0c39 --- /dev/null +++ b/tests/baselines/reference/modulePreserve4.errors.txt @@ -0,0 +1,132 @@ +/a.js(2,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +/main1.ts(1,13): error TS2305: Module '"./a"' has no exported member 'y'. +/main1.ts(3,12): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +/main1.ts(19,4): error TS2339: Property 'default' does not exist on type '() => void'. +/main2.mts(1,13): error TS2305: Module '"./a"' has no exported member 'y'. +/main2.mts(4,4): error TS2339: Property 'default' does not exist on type 'typeof import("/a")'. +/main2.mts(5,12): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +/main3.cjs(1,13): error TS2305: Module '"./a"' has no exported member 'y'. +/main3.cjs(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. + + +==== /a.js (1 errors) ==== + export const x = 0; + module.exports.y = 0; // Error + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + +==== /b.ts (0 errors) ==== + export default 0; + +==== /c.ts (0 errors) ==== + export = { + default: function() {} + }; + +==== /d.ts (0 errors) ==== + export = function() {}; + +==== /e.mts (0 errors) ==== + export = 0; + +==== /f.cts (0 errors) ==== + export default 0; + +==== /g.js (0 errors) ==== + exports.default = 0; + +==== /main1.ts (3 errors) ==== + import { x, y } from "./a"; // No y + ~ +!!! error TS2305: Module '"./a"' has no exported member 'y'. + import a1 = require("./a"); // { x: 0 } + const a2 = require("./a"); // Error in TS + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + const a3 = await import("./a"); // { x: 0 } + a3.x; + + import b1 from "./b"; // 0 + import b2 = require("./b"); // { default: 0 } + b2.default; + const b3 = await import("./b"); // { default: 0 } + b3.default; + + import c1 from "./c"; // { default: [Function: default] } + import c2 = require("./c"); // { default: [Function: default] } + c2.default; + import d1 from "./d"; // [Function: default] + import d2 = require("./d"); // [Function: default] + d2(); + d2.default(); // Error + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type '() => void'. + const d3 = await import("./d"); // { default: [Function: default] } + d3.default(); + + import e1 from "./e.mjs"; // 0 + import e2 = require("./e.mjs"); // 0 + import f1 from "./f.cjs"; // 0 + import f2 = require("./f.cjs"); // { default: 0 } + f2.default; + + import g1 from "./g"; // { default: 0 } + g1.default; + import g2 = require("./g"); // { default: 0 } + g2.default; + +==== /main2.mts (3 errors) ==== + import { x, y } from "./a"; // No y + ~ +!!! error TS2305: Module '"./a"' has no exported member 'y'. + import a1 = require("./a"); // { x: 0 } + a1.x; + a1.default.x; // Arguably should exist but doesn't + ~~~~~~~ +!!! error TS2339: Property 'default' does not exist on type 'typeof import("/a")'. + const a2 = require("./a"); // Error in TS + ~~~~~~~ +!!! error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + + import b1 from "./b"; // 0 + import b2 = require("./b"); // { default: 0 } + + import c1 from "./c"; // { default: [Function: default] } + import c2 = require("./c"); // { default: [Function: default] } + import d1 from "./d"; // [Function: default] + import d2 = require("./d"); // [Function: default] + import e1 from "./e.mjs"; // 0 + import e2 = require("./e.mjs"); // 0 + import f1 from "./f.cjs"; // 0 + import f2 = require("./f.cjs"); // { default: 0 } + + import g1 from "./g"; // { default: 0 } + import g2 = require("./g"); // { default: 0 } + +==== /main3.cjs (2 errors) ==== + import { x, y } from "./a"; // No y + ~ +!!! error TS2305: Module '"./a"' has no exported member 'y'. + import a1 = require("./a"); // Error in JS + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS8002: 'import ... =' can only be used in TypeScript files. + const a2 = require("./a"); // { x: 0 } + + import b1 from "./b"; // 0 + const b2 = require("./b"); // { default: 0 } + + import c1 from "./c"; // { default: [Function: default] } + const c2 = require("./c"); // { default: [Function: default] } + import d1 from "./d"; // [Function: default] + const d2 = require("./d"); // [Function: default] + import e1 from "./e.mjs"; // 0 + const e2 = require("./e.mjs"); // 0 + import f1 from "./f.cjs"; // 0 + const f2 = require("./f.cjs"); // { default: 0 } + + import g1 from "./g"; // { default: 0 } + const g2 = require("./g"); // { default: 0 } + +==== /dummy.ts (0 errors) ==== + export {}; // Silly test harness + \ No newline at end of file diff --git a/tests/baselines/reference/modulePreserve4.js b/tests/baselines/reference/modulePreserve4.js new file mode 100644 index 00000000000..e5e009d628b --- /dev/null +++ b/tests/baselines/reference/modulePreserve4.js @@ -0,0 +1,221 @@ +//// [tests/cases/compiler/modulePreserve4.ts] //// + +//// [a.js] +export const x = 0; +module.exports.y = 0; // Error + +//// [b.ts] +export default 0; + +//// [c.ts] +export = { + default: function() {} +}; + +//// [d.ts] +export = function() {}; + +//// [e.mts] +export = 0; + +//// [f.cts] +export default 0; + +//// [g.js] +exports.default = 0; + +//// [main1.ts] +import { x, y } from "./a"; // No y +import a1 = require("./a"); // { x: 0 } +const a2 = require("./a"); // Error in TS +const a3 = await import("./a"); // { x: 0 } +a3.x; + +import b1 from "./b"; // 0 +import b2 = require("./b"); // { default: 0 } +b2.default; +const b3 = await import("./b"); // { default: 0 } +b3.default; + +import c1 from "./c"; // { default: [Function: default] } +import c2 = require("./c"); // { default: [Function: default] } +c2.default; +import d1 from "./d"; // [Function: default] +import d2 = require("./d"); // [Function: default] +d2(); +d2.default(); // Error +const d3 = await import("./d"); // { default: [Function: default] } +d3.default(); + +import e1 from "./e.mjs"; // 0 +import e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +import f2 = require("./f.cjs"); // { default: 0 } +f2.default; + +import g1 from "./g"; // { default: 0 } +g1.default; +import g2 = require("./g"); // { default: 0 } +g2.default; + +//// [main2.mts] +import { x, y } from "./a"; // No y +import a1 = require("./a"); // { x: 0 } +a1.x; +a1.default.x; // Arguably should exist but doesn't +const a2 = require("./a"); // Error in TS + +import b1 from "./b"; // 0 +import b2 = require("./b"); // { default: 0 } + +import c1 from "./c"; // { default: [Function: default] } +import c2 = require("./c"); // { default: [Function: default] } +import d1 from "./d"; // [Function: default] +import d2 = require("./d"); // [Function: default] +import e1 from "./e.mjs"; // 0 +import e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +import f2 = require("./f.cjs"); // { default: 0 } + +import g1 from "./g"; // { default: 0 } +import g2 = require("./g"); // { default: 0 } + +//// [main3.cjs] +import { x, y } from "./a"; // No y +import a1 = require("./a"); // Error in JS +const a2 = require("./a"); // { x: 0 } + +import b1 from "./b"; // 0 +const b2 = require("./b"); // { default: 0 } + +import c1 from "./c"; // { default: [Function: default] } +const c2 = require("./c"); // { default: [Function: default] } +import d1 from "./d"; // [Function: default] +const d2 = require("./d"); // [Function: default] +import e1 from "./e.mjs"; // 0 +const e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +const f2 = require("./f.cjs"); // { default: 0 } + +import g1 from "./g"; // { default: 0 } +const g2 = require("./g"); // { default: 0 } + +//// [dummy.ts] +export {}; // Silly test harness + + +//// [a.js] +export const x = 0; +module.exports.y = 0; // Error +//// [b.js] +export default 0; +//// [c.js] +module.exports = { + default: function () { } +}; +//// [d.js] +module.exports = function () { }; +//// [e.mjs] +module.exports = 0; +//// [f.cjs] +export default 0; +//// [g.js] +"use strict"; +exports.default = 0; +//// [main1.js] +import { x, y } from "./a"; // No y +const a1 = require("./a"); // { x: 0 } +const a2 = require("./a"); // Error in TS +const a3 = await import("./a"); // { x: 0 } +a3.x; +import b1 from "./b"; // 0 +const b2 = require("./b"); // { default: 0 } +b2.default; +const b3 = await import("./b"); // { default: 0 } +b3.default; +import c1 from "./c"; // { default: [Function: default] } +const c2 = require("./c"); // { default: [Function: default] } +c2.default; +import d1 from "./d"; // [Function: default] +const d2 = require("./d"); // [Function: default] +d2(); +d2.default(); // Error +const d3 = await import("./d"); // { default: [Function: default] } +d3.default(); +import e1 from "./e.mjs"; // 0 +const e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +const f2 = require("./f.cjs"); // { default: 0 } +f2.default; +import g1 from "./g"; // { default: 0 } +g1.default; +const g2 = require("./g"); // { default: 0 } +g2.default; +//// [main2.mjs] +import { x, y } from "./a"; // No y +const a1 = require("./a"); // { x: 0 } +a1.x; +a1.default.x; // Arguably should exist but doesn't +const a2 = require("./a"); // Error in TS +import b1 from "./b"; // 0 +const b2 = require("./b"); // { default: 0 } +import c1 from "./c"; // { default: [Function: default] } +const c2 = require("./c"); // { default: [Function: default] } +import d1 from "./d"; // [Function: default] +const d2 = require("./d"); // [Function: default] +import e1 from "./e.mjs"; // 0 +const e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +const f2 = require("./f.cjs"); // { default: 0 } +import g1 from "./g"; // { default: 0 } +const g2 = require("./g"); // { default: 0 } +//// [main3.cjs] +import { x, y } from "./a"; // No y +const a1 = require("./a"); // Error in JS +const a2 = require("./a"); // { x: 0 } +import b1 from "./b"; // 0 +const b2 = require("./b"); // { default: 0 } +import c1 from "./c"; // { default: [Function: default] } +const c2 = require("./c"); // { default: [Function: default] } +import d1 from "./d"; // [Function: default] +const d2 = require("./d"); // [Function: default] +import e1 from "./e.mjs"; // 0 +const e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +const f2 = require("./f.cjs"); // { default: 0 } +import g1 from "./g"; // { default: 0 } +const g2 = require("./g"); // { default: 0 } +//// [dummy.js] +export {}; // Silly test harness + + +//// [a.d.ts] +export const x: 0; +//// [b.d.ts] +declare const _default: 0; +export default _default; +//// [c.d.ts] +declare const _default: { + default: () => void; +}; +export = _default; +//// [d.d.ts] +declare const _default: () => void; +export = _default; +//// [e.d.mts] +declare const _default: 0; +export = _default; +//// [f.d.cts] +declare const _default: 0; +export default _default; +//// [g.d.ts] +declare const _default: 0; +export default _default; +//// [main1.d.ts] +export {}; +//// [main2.d.mts] +export {}; +//// [main3.d.cts] +export {}; +//// [dummy.d.ts] +export {}; diff --git a/tests/baselines/reference/modulePreserve4.symbols b/tests/baselines/reference/modulePreserve4.symbols new file mode 100644 index 00000000000..05a7671af02 --- /dev/null +++ b/tests/baselines/reference/modulePreserve4.symbols @@ -0,0 +1,262 @@ +//// [tests/cases/compiler/modulePreserve4.ts] //// + +=== /a.js === +export const x = 0; +>x : Symbol(x, Decl(a.js, 0, 12)) + +module.exports.y = 0; // Error + +=== /b.ts === + +export default 0; + +=== /c.ts === +export = { + default: function() {} +>default : Symbol(default, Decl(c.ts, 0, 10)) + +}; + +=== /d.ts === + +export = function() {}; + +=== /e.mts === + +export = 0; + +=== /f.cts === + +export default 0; + +=== /g.js === +exports.default = 0; +>exports.default : Symbol(default, Decl(g.js, 0, 0)) +>exports : Symbol(default, Decl(g.js, 0, 0)) +>default : Symbol(default, Decl(g.js, 0, 0)) + +=== /main1.ts === +import { x, y } from "./a"; // No y +>x : Symbol(x, Decl(main1.ts, 0, 8)) +>y : Symbol(y, Decl(main1.ts, 0, 11)) + +import a1 = require("./a"); // { x: 0 } +>a1 : Symbol(a1, Decl(main1.ts, 0, 27)) + +const a2 = require("./a"); // Error in TS +>a2 : Symbol(a2, Decl(main1.ts, 2, 5)) + +const a3 = await import("./a"); // { x: 0 } +>a3 : Symbol(a3, Decl(main1.ts, 3, 5)) +>"./a" : Symbol(a1, Decl(a.js, 0, 0)) + +a3.x; +>a3.x : Symbol(x, Decl(a.js, 0, 12)) +>a3 : Symbol(a3, Decl(main1.ts, 3, 5)) +>x : Symbol(x, Decl(a.js, 0, 12)) + +import b1 from "./b"; // 0 +>b1 : Symbol(b1, Decl(main1.ts, 6, 6)) + +import b2 = require("./b"); // { default: 0 } +>b2 : Symbol(b2, Decl(main1.ts, 6, 21)) + +b2.default; +>b2.default : Symbol(b1, Decl(b.ts, 0, 0)) +>b2 : Symbol(b2, Decl(main1.ts, 6, 21)) +>default : Symbol(b1, Decl(b.ts, 0, 0)) + +const b3 = await import("./b"); // { default: 0 } +>b3 : Symbol(b3, Decl(main1.ts, 9, 5)) +>"./b" : Symbol(b2, Decl(b.ts, 0, 0)) + +b3.default; +>b3.default : Symbol(b1, Decl(b.ts, 0, 0)) +>b3 : Symbol(b3, Decl(main1.ts, 9, 5)) +>default : Symbol(b1, Decl(b.ts, 0, 0)) + +import c1 from "./c"; // { default: [Function: default] } +>c1 : Symbol(c1, Decl(main1.ts, 12, 6)) + +import c2 = require("./c"); // { default: [Function: default] } +>c2 : Symbol(c2, Decl(main1.ts, 12, 21)) + +c2.default; +>c2.default : Symbol(default, Decl(c.ts, 0, 10)) +>c2 : Symbol(c2, Decl(main1.ts, 12, 21)) +>default : Symbol(default, Decl(c.ts, 0, 10)) + +import d1 from "./d"; // [Function: default] +>d1 : Symbol(d1, Decl(main1.ts, 15, 6)) + +import d2 = require("./d"); // [Function: default] +>d2 : Symbol(d2, Decl(main1.ts, 15, 21)) + +d2(); +>d2 : Symbol(d2, Decl(main1.ts, 15, 21)) + +d2.default(); // Error +>d2 : Symbol(d2, Decl(main1.ts, 15, 21)) + +const d3 = await import("./d"); // { default: [Function: default] } +>d3 : Symbol(d3, Decl(main1.ts, 19, 5)) +>"./d" : Symbol("/d", Decl(d.ts, 0, 0)) + +d3.default(); +>d3.default : Symbol(default) +>d3 : Symbol(d3, Decl(main1.ts, 19, 5)) +>default : Symbol(default) + +import e1 from "./e.mjs"; // 0 +>e1 : Symbol(e1, Decl(main1.ts, 22, 6)) + +import e2 = require("./e.mjs"); // 0 +>e2 : Symbol(e2, Decl(main1.ts, 22, 25)) + +import f1 from "./f.cjs"; // 0 +>f1 : Symbol(f1, Decl(main1.ts, 24, 6)) + +import f2 = require("./f.cjs"); // { default: 0 } +>f2 : Symbol(f2, Decl(main1.ts, 24, 25)) + +f2.default; +>f2.default : Symbol(f1, Decl(f.cts, 0, 0)) +>f2 : Symbol(f2, Decl(main1.ts, 24, 25)) +>default : Symbol(f1, Decl(f.cts, 0, 0)) + +import g1 from "./g"; // { default: 0 } +>g1 : Symbol(g1, Decl(main1.ts, 28, 6)) + +g1.default; +>g1.default : Symbol(g1.default, Decl(g.js, 0, 0)) +>g1 : Symbol(g1, Decl(main1.ts, 28, 6)) +>default : Symbol(g1.default, Decl(g.js, 0, 0)) + +import g2 = require("./g"); // { default: 0 } +>g2 : Symbol(g2, Decl(main1.ts, 29, 11)) + +g2.default; +>g2.default : Symbol(g1.default, Decl(g.js, 0, 0)) +>g2 : Symbol(g2, Decl(main1.ts, 29, 11)) +>default : Symbol(g1.default, Decl(g.js, 0, 0)) + +=== /main2.mts === +import { x, y } from "./a"; // No y +>x : Symbol(x, Decl(main2.mts, 0, 8)) +>y : Symbol(y, Decl(main2.mts, 0, 11)) + +import a1 = require("./a"); // { x: 0 } +>a1 : Symbol(a1, Decl(main2.mts, 0, 27)) + +a1.x; +>a1.x : Symbol(x, Decl(a.js, 0, 12)) +>a1 : Symbol(a1, Decl(main2.mts, 0, 27)) +>x : Symbol(x, Decl(a.js, 0, 12)) + +a1.default.x; // Arguably should exist but doesn't +>a1 : Symbol(a1, Decl(main2.mts, 0, 27)) + +const a2 = require("./a"); // Error in TS +>a2 : Symbol(a2, Decl(main2.mts, 4, 5)) + +import b1 from "./b"; // 0 +>b1 : Symbol(b1, Decl(main2.mts, 6, 6)) + +import b2 = require("./b"); // { default: 0 } +>b2 : Symbol(b2, Decl(main2.mts, 6, 21)) + +import c1 from "./c"; // { default: [Function: default] } +>c1 : Symbol(c1, Decl(main2.mts, 9, 6)) + +import c2 = require("./c"); // { default: [Function: default] } +>c2 : Symbol(c2, Decl(main2.mts, 9, 21)) + +import d1 from "./d"; // [Function: default] +>d1 : Symbol(d1, Decl(main2.mts, 11, 6)) + +import d2 = require("./d"); // [Function: default] +>d2 : Symbol(d2, Decl(main2.mts, 11, 21)) + +import e1 from "./e.mjs"; // 0 +>e1 : Symbol(e1, Decl(main2.mts, 13, 6)) + +import e2 = require("./e.mjs"); // 0 +>e2 : Symbol(e2, Decl(main2.mts, 13, 25)) + +import f1 from "./f.cjs"; // 0 +>f1 : Symbol(f1, Decl(main2.mts, 15, 6)) + +import f2 = require("./f.cjs"); // { default: 0 } +>f2 : Symbol(f2, Decl(main2.mts, 15, 25)) + +import g1 from "./g"; // { default: 0 } +>g1 : Symbol(g1, Decl(main2.mts, 18, 6)) + +import g2 = require("./g"); // { default: 0 } +>g2 : Symbol(g2, Decl(main2.mts, 18, 21)) + +=== /main3.cjs === +import { x, y } from "./a"; // No y +>x : Symbol(x, Decl(main3.cjs, 0, 8)) +>y : Symbol(y, Decl(main3.cjs, 0, 11)) + +import a1 = require("./a"); // Error in JS +>a1 : Symbol(a1, Decl(main3.cjs, 0, 27)) + +const a2 = require("./a"); // { x: 0 } +>a2 : Symbol(a2, Decl(main3.cjs, 2, 5)) +>require : Symbol(require) +>"./a" : Symbol(a1, Decl(a.js, 0, 0)) + +import b1 from "./b"; // 0 +>b1 : Symbol(b1, Decl(main3.cjs, 4, 6)) + +const b2 = require("./b"); // { default: 0 } +>b2 : Symbol(b2, Decl(main3.cjs, 5, 5)) +>require : Symbol(require) +>"./b" : Symbol(b2, Decl(b.ts, 0, 0)) + +import c1 from "./c"; // { default: [Function: default] } +>c1 : Symbol(c1, Decl(main3.cjs, 7, 6)) + +const c2 = require("./c"); // { default: [Function: default] } +>c2 : Symbol(c2, Decl(main3.cjs, 8, 5)) +>require : Symbol(require) +>"./c" : Symbol("/c", Decl(c.ts, 0, 0)) + +import d1 from "./d"; // [Function: default] +>d1 : Symbol(d1, Decl(main3.cjs, 9, 6)) + +const d2 = require("./d"); // [Function: default] +>d2 : Symbol(d2, Decl(main3.cjs, 10, 5)) +>require : Symbol(require) +>"./d" : Symbol("/d", Decl(d.ts, 0, 0)) + +import e1 from "./e.mjs"; // 0 +>e1 : Symbol(e1, Decl(main3.cjs, 11, 6)) + +const e2 = require("./e.mjs"); // 0 +>e2 : Symbol(e2, Decl(main3.cjs, 12, 5)) +>require : Symbol(require) +>"./e.mjs" : Symbol("/e", Decl(e.mts, 0, 0)) + +import f1 from "./f.cjs"; // 0 +>f1 : Symbol(f1, Decl(main3.cjs, 13, 6)) + +const f2 = require("./f.cjs"); // { default: 0 } +>f2 : Symbol(f2, Decl(main3.cjs, 14, 5)) +>require : Symbol(require) +>"./f.cjs" : Symbol(f2, Decl(f.cts, 0, 0)) + +import g1 from "./g"; // { default: 0 } +>g1 : Symbol(g1, Decl(main3.cjs, 16, 6)) + +const g2 = require("./g"); // { default: 0 } +>g2 : Symbol(g2, Decl(main3.cjs, 17, 5)) +>require : Symbol(require) +>"./g" : Symbol(g1, Decl(g.js, 0, 0)) + +=== /dummy.ts === + +export {}; // Silly test harness + diff --git a/tests/baselines/reference/modulePreserve4.types b/tests/baselines/reference/modulePreserve4.types new file mode 100644 index 00000000000..04872a9dde2 --- /dev/null +++ b/tests/baselines/reference/modulePreserve4.types @@ -0,0 +1,303 @@ +//// [tests/cases/compiler/modulePreserve4.ts] //// + +=== /a.js === +export const x = 0; +>x : 0 +>0 : 0 + +module.exports.y = 0; // Error +>module.exports.y = 0 : 0 +>module.exports.y : any +>module.exports : any +>module : any +>exports : any +>y : any +>0 : 0 + +=== /b.ts === + +export default 0; + +=== /c.ts === +export = { +>{ default: function() {}} : { default: () => void; } + + default: function() {} +>default : () => void +>function() {} : () => void + +}; + +=== /d.ts === +export = function() {}; +>function() {} : () => void + +=== /e.mts === + +export = 0; + +=== /f.cts === + +export default 0; + +=== /g.js === +exports.default = 0; +>exports.default = 0 : 0 +>exports.default : 0 +>exports : typeof import("/g") +>default : 0 +>0 : 0 + +=== /main1.ts === +import { x, y } from "./a"; // No y +>x : 0 +>y : any + +import a1 = require("./a"); // { x: 0 } +>a1 : typeof a1 + +const a2 = require("./a"); // Error in TS +>a2 : any +>require("./a") : any +>require : any +>"./a" : "./a" + +const a3 = await import("./a"); // { x: 0 } +>a3 : typeof a1 +>await import("./a") : typeof a1 +>import("./a") : Promise +>"./a" : "./a" + +a3.x; +>a3.x : 0 +>a3 : typeof a1 +>x : 0 + +import b1 from "./b"; // 0 +>b1 : 0 + +import b2 = require("./b"); // { default: 0 } +>b2 : typeof b2 + +b2.default; +>b2.default : 0 +>b2 : typeof b2 +>default : 0 + +const b3 = await import("./b"); // { default: 0 } +>b3 : typeof b2 +>await import("./b") : typeof b2 +>import("./b") : Promise +>"./b" : "./b" + +b3.default; +>b3.default : 0 +>b3 : typeof b2 +>default : 0 + +import c1 from "./c"; // { default: [Function: default] } +>c1 : { default: () => void; } + +import c2 = require("./c"); // { default: [Function: default] } +>c2 : { default: () => void; } + +c2.default; +>c2.default : () => void +>c2 : { default: () => void; } +>default : () => void + +import d1 from "./d"; // [Function: default] +>d1 : () => void + +import d2 = require("./d"); // [Function: default] +>d2 : () => void + +d2(); +>d2() : void +>d2 : () => void + +d2.default(); // Error +>d2.default() : any +>d2.default : any +>d2 : () => void +>default : any + +const d3 = await import("./d"); // { default: [Function: default] } +>d3 : { default: () => void; } +>await import("./d") : { default: () => void; } +>import("./d") : Promise<{ default: () => void; }> +>"./d" : "./d" + +d3.default(); +>d3.default() : void +>d3.default : () => void +>d3 : { default: () => void; } +>default : () => void + +import e1 from "./e.mjs"; // 0 +>e1 : 0 + +import e2 = require("./e.mjs"); // 0 +>e2 : 0 + +import f1 from "./f.cjs"; // 0 +>f1 : 0 + +import f2 = require("./f.cjs"); // { default: 0 } +>f2 : typeof f2 + +f2.default; +>f2.default : 0 +>f2 : typeof f2 +>default : 0 + +import g1 from "./g"; // { default: 0 } +>g1 : typeof g1 + +g1.default; +>g1.default : 0 +>g1 : typeof g1 +>default : 0 + +import g2 = require("./g"); // { default: 0 } +>g2 : typeof g1 + +g2.default; +>g2.default : 0 +>g2 : typeof g1 +>default : 0 + +=== /main2.mts === +import { x, y } from "./a"; // No y +>x : 0 +>y : any + +import a1 = require("./a"); // { x: 0 } +>a1 : typeof a1 + +a1.x; +>a1.x : 0 +>a1 : typeof a1 +>x : 0 + +a1.default.x; // Arguably should exist but doesn't +>a1.default.x : any +>a1.default : any +>a1 : typeof a1 +>default : any +>x : any + +const a2 = require("./a"); // Error in TS +>a2 : any +>require("./a") : any +>require : any +>"./a" : "./a" + +import b1 from "./b"; // 0 +>b1 : 0 + +import b2 = require("./b"); // { default: 0 } +>b2 : typeof b2 + +import c1 from "./c"; // { default: [Function: default] } +>c1 : { default: () => void; } + +import c2 = require("./c"); // { default: [Function: default] } +>c2 : { default: () => void; } + +import d1 from "./d"; // [Function: default] +>d1 : () => void + +import d2 = require("./d"); // [Function: default] +>d2 : () => void + +import e1 from "./e.mjs"; // 0 +>e1 : 0 + +import e2 = require("./e.mjs"); // 0 +>e2 : 0 + +import f1 from "./f.cjs"; // 0 +>f1 : 0 + +import f2 = require("./f.cjs"); // { default: 0 } +>f2 : typeof f2 + +import g1 from "./g"; // { default: 0 } +>g1 : typeof g1 + +import g2 = require("./g"); // { default: 0 } +>g2 : typeof g1 + +=== /main3.cjs === +import { x, y } from "./a"; // No y +>x : 0 +>y : any + +import a1 = require("./a"); // Error in JS +>a1 : typeof a1 + +const a2 = require("./a"); // { x: 0 } +>a2 : typeof a1 +>require("./a") : typeof a1 +>require : any +>"./a" : "./a" + +import b1 from "./b"; // 0 +>b1 : 0 + +const b2 = require("./b"); // { default: 0 } +>b2 : typeof b2 +>require("./b") : typeof b2 +>require : any +>"./b" : "./b" + +import c1 from "./c"; // { default: [Function: default] } +>c1 : { default: () => void; } + +const c2 = require("./c"); // { default: [Function: default] } +>c2 : { default: () => void; } +>require("./c") : { default: () => void; } +>require : any +>"./c" : "./c" + +import d1 from "./d"; // [Function: default] +>d1 : () => void + +const d2 = require("./d"); // [Function: default] +>d2 : () => void +>require("./d") : () => void +>require : any +>"./d" : "./d" + +import e1 from "./e.mjs"; // 0 +>e1 : 0 + +const e2 = require("./e.mjs"); // 0 +>e2 : 0 +>require("./e.mjs") : 0 +>require : any +>"./e.mjs" : "./e.mjs" + +import f1 from "./f.cjs"; // 0 +>f1 : 0 + +const f2 = require("./f.cjs"); // { default: 0 } +>f2 : typeof f2 +>require("./f.cjs") : typeof f2 +>require : any +>"./f.cjs" : "./f.cjs" + +import g1 from "./g"; // { default: 0 } +>g1 : typeof g1 + +const g2 = require("./g"); // { default: 0 } +>g2 : typeof g1 +>require("./g") : typeof g1 +>require : any +>"./g" : "./g" + +=== /dummy.ts === + +export {}; // Silly test harness + diff --git a/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt b/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt index c867a288305..b714d536e81 100644 --- a/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/nestedPackageJsonRedirect(moduleresolution=bundler).errors.txt @@ -1,7 +1,7 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== /node_modules/@restart/hooks/package.json (0 errors) ==== { "name": "@restart/hooks", diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node16).errors.txt index 6e03e95a210..6d1336b928e 100644 --- a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node16).errors.txt @@ -1,5 +1,5 @@ -index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. -index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.js(2,11): 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.js(4,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. 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. @@ -17,11 +17,11 @@ subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and // esm format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt index 6e03e95a210..6d1336b928e 100644 --- a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt @@ -1,5 +1,5 @@ -index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. -index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.js(2,11): 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.js(4,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. 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. @@ -17,11 +17,11 @@ subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and // esm format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt index 4517eb8290a..3302c2b1ff0 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt @@ -3,31 +3,31 @@ other.cts(2,18): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pr other.cts(3,18): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other.cts(4,18): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other.cts(5,18): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.mts(2,18): 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.mts(2,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.mts(3,18): 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.mts(3,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.mts(4,18): 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.mts(4,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.mts(5,18): 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.mts(5,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.ts(2,18): 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(2,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.ts(3,18): 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(3,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.ts(4,18): 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(4,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other.ts(5,18): 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(5,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other2.cts(2,18): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other2.cts(3,18): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other2.mts(2,18): 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. other2.mts(2,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other2.mts(3,18): 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. other2.mts(3,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other2.ts(2,18): 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. other2.ts(2,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +other2.ts(3,18): 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. other2.ts(3,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -45,68 +45,68 @@ other2.ts(3,24): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pr // esm format file export const a = await import("package/cjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const b = await import("package/mjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const c = await import("package"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const f = await import("inner"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== other2.ts (4 errors) ==== // esm format file export const d = await import("inner/cjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const e = await import("inner/mjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== other.mts (8 errors) ==== // esm format file export const a = await import("package/cjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const b = await import("package/mjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const c = await import("package"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const f = await import("inner"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== other2.mts (4 errors) ==== // esm format file export const d = await import("inner/cjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const e = await import("inner/mjs"); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== other.cts (4 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node16).errors.txt b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node16).errors.txt index 22d37a461c7..81aad1fb1c2 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node16).errors.txt @@ -1,7 +1,7 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -15,7 +15,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro ~ !!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).errors.txt index 22d37a461c7..81aad1fb1c2 100644 --- a/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).errors.txt @@ -1,7 +1,7 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -15,7 +15,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro ~ !!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node16).errors.txt b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node16).errors.txt index ff14c896d8a..23b9a209a09 100644 --- a/tests/baselines/reference/nodeModulesExportsSourceTs(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=node16).errors.txt @@ -1,7 +1,7 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -15,7 +15,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro ~ !!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. import {a as a2} from "package"; diff --git a/tests/baselines/reference/nodeModulesExportsSourceTs(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesExportsSourceTs(module=nodenext).errors.txt index ff14c896d8a..23b9a209a09 100644 --- a/tests/baselines/reference/nodeModulesExportsSourceTs(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSourceTs(module=nodenext).errors.txt @@ -1,7 +1,7 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -15,7 +15,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro ~ !!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. import {a as a2} from "package"; diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node16).errors.txt index 53d93d56c53..23efc389d88 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=node16).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -12,7 +12,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).errors.txt index 53d93d56c53..23efc389d88 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -12,7 +12,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node16).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node16).errors.txt index 255b5604453..a560e039632 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=node16).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -12,7 +12,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).errors.txt index 255b5604453..a560e039632 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -12,7 +12,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node16).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node16).errors.txt index 0d315192d98..ee87b40c2d9 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=node16).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -12,7 +12,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).errors.txt index 0d315192d98..ee87b40c2d9 100644 --- a/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(3,19): 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(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -12,7 +12,7 @@ index.ts(3,25): error TS2712: A dynamic import call in ES5/ES3 requires the 'Pro !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt index 9aec13e27c5..325782e1035 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -8,11 +8,11 @@ otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'P ==== 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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. ==== otherc.cts (2 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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt index eebc7c09c97..2aaaf1fd910 100644 --- a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -otherc.cts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +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'. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -8,11 +8,11 @@ otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'P ==== 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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. ==== otherc.cts (2 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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt index 55c25456e55..59863305077 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' or 'nodenext'. +/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,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' or 'nodenext'. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt index 8cb0099fe8c..23d74c2152e 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' or 'nodenext'. -/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/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 (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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt index b7e37666357..f4888633143 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' or 'nodenext'. +/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,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' or 'nodenext'. -/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/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 (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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index a8a76a05152..7ab6639b5d6 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' or 'nodenext'. +/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,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' or 'nodenext'. +/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index 0403a6e026f..06d7b09c3ec 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' or 'nodenext'. -/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/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 (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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index bc3eb30565c..b84ec4d29a3 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' or 'nodenext'. +/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,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' or 'nodenext'. -/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/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 (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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', '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' or 'nodenext'. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node16).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node16).errors.txt index b905febf46b..3a11425d123 100644 --- a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node16).errors.txt @@ -1,5 +1,5 @@ -index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. -index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(2,11): 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(4,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. 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. @@ -17,11 +17,11 @@ subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and // esm format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt index b905febf46b..3a11425d123 100644 --- a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt @@ -1,5 +1,5 @@ -index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. -index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +index.ts(2,11): 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(4,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. 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. @@ -17,11 +17,11 @@ subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and // esm format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt index 922ab5a9ffe..06ea252e5b8 100644 --- a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=bundler).errors.txt @@ -1,6 +1,6 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== index.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/parser.forAwait.es2018.errors.txt b/tests/baselines/reference/parser.forAwait.es2018.errors.txt index bc63fd1d1c1..93133c27df9 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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/preserveValueImports_module(module=amd).errors.txt b/tests/baselines/reference/preserveValueImports_module(module=amd).errors.txt index 84c7e5a0a95..cc2e3641f6a 100644 --- a/tests/baselines/reference/preserveValueImports_module(module=amd).errors.txt +++ b/tests/baselines/reference/preserveValueImports_module(module=amd).errors.txt @@ -1,9 +1,9 @@ -error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. ==== preserveValueImports_module.ts (0 errors) ==== diff --git a/tests/baselines/reference/preserveValueImports_module(module=commonjs).errors.txt b/tests/baselines/reference/preserveValueImports_module(module=commonjs).errors.txt index 84c7e5a0a95..cc2e3641f6a 100644 --- a/tests/baselines/reference/preserveValueImports_module(module=commonjs).errors.txt +++ b/tests/baselines/reference/preserveValueImports_module(module=commonjs).errors.txt @@ -1,9 +1,9 @@ -error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. ==== preserveValueImports_module.ts (0 errors) ==== diff --git a/tests/baselines/reference/preserveValueImports_module(module=system).errors.txt b/tests/baselines/reference/preserveValueImports_module(module=system).errors.txt index 84c7e5a0a95..cc2e3641f6a 100644 --- a/tests/baselines/reference/preserveValueImports_module(module=system).errors.txt +++ b/tests/baselines/reference/preserveValueImports_module(module=system).errors.txt @@ -1,9 +1,9 @@ -error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. ==== preserveValueImports_module.ts (0 errors) ==== diff --git a/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt b/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt index 2c4f4e0e6d9..1cd05c516e6 100644 --- a/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt +++ b/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt @@ -1,8 +1,8 @@ -error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'. +error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. file1.ts(1,1): error TS1148: Cannot use imports, exports, or module augmentations when '--module' is 'none'. -!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'. +!!! error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. ==== file1.ts (1 errors) ==== import * as b from './b.json'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitSystem.errors.txt b/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitSystem.errors.txt index d3ae542d34b..dbae322e426 100644 --- a/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitSystem.errors.txt +++ b/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitSystem.errors.txt @@ -1,7 +1,7 @@ -error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'. +error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. -!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'. +!!! error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. ==== file1.ts (0 errors) ==== import * as b from './b.json'; diff --git a/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitUmd.errors.txt b/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitUmd.errors.txt index d3ae542d34b..dbae322e426 100644 --- a/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitUmd.errors.txt +++ b/tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitUmd.errors.txt @@ -1,7 +1,7 @@ -error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'. +error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. -!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'. +!!! error TS5071: Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'. ==== file1.ts (0 errors) ==== import * as b from './b.json'; diff --git a/tests/baselines/reference/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt b/tests/baselines/reference/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt index 1aff00cd475..bc87e9cadb7 100644 --- a/tests/baselines/reference/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/resolutionCandidateFromPackageJsonField2(moduleresolution=bundler).errors.txt @@ -1,8 +1,8 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. test.ts(1,19): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ==== tsconfig.json (0 errors) ==== { "compilerOptions": { diff --git a/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=bundler).errors.txt b/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=bundler).errors.txt index 0668d695d63..befdfb5cd9d 100644 --- a/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=bundler).errors.txt +++ b/tests/baselines/reference/resolvesWithoutExportsDiagnostic1(moduleresolution=bundler).errors.txt @@ -1,4 +1,4 @@ -error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. error TS6504: File '/node_modules/bar/index.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 @@ -17,7 +17,7 @@ error TS6504: File '/node_modules/foo/index.mjs' is a JavaScript file. Did you m There are types at '/node_modules/@types/bar/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@types/bar' library may need to update its package.json or typings. -!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. !!! error TS6504: File '/node_modules/bar/index.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 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 bf81980d924..2c3e91ab9f0 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', '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 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 bf81980d924..2c3e91ab9f0 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', '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 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 bf81980d924..2c3e91ab9f0 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', or 'nodenext', 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', or 'nodenext', 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', or 'nodenext', 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', '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 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', or 'nodenext', 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', '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', or 'nodenext', 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', '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', or 'nodenext', 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', '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 fad550d1d91..9049e0c6b8d 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,8 +1,8 @@ error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. !!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', '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.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt index fad550d1d91..9049e0c6b8d 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,8 +1,8 @@ error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. !!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', '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.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt index fad550d1d91..9049e0c6b8d 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,8 +1,8 @@ error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. !!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', '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.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt index fad550d1d91..9049e0c6b8d 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,8 +1,8 @@ error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. !!! error TS5107: Option 'target=ES3' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext', 'preserve'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js index d93b62dedee..1ac36252291 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/does-not-add-color-when-NO_COLOR-is-set.js @@ -106,7 +106,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 +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve default: undefined --lib diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 37a11b54fb9..c25ee963396 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -106,7 +106,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 +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve default: undefined --lib diff --git a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 37a11b54fb9..c25ee963396 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -106,7 +106,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 +one of: none, commonjs, amd, umd, system, es6/es2015, es2020, es2022, esnext, node16, nodenext, preserve default: undefined --lib diff --git a/tests/baselines/reference/verbatimModuleSyntaxCompat.errors.txt b/tests/baselines/reference/verbatimModuleSyntaxCompat.errors.txt index 020a29d18c4..487bfe2da3b 100644 --- a/tests/baselines/reference/verbatimModuleSyntaxCompat.errors.txt +++ b/tests/baselines/reference/verbatimModuleSyntaxCompat.errors.txt @@ -1,4 +1,4 @@ -error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. @@ -8,7 +8,7 @@ error TS5104: Option 'preserveValueImports' is redundant and cannot be specified error TS5105: Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'. -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. !!! error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. diff --git a/tests/baselines/reference/verbatimModuleSyntaxCompat2.errors.txt b/tests/baselines/reference/verbatimModuleSyntaxCompat2.errors.txt index 2c8fcfcbb1e..32c7d82cbae 100644 --- a/tests/baselines/reference/verbatimModuleSyntaxCompat2.errors.txt +++ b/tests/baselines/reference/verbatimModuleSyntaxCompat2.errors.txt @@ -1,4 +1,4 @@ -/tsconfig.json(5,9): error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +/tsconfig.json(5,9): error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. /tsconfig.json(5,9): error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. /tsconfig.json(5,9): error TS5104: Option 'preserveValueImports' is redundant and cannot be specified with option 'verbatimModuleSyntax'. @@ -14,7 +14,7 @@ "isolatedModules": true, "preserveValueImports": true, ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. diff --git a/tests/baselines/reference/verbatimModuleSyntaxCompat3.errors.txt b/tests/baselines/reference/verbatimModuleSyntaxCompat3.errors.txt index 1eabc0a1a8f..4b4a31e01fd 100644 --- a/tests/baselines/reference/verbatimModuleSyntaxCompat3.errors.txt +++ b/tests/baselines/reference/verbatimModuleSyntaxCompat3.errors.txt @@ -1,11 +1,11 @@ -error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. !!! error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. diff --git a/tests/baselines/reference/verbatimModuleSyntaxCompat4.errors.txt b/tests/baselines/reference/verbatimModuleSyntaxCompat4.errors.txt index 91ee3baec20..86b4a0afd35 100644 --- a/tests/baselines/reference/verbatimModuleSyntaxCompat4.errors.txt +++ b/tests/baselines/reference/verbatimModuleSyntaxCompat4.errors.txt @@ -1,4 +1,4 @@ -/tsconfig.json(5,9): error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +/tsconfig.json(5,9): error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. /tsconfig.json(5,9): error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. Use 'verbatimModuleSyntax' instead. /tsconfig.json(5,9): error TS5104: Option 'preserveValueImports' is redundant and cannot be specified with option 'verbatimModuleSyntax'. @@ -14,7 +14,7 @@ "isolatedModules": true, "preserveValueImports": true, ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'es2015' or later. +!!! error TS5095: Option 'preserveValueImports' can only be used when 'module' is set to 'preserve' or to 'es2015' or later. ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS5101: Option 'preserveValueImports' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error. !!! error TS5101: Use 'verbatimModuleSyntax' instead. diff --git a/tests/cases/compiler/ambientRequireFunction.ts b/tests/cases/compiler/ambientRequireFunction.ts index ce9019e00bc..a5428c2ea94 100644 --- a/tests/cases/compiler/ambientRequireFunction.ts +++ b/tests/cases/compiler/ambientRequireFunction.ts @@ -1,4 +1,4 @@ -// @module: commonjs +// @module: commonjs, preserve // @allowJs: true // @outDir: ./out/ diff --git a/tests/cases/compiler/modulePreserve1.ts b/tests/cases/compiler/modulePreserve1.ts new file mode 100644 index 00000000000..e0e854ac767 --- /dev/null +++ b/tests/cases/compiler/modulePreserve1.ts @@ -0,0 +1,13 @@ +// @module: preserve +// @target: esnext + +// @Filename: /a.ts +export class A {} + +// @Filename: /b.ts +export = class B {} + +// @Filename: /main.ts +import { A } from "./a"; +import B = require("./b"); +export { A, B }; diff --git a/tests/cases/compiler/modulePreserve2.ts b/tests/cases/compiler/modulePreserve2.ts new file mode 100644 index 00000000000..16f72fac886 --- /dev/null +++ b/tests/cases/compiler/modulePreserve2.ts @@ -0,0 +1,30 @@ +// @module: preserve +// @target: esnext +// @strict: true +// @checkJs: true +// @traceResolution: true +// @noEmit: true + +// @Filename: /node_modules/dep/package.json +{ + "name": "dep", + "exports": { + "import": "./import.mjs", + "require": "./require.js" + } +} + +// @Filename: /node_modules/dep/import.d.mts +export const esm: "esm"; + +// @Filename: /node_modules/dep/require.d.ts +declare const cjs: "cjs"; +export = cjs; + +// @Filename: /index.ts +import { esm } from "dep"; +import cjs = require("dep"); + +// @Filename: /main.js +import { esm } from "dep"; +const cjs = require("dep"); diff --git a/tests/cases/compiler/modulePreserve3.ts b/tests/cases/compiler/modulePreserve3.ts new file mode 100644 index 00000000000..c15e1b1d4c3 --- /dev/null +++ b/tests/cases/compiler/modulePreserve3.ts @@ -0,0 +1,13 @@ +// @module: preserve +// @target: esnext +// @jsx: react-jsx +// @noEmit: true +// @noTypesAndSymbols: true +// @traceResolution: true + +// @Filename: /node_modules/@types/react/jsx-runtime.d.ts +export namespace JSX {} + +// @Filename: /index.tsx +export {}; +(
); diff --git a/tests/cases/compiler/modulePreserve4.ts b/tests/cases/compiler/modulePreserve4.ts new file mode 100644 index 00000000000..9eabe664bb8 --- /dev/null +++ b/tests/cases/compiler/modulePreserve4.ts @@ -0,0 +1,110 @@ +// @module: preserve +// @target: esnext +// @verbatimModuleSyntax: true +// @checkJs: true +// @outDir: dist +// @declaration: true +// @strict: true + +// @Filename: /a.js +export const x = 0; +module.exports.y = 0; // Error + +// @Filename: /b.ts +export default 0; + +// @Filename: /c.ts +export = { + default: function() {} +}; + +// @Filename: /d.ts +export = function() {}; + +// @Filename: /e.mts +export = 0; + +// @Filename: /f.cts +export default 0; + +// @Filename: /g.js +exports.default = 0; + +// @Filename: /main1.ts +import { x, y } from "./a"; // No y +import a1 = require("./a"); // { x: 0 } +const a2 = require("./a"); // Error in TS +const a3 = await import("./a"); // { x: 0 } +a3.x; + +import b1 from "./b"; // 0 +import b2 = require("./b"); // { default: 0 } +b2.default; +const b3 = await import("./b"); // { default: 0 } +b3.default; + +import c1 from "./c"; // { default: [Function: default] } +import c2 = require("./c"); // { default: [Function: default] } +c2.default; +import d1 from "./d"; // [Function: default] +import d2 = require("./d"); // [Function: default] +d2(); +d2.default(); // Error +const d3 = await import("./d"); // { default: [Function: default] } +d3.default(); + +import e1 from "./e.mjs"; // 0 +import e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +import f2 = require("./f.cjs"); // { default: 0 } +f2.default; + +import g1 from "./g"; // { default: 0 } +g1.default; +import g2 = require("./g"); // { default: 0 } +g2.default; + +// @Filename: /main2.mts +import { x, y } from "./a"; // No y +import a1 = require("./a"); // { x: 0 } +a1.x; +a1.default.x; // Arguably should exist but doesn't +const a2 = require("./a"); // Error in TS + +import b1 from "./b"; // 0 +import b2 = require("./b"); // { default: 0 } + +import c1 from "./c"; // { default: [Function: default] } +import c2 = require("./c"); // { default: [Function: default] } +import d1 from "./d"; // [Function: default] +import d2 = require("./d"); // [Function: default] +import e1 from "./e.mjs"; // 0 +import e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +import f2 = require("./f.cjs"); // { default: 0 } + +import g1 from "./g"; // { default: 0 } +import g2 = require("./g"); // { default: 0 } + +// @Filename: /main3.cjs +import { x, y } from "./a"; // No y +import a1 = require("./a"); // Error in JS +const a2 = require("./a"); // { x: 0 } + +import b1 from "./b"; // 0 +const b2 = require("./b"); // { default: 0 } + +import c1 from "./c"; // { default: [Function: default] } +const c2 = require("./c"); // { default: [Function: default] } +import d1 from "./d"; // [Function: default] +const d2 = require("./d"); // [Function: default] +import e1 from "./e.mjs"; // 0 +const e2 = require("./e.mjs"); // 0 +import f1 from "./f.cjs"; // 0 +const f2 = require("./f.cjs"); // { default: 0 } + +import g1 from "./g"; // { default: 0 } +const g2 = require("./g"); // { default: 0 } + +// @Filename: /dummy.ts +export {}; // Silly test harness diff --git a/tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts index 3ab230e98dd..ab7a430db09 100644 --- a/tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerConditionsExcludesNode.ts @@ -1,5 +1,5 @@ // @moduleResolution: bundler -// @module: esnext +// @module: esnext, preserve // @traceResolution: true // @Filename: /node_modules/conditions/package.json diff --git a/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts index 7fbcd0f6f7a..105f310960d 100644 --- a/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts @@ -1,5 +1,5 @@ // @moduleResolution: bundler -// @module: esnext +// @module: esnext, preserve // @Filename: /esm.mts export const esm = 0; diff --git a/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts index 2c71e97c08f..0e970d13192 100644 --- a/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts @@ -1,5 +1,5 @@ // @moduleResolution: bundler -// @module: esnext +// @module: esnext, preserve // @traceResolution: true // @Filename: /node_modules/dual/package.json diff --git a/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts index 667fe14366d..9bd6eaa69d1 100644 --- a/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts @@ -1,5 +1,5 @@ // @moduleResolution: bundler -// @module: esnext +// @module: esnext, preserve // @traceResolution: true // @Filename: /dir/index.ts diff --git a/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts index e71313bca4c..c80cf1f676b 100644 --- a/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts @@ -1,5 +1,5 @@ // @moduleResolution: bundler -// @module: esnext +// @module: esnext, preserve // @checkJs: true // @allowJs: true // @outDir: out @@ -22,12 +22,12 @@ declare module "path" { // @Filename: /mainJs.js import {} from "./a"; import("./a"); -const _ = require("./a"); // No resolution +const _ = require("./a"); _.a; // any // @Filename: /main.ts import {} from "./a"; -import _ = require("./a"); // Error +import _ = require("./a"); // Error in esnext export = {}; // Error export {};