diff --git a/.github/agents/strada-corsa-port.md b/.github/agents/strada-corsa-port.md new file mode 100644 index 00000000000..c0cbdf08bd2 --- /dev/null +++ b/.github/agents/strada-corsa-port.md @@ -0,0 +1,22 @@ +--- +name: Strada to Corsa Port Expert +description: A Go and TypeScript expert who can easily figure out how to port PRs from one language to another +--- + +This repository is a port of `microsoft/TypeScript` from TypeScript to Go. Since the port began, the following pull request was applied to microsoft/TypeScript. An equivalent change now needs to be applied here. The user will give you a link to the PR and you will need to try to port it to this repo. + +Instructions +- Use `curl` to fetch e.g. `https://api.github.com/repos/microsoft/typescript/pulls/59767` to view the merge commit SHA +- Then use `curl` to fetch e.g. `https://github.com/microsoft/TypeScript/commit/bd3d70058c30253209199cc9dfeb85e72330d79b.patch` to download the diff patch +- Use Playwright MCP if you have other information from github you need, since you won't have MCP access to the TypeScript repo +- Apply the edits made in that PR to this codebase, translating them from TypeScript to Go. +- The change may or may not be applicable. It may have already been ported. Do not make any significant changes outside the scope of the diff. If the change cannot be applied without significant out-of-scope changes, explain why and stop working. + - Tip: search for functions and identifiers from the diff to find the right location to apply edits. Some files in microsoft/TypeScript have been split into multiple. + - Tip: some changes have already been ported, like changes to diagnostic message text. Tests do not need to be ported as they are imported from the submodule. +- Check that the code builds by running npx hereby build in the terminal. +- Run tests. It is expected that tests will fail due to baseline changes. + - Run `npx hereby test` in a terminal. They should fail with messages about baseline changes. + - Tip: to run a single baseline test from the submodule, run go test ./internal/testrunner -run '^TestSubmodule/NAME_OF_TEST_FILE' + - Run npx hereby baseline-accept to adopt the baseline changes. + - Run git diff 'testdata/**/*.diff'. If your change is correct, these diff files will be reduced or completely deleted. +- Iterate until you are satisfied with your change. Commit everything, including the baseline changes in testdata, and open a PR. diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5b287185e42..d1d78dc6d5c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -24,6 +24,19 @@ go test -run='TestLocal/' ./internal/testrunner # For new "local Always make sure code is formatted, linted, and tested before sending a pull request. + +YOU MUST RUN THESE COMMANDS AT THE END OF YOUR SESSION! +IF THESE COMMANDS FAIL, CI WILL FAIL, AND YOUR PR WILL BE REJECTED OUT OF HAND. +FIXING ERRORS FROM THESE COMMANDS IS YOUR HIGHEST PRIORITY. +ENSURE YOU DO THE RIGHT THINGS TO MAKE THEM PASS. +```sh +npx hereby build # Build the project +npx hereby test # Run tests +npx hereby lint # Run linters +npx hereby format # Format the code +``` + + ## Compiler Features, Fixes, and Tests When fixing a bug or implementing a new feature, at least one minimal test case should always be added in advance to verify the fix. @@ -96,4 +109,4 @@ The TypeScript submodule serves as the reference implementation for behavior and # Other Instructions - Do not add or change existing dependencies unless asked to. - \ No newline at end of file +- Do not remove any debug assertions or panic calls. Existing assertions are never too strict or incorrect. diff --git a/_extension/src/commands.ts b/_extension/src/commands.ts index d60192ff8e5..18da6a3ca1b 100644 --- a/_extension/src/commands.ts +++ b/_extension/src/commands.ts @@ -50,7 +50,7 @@ async function updateUseTsgoSetting(enable: boolean): Promise { useTsgo.globalValue !== undefined ? vscode.ConfigurationTarget.Global : undefined; } // Update the setting and restart the extension host (needed to change the state of the built-in TS extension) - await tsConfig.update("experimental.useTsgo", enable, target); + await tsConfig.update("experimental.useTsgo", enable, target ?? vscode.ConfigurationTarget.Global); await restartExtHostOnChangeIfNeeded(); } diff --git a/_submodules/TypeScript b/_submodules/TypeScript index bc7d42611e3..1ee9e0d9a24 160000 --- a/_submodules/TypeScript +++ b/_submodules/TypeScript @@ -1 +1 @@ -Subproject commit bc7d42611e35678c7cbddb104aa4b117a95ccdfa +Subproject commit 1ee9e0d9a24b629da3a8cae2748616af1dc8fc0c diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 25c4ca563a5..32dfebdd8eb 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -1340,7 +1340,7 @@ func IsBindableStaticElementAccessExpression(node *Node, excludeThisKeyword bool return IsLiteralLikeElementAccess(node) && ((!excludeThisKeyword && node.Expression().Kind == KindThisKeyword) || IsEntityNameExpression(node.Expression()) || - IsBindableStaticAccessExpression(node.Expression() /*excludeThisKeyword*/, true)) + IsBindableStaticAccessExpression(node.Expression(), true /*excludeThisKeyword*/)) } func IsLiteralLikeElementAccess(node *Node) bool { @@ -2822,10 +2822,6 @@ func IsModuleExportsAccessExpression(node *Node) bool { return false } -func isLiteralLikeElementAccess(node *Node) bool { - return node.Kind == KindElementAccessExpression && IsStringOrNumericLiteralLike(node.AsElementAccessExpression().ArgumentExpression) -} - func IsCheckJSEnabledForFile(sourceFile *SourceFile, compilerOptions *core.CompilerOptions) bool { if sourceFile.CheckJsDirective != nil { return sourceFile.CheckJsDirective.Enabled @@ -3865,3 +3861,32 @@ func IsJSDocNameReferenceContext(node *Node) bool { func IsImportOrImportEqualsDeclaration(node *Node) bool { return IsImportDeclaration(node) || IsImportEqualsDeclaration(node) } + +func IsKeyword(token Kind) bool { + return KindFirstKeyword <= token && token <= KindLastKeyword +} + +func IsNonContextualKeyword(token Kind) bool { + return IsKeyword(token) && !IsContextualKeyword(token) +} + +func HasModifier(node *Node, flags ModifierFlags) bool { + return node.ModifierFlags()&flags != 0 +} + +func IsExpandoInitializer(initializer *Node) bool { + if initializer == nil { + return false + } + if IsFunctionExpressionOrArrowFunction(initializer) { + return true + } + if IsInJSFile(initializer) { + return IsClassExpression(initializer) || (IsObjectLiteralExpression(initializer) && len(initializer.AsObjectLiteralExpression().Properties.Nodes) == 0) + } + return false +} + +func GetContainingFunction(node *Node) *Node { + return FindAncestor(node.Parent, IsFunctionLike) +} diff --git a/internal/binder/binder.go b/internal/binder/binder.go index e113b2505ed..baab837d742 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -1022,30 +1022,18 @@ func getInitializerSymbol(symbol *ast.Symbol) *ast.Symbol { case ast.IsVariableDeclaration(declaration) && (declaration.Parent.Flags&ast.NodeFlagsConst != 0 || ast.IsInJSFile(declaration)): initializer := declaration.Initializer() - if isExpandoInitializer(initializer) { + if ast.IsExpandoInitializer(initializer) { return initializer.Symbol() } case ast.IsBinaryExpression(declaration) && ast.IsInJSFile(declaration): initializer := declaration.AsBinaryExpression().Right - if isExpandoInitializer(initializer) { + if ast.IsExpandoInitializer(initializer) { return initializer.Symbol() } } return nil } -func isExpandoInitializer(initializer *ast.Node) bool { - if initializer == nil { - return false - } - if ast.IsFunctionExpressionOrArrowFunction(initializer) { - return true - } else if ast.IsInJSFile(initializer) { - return ast.IsClassExpression(initializer) || (ast.IsObjectLiteralExpression(initializer) && len(initializer.AsObjectLiteralExpression().Properties.Nodes) == 0) - } - return false -} - func (b *Binder) bindThisPropertyAssignment(node *ast.Node) { if !ast.IsInJSFile(node) { return diff --git a/internal/binder/referenceresolver.go b/internal/binder/referenceresolver.go index 8fbe5297e3a..2e428044a78 100644 --- a/internal/binder/referenceresolver.go +++ b/internal/binder/referenceresolver.go @@ -11,6 +11,7 @@ type ReferenceResolver interface { GetReferencedImportDeclaration(node *ast.IdentifierNode) *ast.Declaration GetReferencedValueDeclaration(node *ast.IdentifierNode) *ast.Declaration GetReferencedValueDeclarations(node *ast.IdentifierNode) []*ast.Declaration + GetElementAccessExpressionName(expression *ast.ElementAccessExpression) string } type ReferenceResolverHooks struct { @@ -21,6 +22,7 @@ type ReferenceResolverHooks struct { GetSymbolOfDeclaration func(*ast.Declaration) *ast.Symbol GetTypeOnlyAliasDeclaration func(symbol *ast.Symbol, include ast.SymbolFlags) *ast.Declaration GetExportSymbolOfValueSymbolIfExported func(*ast.Symbol) *ast.Symbol + GetElementAccessExpressionName func(*ast.ElementAccessExpression) (string, bool) } var _ ReferenceResolver = &referenceResolver{} @@ -236,3 +238,14 @@ func (r *referenceResolver) GetReferencedValueDeclarations(node *ast.IdentifierN } return declarations } + +func (r *referenceResolver) GetElementAccessExpressionName(expression *ast.ElementAccessExpression) string { + if expression != nil { + if r.hooks.GetElementAccessExpressionName != nil { + if name, ok := r.hooks.GetElementAccessExpressionName(expression); ok { + return name + } + } + } + return "" +} diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 72539b20fdb..12b893dff17 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -262,6 +262,7 @@ type InferenceContext struct { mapper *TypeMapper // Mapper that fixes inferences nonFixingMapper *TypeMapper // Mapper that doesn't fix inferences returnMapper *TypeMapper // Type mapper for inferences from return types (if any) + outerReturnMapper *TypeMapper // Type mapper for inferences from return types of outer function (if any) inferredTypeParameters []*Type // Inferred type parameters for function result intraExpressionInferenceSites []IntraExpressionInferenceSite } @@ -1950,46 +1951,64 @@ func (c *Checker) isBlockScopedNameDeclaredBeforeUse(declaration *ast.Node, usag } func (c *Checker) isUsedInFunctionOrInstanceProperty(usage *ast.Node, declaration *ast.Node, declContainer *ast.Node) bool { - for current := usage; current != nil && current != declContainer; current = current.Parent { + return ast.FindAncestorOrQuit(usage, func(current *ast.Node) ast.FindAncestorResult { + if current == declContainer { + return ast.FindAncestorQuit + } if ast.IsFunctionLike(current) { - return ast.GetImmediatelyInvokedFunctionExpression(current) == nil + return ast.ToFindAncestorResult(ast.GetImmediatelyInvokedFunctionExpression(current) == nil) } if ast.IsClassStaticBlockDeclaration(current) { - return declaration.Pos() < usage.Pos() + return ast.ToFindAncestorResult(declaration.Pos() < usage.Pos()) } - if current.Parent != nil && ast.IsPropertyDeclaration(current.Parent) && current.Parent.Initializer() == current { - if ast.IsStatic(current.Parent) { - if ast.IsMethodDeclaration(declaration) { - return true - } - if ast.IsPropertyDeclaration(declaration) && ast.GetContainingClass(usage) == ast.GetContainingClass(declaration) { - propName := declaration.Name() - if ast.IsIdentifier(propName) || ast.IsPrivateIdentifier(propName) { - t := c.getTypeOfSymbol(c.getSymbolOfDeclaration(declaration)) - staticBlocks := core.Filter(declaration.Parent.Members(), ast.IsClassStaticBlockDeclaration) - if c.isPropertyInitializedInStaticBlocks(propName, t, staticBlocks, declaration.Parent.Pos(), current.Pos()) { - return true + + if current.Parent != nil && ast.IsPropertyDeclaration(current.Parent) { + propertyDeclaration := current.Parent + initializerOfProperty := propertyDeclaration.Initializer() == current + if initializerOfProperty { + if ast.IsStatic(current.Parent) { + if ast.IsMethodDeclaration(declaration) { + return ast.FindAncestorTrue + } + if ast.IsPropertyDeclaration(declaration) && ast.GetContainingClass(usage) == ast.GetContainingClass(declaration) { + propName := declaration.Name() + if ast.IsIdentifier(propName) || ast.IsPrivateIdentifier(propName) { + t := c.getTypeOfSymbol(c.getSymbolOfDeclaration(declaration)) + staticBlocks := core.Filter(declaration.Parent.Members(), ast.IsClassStaticBlockDeclaration) + if c.isPropertyInitializedInStaticBlocks(propName, t, staticBlocks, declaration.Parent.Pos(), current.Pos()) { + return ast.FindAncestorTrue + } } } - } - } else { - isDeclarationInstanceProperty := ast.IsPropertyDeclaration(declaration) && !ast.IsStatic(declaration) - if !isDeclarationInstanceProperty || ast.GetContainingClass(usage) != ast.GetContainingClass(declaration) { - return true + } else { + isDeclarationInstanceProperty := ast.IsPropertyDeclaration(declaration) && !ast.IsStatic(declaration) + if !isDeclarationInstanceProperty || ast.GetContainingClass(usage) != ast.GetContainingClass(declaration) { + return ast.FindAncestorTrue + } } } } - if current.Parent != nil && ast.IsDecorator(current.Parent) && current.Parent.AsDecorator().Expression == current { + + if current.Parent != nil && ast.IsDecorator(current.Parent) { decorator := current.Parent.AsDecorator() - if ast.IsParameter(decorator.Parent) { - return c.isUsedInFunctionOrInstanceProperty(decorator.Parent.Parent.Parent, declaration, declContainer) - } - if ast.IsMethodDeclaration(decorator.Parent) { - return c.isUsedInFunctionOrInstanceProperty(decorator.Parent.Parent, declaration, declContainer) + if decorator.Expression == current { + if ast.IsParameter(decorator.Parent) { + if c.isUsedInFunctionOrInstanceProperty(decorator.Parent.Parent.Parent, declaration, declContainer) { + return ast.FindAncestorTrue + } + return ast.FindAncestorQuit + } + if ast.IsMethodDeclaration(decorator.Parent) { + if c.isUsedInFunctionOrInstanceProperty(decorator.Parent.Parent, declaration, declContainer) { + return ast.FindAncestorTrue + } + return ast.FindAncestorQuit + } } } - } - return false + + return ast.FindAncestorFalse + }) != nil } func isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration *ast.Node, usage *ast.Node, declContainer *ast.Node) bool { @@ -2510,7 +2529,7 @@ func (c *Checker) checkParameter(node *ast.Node) { // or if its FunctionBody is strict code(11.1.5). c.checkGrammarModifiers(node) c.checkVariableLikeDeclaration(node) - fn := getContainingFunction(node) + fn := ast.GetContainingFunction(node) var paramName string if node.Name() != nil && ast.IsIdentifier(node.Name()) { paramName = node.Name().Text() @@ -4279,7 +4298,7 @@ func (c *Checker) checkBaseTypeAccessibility(t *Type, node *ast.Node) { signatures := c.getSignaturesOfType(t, SignatureKindConstruct) if len(signatures) != 0 { declaration := signatures[0].declaration - if declaration != nil && HasModifier(declaration, ast.ModifierFlagsPrivate) { + if declaration != nil && ast.HasModifier(declaration, ast.ModifierFlagsPrivate) { typeClassDeclaration := ast.GetClassLikeDeclarationOfSymbol(t.symbol) if !c.isNodeWithinClass(node, typeClassDeclaration) { c.error(node, diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, c.getFullyQualifiedName(t.symbol, nil)) @@ -5208,7 +5227,7 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { return } - if c.moduleKind == core.ModuleKindNodeNext && !isImportAttributes { + if core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && !isImportAttributes { c.grammarErrorOnNode(node, diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) return } @@ -5568,7 +5587,7 @@ func (c *Checker) checkVariableLikeDeclaration(node *ast.Node) { } if ast.IsBindingElement(node) { propName := node.PropertyName() - if propName != nil && ast.IsIdentifier(node.Name()) && ast.IsPartOfParameterDeclaration(node) && ast.NodeIsMissing(getContainingFunction(node).Body()) { + if propName != nil && ast.IsIdentifier(node.Name()) && ast.IsPartOfParameterDeclaration(node) && ast.NodeIsMissing(ast.GetContainingFunction(node).Body()) { // type F = ({a: string}) => void; // ^^^^^^ // variable renaming in function type notation is confusing, @@ -5603,7 +5622,7 @@ func (c *Checker) checkVariableLikeDeclaration(node *ast.Node) { c.checkSourceElements(name.AsBindingPattern().Elements.Nodes) } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if initializer != nil && ast.IsPartOfParameterDeclaration(node) && ast.NodeIsMissing(getContainingFunction(node).Body()) { + if initializer != nil && ast.IsPartOfParameterDeclaration(node) && ast.NodeIsMissing(ast.GetContainingFunction(node).Body()) { c.error(node, diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation) return } @@ -6534,7 +6553,7 @@ func (c *Checker) checkAliasSymbol(node *ast.Node) { name := node.PropertyNameOrName().Text() c.addTypeOnlyDeclarationRelatedInfo(c.error(node, message, name), core.IfElse(isType, nil, typeOnlyAlias), name) } - if isType && node.Kind == ast.KindImportEqualsDeclaration && HasModifier(node, ast.ModifierFlagsExport) { + if isType && node.Kind == ast.KindImportEqualsDeclaration && ast.HasModifier(node, ast.ModifierFlagsExport) { c.error(node, diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, c.getIsolatedModulesLikeFlagName()) } case ast.KindExportSpecifier: @@ -6822,7 +6841,7 @@ func (c *Checker) checkUnusedClassMembers(node *ast.Node) { break // Already would have reported an error on the getter. } symbol := c.getSymbolOfDeclaration(member) - if !c.isReferenced(symbol) && (HasModifier(member, ast.ModifierFlagsPrivate) || member.Name() != nil && ast.IsPrivateIdentifier(member.Name())) && member.Flags&ast.NodeFlagsAmbient == 0 { + if !c.isReferenced(symbol) && (ast.HasModifier(member, ast.ModifierFlagsPrivate) || member.Name() != nil && ast.IsPrivateIdentifier(member.Name())) && member.Flags&ast.NodeFlagsAmbient == 0 { c.reportUnused(member, UnusedKindLocal, NewDiagnosticForNode(member.Name(), diagnostics.X_0_is_declared_but_its_value_is_never_read, c.symbolToString(symbol))) } case ast.KindConstructor: @@ -7074,7 +7093,9 @@ func (c *Checker) getQuickTypeOfExpression(node *ast.Node) *Type { if isCallChain(expr) { return c.getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) } - return c.getReturnTypeOfSingleNonGenericCallSignature(c.checkNonNullExpression(expr.Expression())) + return c.getReturnTypeOfSingleNonGenericSignature(c.checkNonNullExpression(expr.Expression()), SignatureKindCall) + case ast.IsNewExpression(expr): + return c.getReturnTypeOfSingleNonGenericSignature(c.checkNonNullExpression(expr.Expression()), SignatureKindConstruct) case ast.IsAssertionExpression(expr) && !ast.IsConstTypeReference(expr.Type()): return c.getTypeFromTypeNode(expr.Type()) case ast.IsLiteralExpression(node) || ast.IsBooleanLiteral(node): @@ -7083,8 +7104,8 @@ func (c *Checker) getQuickTypeOfExpression(node *ast.Node) *Type { return nil } -func (c *Checker) getReturnTypeOfSingleNonGenericCallSignature(funcType *Type) *Type { - signature := c.getSingleCallSignature(funcType) +func (c *Checker) getReturnTypeOfSingleNonGenericSignature(funcType *Type, kind SignatureKind) *Type { + signature := c.getSingleSignature(funcType, kind, true /*allowMembers*/) if signature != nil && len(signature.typeParameters) == 0 { return c.getReturnTypeOfSignature(signature) } @@ -7094,7 +7115,7 @@ func (c *Checker) getReturnTypeOfSingleNonGenericCallSignature(funcType *Type) * func (c *Checker) getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr *ast.Node) *Type { funcType := c.checkExpression(expr.Expression()) nonOptionalType := c.getOptionalExpressionType(funcType, expr.Expression()) - returnType := c.getReturnTypeOfSingleNonGenericCallSignature(funcType) + returnType := c.getReturnTypeOfSingleNonGenericSignature(funcType, SignatureKindCall) if returnType != nil { return c.propagateOptionalTypeMarker(returnType, expr, nonOptionalType != funcType) } @@ -7353,7 +7374,7 @@ func (c *Checker) instantiateTypeWithSingleGenericCallSignature(node *ast.Node, if !hasOverlappingInferences(context.inferences, inferences) { c.mergeInferences(context.inferences, inferences) context.inferredTypeParameters = core.Concatenate(context.inferredTypeParameters, uniqueTypeParameters) - return c.getOrCreateTypeFromSignature(instantiatedSignature, nil) + return c.getOrCreateTypeFromSignature(instantiatedSignature) } } } @@ -7361,7 +7382,7 @@ func (c *Checker) instantiateTypeWithSingleGenericCallSignature(node *ast.Node, // and thus get different inferred types. That this is cached on the *first* such attempt is not currently an issue, since expression // types *also* get cached on the first pass. If we ever properly speculate, though, the cached "isolatedSignatureType" signature // field absolutely needs to be included in the list of speculative caches. - return c.getOrCreateTypeFromSignature(c.instantiateSignatureInContextOf(signature, contextualSignature, context, nil), c.getOuterInferenceTypeParameters()) + return c.getOrCreateTypeFromSignature(c.instantiateSignatureInContextOf(signature, contextualSignature, context, nil)) } func (c *Checker) getOuterInferenceTypeParameters() []*Type { @@ -8380,7 +8401,7 @@ func (c *Checker) resolveNewExpression(node *ast.Node, candidatesOutArray *[]*Si } if expressionType.symbol != nil { valueDecl := ast.GetClassLikeDeclarationOfSymbol(expressionType.symbol) - if valueDecl != nil && HasModifier(valueDecl, ast.ModifierFlagsAbstract) { + if valueDecl != nil && ast.HasModifier(valueDecl, ast.ModifierFlagsAbstract) { c.error(node, diagnostics.Cannot_create_an_instance_of_an_abstract_class) return c.resolveErrorCall(node) } @@ -9219,7 +9240,7 @@ func (c *Checker) inferTypeArguments(node *ast.Node, signature *Signature, args contextualSignature := c.getSingleCallSignature(instantiatedType) var inferenceSourceType *Type if contextualSignature != nil && len(contextualSignature.typeParameters) != 0 { - inferenceSourceType = c.getOrCreateTypeFromSignature(c.getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters), nil) + inferenceSourceType = c.getOrCreateTypeFromSignature(c.getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) } else { inferenceSourceType = instantiatedType } @@ -9230,10 +9251,14 @@ func (c *Checker) inferTypeArguments(node *ast.Node, signature *Signature, args // from the return type. We need a separate inference pass here because (a) instantiation of // the source type uses the outer context's return mapper (which excludes inferences made from // outer arguments), and (b) we don't want any further inferences going into this context. + // We use `createOuterReturnMapper` to ensure that all occurrences of outer type parameters are + // replaced with inferences produced from the outer return type or preceding outer arguments. + // This protects against circular inferences, i.e. avoiding situations where inferences reference + // type parameters for which the inferences are being made. returnContext := c.newInferenceContext(signature.typeParameters, signature, context.flags, nil) var outerReturnMapper *TypeMapper if outerContext != nil { - outerReturnMapper = outerContext.returnMapper + outerReturnMapper = c.createOuterReturnMapper(outerContext) } returnSourceType := c.instantiateType(contextualType, outerReturnMapper) c.inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType, InferencePriorityNone, false) @@ -10554,7 +10579,7 @@ func (c *Checker) checkSpreadExpression(node *ast.Node, checkMode CheckMode) *Ty func (c *Checker) checkYieldExpression(node *ast.Node) *Type { c.checkGrammarYieldExpression(node) - fn := getContainingFunction(node) + fn := ast.GetContainingFunction(node) if fn == nil { return c.anyType } @@ -13983,6 +14008,12 @@ func (c *Checker) getTargetOfImportEqualsDeclaration(node *ast.Node, dontResolve } immediate := c.resolveExternalModuleName(node, moduleReference, false /*ignoreErrors*/) resolved := c.resolveExternalModuleSymbol(immediate, false /*dontResolveAlias*/) + if resolved != nil && core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext { + moduleExports := c.getExportOfModule(resolved, ast.InternalSymbolNameModuleExports, node, dontResolveAlias) + if moduleExports != nil { + return moduleExports + } + } c.markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false /*overwriteEmpty*/, nil, "") return resolved } @@ -14052,14 +14083,42 @@ func (c *Checker) getTargetOfImportClause(node *ast.Node, dontResolveAlias bool) } func (c *Checker) getTargetOfModuleDefault(moduleSymbol *ast.Symbol, node *ast.Node, dontResolveAlias bool) *ast.Symbol { + file := core.Find(moduleSymbol.Declarations, ast.IsSourceFile) + specifier := c.getModuleSpecifierForImportOrExport(node) var exportDefaultSymbol *ast.Symbol + var exportModuleDotExportsSymbol *ast.Symbol if isShorthandAmbientModuleSymbol(moduleSymbol) { - exportDefaultSymbol = moduleSymbol + // !!! exportDefaultSymbol = moduleSymbol + // Does nothing? + } else if file != nil && specifier != nil && + core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && + c.getEmitSyntaxForModuleSpecifierExpression(specifier) == core.ModuleKindCommonJS && + c.program.GetImpliedNodeFormatForEmit(file.AsSourceFile()) == core.ModuleKindESNext { + exportModuleDotExportsSymbol = c.resolveExportByName(moduleSymbol, ast.InternalSymbolNameModuleExports, node, dontResolveAlias) + } + if exportModuleDotExportsSymbol != nil { + // We have a transpiled default import where the `require` resolves to an ES module with a `module.exports` named + // export. If `esModuleInterop` is enabled, this will work: + // + // const dep_1 = __importDefault(require("./dep.mjs")); // wraps like { default: require("./dep.mjs") } + // dep_1.default; // require("./dep.mjs") -> the `module.exports` export value + // + // But without `esModuleInterop`, it will be broken: + // + // const dep_1 = require("./dep.mjs"); // the `module.exports` export value (could be primitive) + // dep_1.default; // `default` property access on the `module.exports` export value + // + // We could try to resolve the 'default' property in the latter case, but it's a mistake to run in this + // environment without `esModuleInterop`, so just error. + if !c.compilerOptions.GetESModuleInterop() { + c.error(node.Name(), diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, c.symbolToString(moduleSymbol), "esModuleInterop") + return nil + } + c.markSymbolOfAliasDeclarationIfTypeOnly(node, exportModuleDotExportsSymbol /*finalTarget*/, nil /*overwriteEmpty*/, false, nil, "") + return exportModuleDotExportsSymbol } else { exportDefaultSymbol = c.resolveExportByName(moduleSymbol, ast.InternalSymbolNameDefault, node, dontResolveAlias) } - file := core.Find(moduleSymbol.Declarations, ast.IsSourceFile) - specifier := c.getModuleSpecifierForImportOrExport(node) if specifier == nil { return exportDefaultSymbol } @@ -15055,7 +15114,11 @@ func (c *Checker) resolveESModuleSymbol(moduleSymbol *ast.Symbol, referencingLoc return symbol } referenceParent := referencingLocation.Parent - if ast.IsImportDeclaration(referenceParent) && ast.GetNamespaceDeclarationNode(referenceParent) != nil || ast.IsImportCall(referenceParent) { + var namespaceImport *ast.Node + if ast.IsImportDeclaration(referenceParent) { + namespaceImport = ast.GetNamespaceDeclarationNode(referenceParent) + } + if namespaceImport != nil || ast.IsImportCall(referenceParent) { var reference *ast.Node if ast.IsImportCall(referenceParent) { reference = referenceParent.AsCallExpression().Arguments.Nodes[0] @@ -15067,29 +15130,51 @@ func (c *Checker) resolveESModuleSymbol(moduleSymbol *ast.Symbol, referencingLoc if defaultOnlyType != nil { return c.cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent) } - // !!! - // targetFile := moduleSymbol. /* ? */ declarations. /* ? */ find(isSourceFile) - // isEsmCjsRef := targetFile && c.isESMFormatImportImportingCommonjsFormatFile(c.getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile)) - // if c.compilerOptions.GetESModuleInterop() || isEsmCjsRef { - // sigs := c.getSignaturesOfStructuredType(type_, SignatureKindCall) - // if !sigs || !sigs.length { - // sigs = c.getSignaturesOfStructuredType(type_, SignatureKindConstruct) - // } - // if (sigs && sigs.length) || c.getPropertyOfType(type_, ast.InternalSymbolNameDefault /*skipObjectFunctionPropertyAugment*/, true) || isEsmCjsRef { - // var moduleType *Type - // if type_.flags & TypeFlagsStructuredType { - // moduleType = c.getTypeWithSyntheticDefaultImportType(type_, symbol, moduleSymbol, reference) - // } else { - // moduleType = c.createDefaultPropertyWrapperForModule(symbol, symbol.parent) - // } - // return c.cloneTypeAsModuleType(symbol, moduleType, referenceParent) - // } - // } + + targetFile := core.Find(moduleSymbol.Declarations, ast.IsSourceFile) + usageMode := c.getEmitSyntaxForModuleSpecifierExpression(reference) + var exportModuleDotExportsSymbol *ast.Symbol + if namespaceImport != nil && targetFile != nil && + core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && + usageMode == core.ModuleKindCommonJS && + c.program.GetImpliedNodeFormatForEmit(targetFile.AsSourceFile()) == core.ModuleKindESNext { + exportModuleDotExportsSymbol = c.getExportOfModule(symbol, ast.InternalSymbolNameModuleExports, namespaceImport, dontResolveAlias) + } + if exportModuleDotExportsSymbol != nil { + if !suppressInteropError && symbol.Flags&(ast.SymbolFlagsModule|ast.SymbolFlagsVariable) == 0 { + c.error(referencingLocation, diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, "esModuleInterop") + } + if c.compilerOptions.GetESModuleInterop() && c.hasSignatures(typ) { + return c.cloneTypeAsModuleType(exportModuleDotExportsSymbol, typ, referenceParent) + } + return exportModuleDotExportsSymbol + } + + isEsmCjsRef := targetFile != nil && isESMFormatImportImportingCommonjsFormatFile(usageMode, c.program.GetImpliedNodeFormatForEmit(targetFile.AsSourceFile())) + if c.compilerOptions.GetESModuleInterop() || isEsmCjsRef { + if c.hasSignatures(typ) || c.getPropertyOfTypeEx(typ, ast.InternalSymbolNameDefault, true /*skipObjectFunctionPropertyAugment*/, false /*includeTypeOnlyMembers*/) != nil || isEsmCjsRef { + var moduleType *Type + if typ.Flags()&TypeFlagsStructuredType != 0 { + moduleType = c.getTypeWithSyntheticDefaultImportType(typ, symbol, moduleSymbol, reference) + } else { + moduleType = c.createDefaultPropertyWrapperForModule(symbol, symbol.Parent, nil) + } + return c.cloneTypeAsModuleType(symbol, moduleType, referenceParent) + } + } } } return symbol } +func (c *Checker) hasSignatures(t *Type) bool { + return len(c.getSignaturesOfStructuredType(t, SignatureKindCall)) > 0 || len(c.getSignaturesOfStructuredType(t, SignatureKindConstruct)) > 0 +} + +func isESMFormatImportImportingCommonjsFormatFile(usageMode core.ResolutionMode, targetMode core.ResolutionMode) bool { + return usageMode == core.ModuleKindESNext && targetMode == core.ModuleKindCommonJS +} + func (c *Checker) getTypeWithSyntheticDefaultOnly(t *Type, symbol *ast.Symbol, originalSymbol *ast.Symbol, moduleSpecifier *ast.Node) *Type { hasDefaultOnly := c.isOnlyImportableAsDefault(moduleSpecifier, nil) if hasDefaultOnly && t != nil && !c.isErrorType(t) { @@ -16473,6 +16558,10 @@ func (c *Checker) hasNonCircularBaseConstraint(t *Type) bool { // This is a worker function. Use getConstraintOfTypeParameter which guards against circular constraints func (c *Checker) getConstraintFromTypeParameter(t *Type) *Type { + if t.flags&TypeFlagsTypeParameter == 0 { + return nil + } + tp := t.AsTypeParameter() if tp.constraint == nil { var constraint *Type @@ -18599,8 +18688,10 @@ func (c *Checker) getSignatureInstantiation(sig *Signature, typeArguments []*Typ if returnSignature != nil { newReturnSignature := c.cloneSignature(returnSignature) newReturnSignature.typeParameters = inferredTypeParameters + newReturnType := c.getOrCreateTypeFromSignature(newReturnSignature) + newReturnType.AsObjectType().mapper = instantiatedSignature.mapper newInstantiatedSignature := c.cloneSignature(instantiatedSignature) - newInstantiatedSignature.resolvedReturnType = c.getOrCreateTypeFromSignature(newReturnSignature, nil) + newInstantiatedSignature.resolvedReturnType = newReturnType return newInstantiatedSignature } } @@ -18665,7 +18756,7 @@ func (c *Checker) getSingleSignature(t *Type, kind SignatureKind, allowMembers b return nil } -func (c *Checker) getOrCreateTypeFromSignature(sig *Signature, outerTypeParameters []*Type) *Type { +func (c *Checker) getOrCreateTypeFromSignature(sig *Signature) *Type { // There are two ways to declare a construct signature, one is by declaring a class constructor // using the constructor keyword, and the other is declaring a bare construct signature in an // object type literal or interface (using the new keyword). Each way of declaring a constructor @@ -18677,17 +18768,12 @@ func (c *Checker) getOrCreateTypeFromSignature(sig *Signature, outerTypeParamete } // If declaration is undefined, it is likely to be the signature of the default constructor. isConstructor := kind == ast.KindUnknown || kind == ast.KindConstructor || kind == ast.KindConstructSignature || kind == ast.KindConstructorType - // The type must have a symbol with a `Function` flag and a declaration in order to be correctly flagged as possibly containing - // type variables by `couldContainTypeVariables` - t := c.newObjectType(ObjectFlagsAnonymous|ObjectFlagsSingleSignatureType, c.newSymbol(ast.SymbolFlagsFunction, ast.InternalSymbolNameFunction)) - if sig.declaration != nil && !ast.NodeIsSynthesized(sig.declaration) { - t.symbol.Declarations = []*ast.Node{sig.declaration} - t.symbol.ValueDeclaration = sig.declaration - } - if outerTypeParameters == nil && sig.declaration != nil { - outerTypeParameters = c.getOuterTypeParameters(sig.declaration, true /*includeThisTypes*/) + + var symbol *ast.Symbol + if sig.declaration != nil { + symbol = sig.declaration.Symbol() } - t.AsSingleSignatureType().outerTypeParameters = outerTypeParameters + t := c.newObjectType(ObjectFlagsAnonymous|ObjectFlagsSingleSignatureType, symbol) if isConstructor { c.setStructuredTypeMembers(t, nil, nil, []*Signature{sig}, nil) } else { @@ -18958,7 +19044,7 @@ func (c *Checker) getIndexInfosOfIndexSymbol(indexSymbol *ast.Symbol, siblingSym } forEachType(c.getTypeFromTypeNode(typeNode), func(keyType *Type) { if c.isValidIndexKeyType(keyType) && findIndexInfo(indexInfos, keyType) == nil { - indexInfo := c.newIndexInfo(keyType, valueType, HasModifier(declaration, ast.ModifierFlagsReadonly), declaration, nil) + indexInfo := c.newIndexInfo(keyType, valueType, ast.HasModifier(declaration, ast.ModifierFlagsReadonly), declaration, nil) indexInfos = append(indexInfos, indexInfo) } }) @@ -21347,6 +21433,9 @@ func (c *Checker) getDefaultTypeArgumentType(isInJavaScriptFile bool) *Type { // this gets the instantiated default type of its target. If the type parameter has no default type or // the default is circular, `undefined` is returned. func (c *Checker) getDefaultFromTypeParameter(t *Type) *Type { + if t.flags&TypeFlagsTypeParameter == 0 { + return nil + } defaultType := c.getResolvedTypeParameterDefault(t) if defaultType != c.noConstraintType && defaultType != c.circularConstraintType { return defaultType @@ -21514,7 +21603,6 @@ func (c *Checker) couldContainTypeVariablesWorker(t *Type) bool { } result := t.flags&TypeFlagsInstantiable != 0 || t.flags&TypeFlagsObject != 0 && !c.isNonGenericTopLevelType(t) && (objectFlags&ObjectFlagsReference != 0 && (t.AsTypeReference().node != nil || core.Some(c.getTypeArguments(t), c.couldContainTypeVariables)) || - objectFlags&ObjectFlagsSingleSignatureType != 0 && len(t.AsSingleSignatureType().outerTypeParameters) != 0 || objectFlags&ObjectFlagsAnonymous != 0 && t.symbol != nil && t.symbol.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod|ast.SymbolFlagsClass|ast.SymbolFlagsTypeLiteral|ast.SymbolFlagsObjectLiteral) != 0 && t.symbol.Declarations != nil || objectFlags&(ObjectFlagsMapped|ObjectFlagsReverseMapped|ObjectFlagsObjectRestType|ObjectFlagsInstantiationExpressionType) != 0) || t.flags&TypeFlagsUnionOrIntersection != 0 && t.flags&TypeFlagsEnumLiteral == 0 && !c.isNonGenericTopLevelType(t) && core.Some(t.Types(), c.couldContainTypeVariables) @@ -21621,9 +21709,8 @@ func (c *Checker) instantiateTypeWorker(t *Type, m *TypeMapper, alias *TypeAlias } // Handles instantiation of the following object types: -// AnonymousType (ObjectFlagsAnonymous) +// AnonymousType (ObjectFlagsAnonymous|ObjectFlagsSingleSignatureType) // TypeReference with node != nil (ObjectFlagsReference) -// SingleSignatureType (ObjectFlagsSingleSignatureType) // InstantiationExpressionType (ObjectFlagsInstantiationExpressionType) // MappedType (ObjectFlagsMapped) func (c *Checker) getObjectTypeInstantiation(t *Type, m *TypeMapper, alias *TypeAlias) *Type { @@ -21647,34 +21734,30 @@ func (c *Checker) getObjectTypeInstantiation(t *Type, m *TypeMapper, alias *Type default: target = t } - if t.objectFlags&ObjectFlagsSingleSignatureType != 0 { - typeParameters = t.AsSingleSignatureType().outerTypeParameters - } else { - typeParameters = links.outerTypeParameters - if typeParameters == nil { - // The first time an anonymous type is instantiated we compute and store a list of the type - // parameters that are in scope (and therefore potentially referenced). For type literals that - // aren't the right hand side of a generic type alias declaration we optimize by reducing the - // set of type parameters to those that are possibly referenced in the literal. - typeParameters = c.getOuterTypeParameters(declaration, true /*includeThisTypes*/) - if len(target.alias.TypeArguments()) == 0 { - if t.objectFlags&(ObjectFlagsReference|ObjectFlagsInstantiationExpressionType) != 0 { - typeParameters = core.Filter(typeParameters, func(tp *Type) bool { - return c.isTypeParameterPossiblyReferenced(tp, declaration) - }) - } else if target.symbol.Flags&(ast.SymbolFlagsMethod|ast.SymbolFlagsTypeLiteral) != 0 { - typeParameters = core.Filter(typeParameters, func(tp *Type) bool { - return core.Some(t.symbol.Declarations, func(d *ast.Node) bool { - return c.isTypeParameterPossiblyReferenced(tp, d) - }) + typeParameters = links.outerTypeParameters + if typeParameters == nil { + // The first time an anonymous type is instantiated we compute and store a list of the type + // parameters that are in scope (and therefore potentially referenced). For type literals that + // aren't the right hand side of a generic type alias declaration we optimize by reducing the + // set of type parameters to those that are possibly referenced in the literal. + typeParameters = c.getOuterTypeParameters(declaration, true /*includeThisTypes*/) + if len(target.alias.TypeArguments()) == 0 { + if t.objectFlags&(ObjectFlagsReference|ObjectFlagsInstantiationExpressionType) != 0 { + typeParameters = core.Filter(typeParameters, func(tp *Type) bool { + return c.isTypeParameterPossiblyReferenced(tp, declaration) + }) + } else if target.symbol.Flags&(ast.SymbolFlagsMethod|ast.SymbolFlagsTypeLiteral) != 0 { + typeParameters = core.Filter(typeParameters, func(tp *Type) bool { + return core.Some(t.symbol.Declarations, func(d *ast.Node) bool { + return c.isTypeParameterPossiblyReferenced(tp, d) }) - } - } - if typeParameters == nil { - typeParameters = []*Type{} + }) } - links.outerTypeParameters = typeParameters } + if typeParameters == nil { + typeParameters = []*Type{} + } + links.outerTypeParameters = typeParameters } if len(typeParameters) == 0 { return t @@ -21699,12 +21782,10 @@ func (c *Checker) getObjectTypeInstantiation(t *Type, m *TypeMapper, alias *Type } result := data.instantiations[key] if result == nil { - if t.objectFlags&ObjectFlagsSingleSignatureType != 0 { - result = c.instantiateAnonymousType(t, m, nil /*alias*/) - data.instantiations[key] = result - return result - } newMapper := newTypeMapper(typeParameters, typeArguments) + if target.objectFlags&ObjectFlagsSingleSignatureType != 0 && m != nil { + newMapper = c.combineTypeMappers(newMapper, m) + } switch { case target.objectFlags&ObjectFlagsReference != 0: result = c.createDeferredTypeReference(t.Target(), t.AsTypeReference().node, newMapper, newAlias) @@ -21800,8 +21881,6 @@ func (c *Checker) instantiateAnonymousType(t *Type, m *TypeMapper, alias *TypeAl freshTypeParameter.AsTypeParameter().mapper = m case t.objectFlags&ObjectFlagsInstantiationExpressionType != 0: result.AsInstantiationExpressionType().node = t.AsInstantiationExpressionType().node - case t.objectFlags&ObjectFlagsSingleSignatureType != 0: - result.AsSingleSignatureType().outerTypeParameters = t.AsSingleSignatureType().outerTypeParameters } if alias == nil { alias = c.instantiateTypeAlias(t.alias, m) @@ -22931,7 +23010,7 @@ func (c *Checker) getTypeAliasInstantiation(symbol *ast.Symbol, typeArguments [] func isLocalTypeAlias(symbol *ast.Symbol) bool { declaration := core.Find(symbol.Declarations, isTypeAlias) - return declaration != nil && getContainingFunction(declaration) != nil + return declaration != nil && ast.GetContainingFunction(declaration) != nil } func (c *Checker) getDeclaredTypeOfSymbol(symbol *ast.Symbol) *Type { @@ -24327,8 +24406,6 @@ func (c *Checker) newObjectType(objectFlags ObjectFlags, symbol *ast.Symbol) *Ty data = &EvolvingArrayType{} case objectFlags&ObjectFlagsInstantiationExpressionType != 0: data = &InstantiationExpressionType{} - case objectFlags&ObjectFlagsSingleSignatureType != 0: - data = &SingleSignatureType{} case objectFlags&ObjectFlagsAnonymous != 0: data = &ObjectType{} default: @@ -26883,7 +26960,7 @@ func (c *Checker) markPropertyAsReferenced(prop *ast.Symbol, nodeForCheckWriteOn if prop.Flags&ast.SymbolFlagsClassMember == 0 || prop.ValueDeclaration == nil { return } - hasPrivateModifier := HasModifier(prop.ValueDeclaration, ast.ModifierFlagsPrivate) + hasPrivateModifier := ast.HasModifier(prop.ValueDeclaration, ast.ModifierFlagsPrivate) hasPrivateIdentifier := prop.ValueDeclaration.Name() != nil && ast.IsPrivateIdentifier(prop.ValueDeclaration.Name()) if !hasPrivateModifier && !hasPrivateIdentifier { return @@ -28437,7 +28514,7 @@ func (c *Checker) getContextualTypeForStaticPropertyDeclaration(declaration *ast } func (c *Checker) getContextualTypeForReturnExpression(node *ast.Node, contextFlags ContextFlags) *Type { - fn := getContainingFunction(node) + fn := ast.GetContainingFunction(node) if fn != nil { contextualReturnType := c.getContextualReturnType(fn, contextFlags) if contextualReturnType != nil { @@ -28532,7 +28609,7 @@ func (c *Checker) getContextualSignatureForFunctionLikeDeclaration(node *ast.Nod } func (c *Checker) getContextualTypeForYieldOperand(node *ast.Node, contextFlags ContextFlags) *Type { - fn := getContainingFunction(node) + fn := ast.GetContainingFunction(node) if fn != nil { functionFlags := getFunctionFlags(fn) contextualReturnType := c.getContextualReturnType(fn, contextFlags) @@ -28616,7 +28693,7 @@ func (c *Checker) getContextualTypeForArgumentAtIndex(callTarget *ast.Node, argI func (c *Checker) getContextualTypeForDecorator(decorator *ast.Node) *Type { signature := c.getDecoratorCallSignature(decorator) if signature != nil { - return c.getOrCreateTypeFromSignature(signature, nil) + return c.getOrCreateTypeFromSignature(signature) } return nil } @@ -29146,7 +29223,7 @@ func (c *Checker) getESDecoratorCallSignature(decorator *ast.Node) *Signature { // instance, depending on whether the member was `static`. var valueType *Type if ast.IsMethodDeclaration(node) { - valueType = c.getOrCreateTypeFromSignature(c.getSignatureFromDeclaration(node), nil) + valueType = c.getOrCreateTypeFromSignature(c.getSignatureFromDeclaration(node)) } else { valueType = c.getTypeOfNode(node) } @@ -29313,7 +29390,7 @@ func (c *Checker) newESDecoratorCallSignature(targetType *Type, contextType *Typ // Creates a synthetic `FunctionType` func (c *Checker) newFunctionType(typeParameters []*Type, thisParameter *ast.Symbol, parameters []*ast.Symbol, returnType *Type) *Type { signature := c.newCallSignature(typeParameters, thisParameter, parameters, returnType) - return c.getOrCreateTypeFromSignature(signature, nil) + return c.getOrCreateTypeFromSignature(signature) } func (c *Checker) newGetterFunctionType(t *Type) *Type { diff --git a/internal/checker/emitresolver.go b/internal/checker/emitresolver.go index 1901c17e7a4..287ceeeb12f 100644 --- a/internal/checker/emitresolver.go +++ b/internal/checker/emitresolver.go @@ -826,6 +826,7 @@ func (r *emitResolver) getReferenceResolver() binder.ReferenceResolver { GetSymbolOfDeclaration: r.checker.getSymbolOfDeclaration, GetTypeOnlyAliasDeclaration: r.checker.getTypeOnlyAliasDeclarationEx, GetExportSymbolOfValueSymbolIfExported: r.checker.getExportSymbolOfValueSymbolIfExported, + GetElementAccessExpressionName: r.checker.tryGetElementAccessExpressionName, }) } return r.referenceResolver @@ -880,6 +881,17 @@ func (r *emitResolver) GetReferencedValueDeclarations(node *ast.IdentifierNode) return r.getReferenceResolver().GetReferencedValueDeclarations(node) } +func (r *emitResolver) GetElementAccessExpressionName(expression *ast.ElementAccessExpression) string { + if !ast.IsParseTreeNode(expression.AsNode()) { + return "" + } + + r.checkerMu.Lock() + defer r.checkerMu.Unlock() + + return r.getReferenceResolver().GetElementAccessExpressionName(expression) +} + // TODO: the emit resolver being responsible for some amount of node construction is a very leaky abstraction, // and requires giving it access to a lot of context it's otherwise not required to have, which also further complicates the API // and likely reduces performance. There's probably some refactoring that could be done here to simplify this. diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 75943613bf3..28a18ed053d 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1240,7 +1240,7 @@ func (c *Checker) checkGrammarForInOrForOfStatement(forInOrOfStatement *ast.ForI c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.X_for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module)) } switch c.moduleKind { - case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNodeNext: + case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNode20, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)) @@ -1263,7 +1263,7 @@ func (c *Checker) checkGrammarForInOrForOfStatement(forInOrOfStatement *ast.ForI // use of 'for-await-of' in non-async function if !c.hasParseDiagnostics(sourceFile) { diagnostic := createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.X_for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules) - containingFunc := getContainingFunction(forInOrOfStatement.AsNode()) + containingFunc := ast.GetContainingFunction(forInOrOfStatement.AsNode()) if containingFunc != nil && containingFunc.Kind != ast.KindConstructor { debug.Assert((getFunctionFlags(containingFunc)&FunctionFlagsAsync) == 0, "Enclosing function should never be an async function.") if hasAsyncModifier(containingFunc) { @@ -1752,6 +1752,7 @@ func (c *Checker) checkGrammarAwaitOrAwaitUsing(node *ast.Node) bool { switch c.moduleKind { case core.ModuleKindNode16, core.ModuleKindNode18, + core.ModuleKindNode20, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { diff --git a/internal/checker/inference.go b/internal/checker/inference.go index cb47548b08a..36224ae93f7 100644 --- a/internal/checker/inference.go +++ b/internal/checker/inference.go @@ -1349,6 +1349,19 @@ func (c *Checker) getMapperFromContext(n *InferenceContext) *TypeMapper { return n.mapper } +// Return a type mapper that combines the context's return mapper with a mapper that erases any additional type parameters +// to their inferences at the time of creation. +func (c *Checker) createOuterReturnMapper(context *InferenceContext) *TypeMapper { + if context.outerReturnMapper == nil { + mapper := c.cloneInferenceContext(context, InferenceFlagsNone).mapper + if context.returnMapper != nil { + mapper = newMergedTypeMapper(context.returnMapper, mapper) + } + context.outerReturnMapper = mapper + } + return context.outerReturnMapper +} + func (c *Checker) getCovariantInference(inference *InferenceInfo, signature *Signature) *Type { // Extract all object and array literal types and replace them with a single widened and normalized type. candidates := c.unionObjectAndArrayLiteralCandidates(inference.candidates) diff --git a/internal/checker/jsx.go b/internal/checker/jsx.go index 476ea09841c..20df4ac3009 100644 --- a/internal/checker/jsx.go +++ b/internal/checker/jsx.go @@ -1107,7 +1107,7 @@ func (c *Checker) getStaticTypeOfReferencedJsxConstructor(context *ast.Node) *Ty if isJsxIntrinsicTagName(context.TagName()) { result := c.getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context) fakeSignature := c.createSignatureForJSXIntrinsic(context, result) - return c.getOrCreateTypeFromSignature(fakeSignature, nil) + return c.getOrCreateTypeFromSignature(fakeSignature) } tagType := c.checkExpressionCached(context.TagName()) if tagType.flags&TypeFlagsStringLiteral != 0 { @@ -1116,7 +1116,7 @@ func (c *Checker) getStaticTypeOfReferencedJsxConstructor(context *ast.Node) *Ty return c.errorType } fakeSignature := c.createSignatureForJSXIntrinsic(context, result) - return c.getOrCreateTypeFromSignature(fakeSignature, nil) + return c.getOrCreateTypeFromSignature(fakeSignature) } return tagType } diff --git a/internal/checker/nodebuilderimpl.go b/internal/checker/nodebuilderimpl.go index 9cad4bb6363..0f09e8cdadf 100644 --- a/internal/checker/nodebuilderimpl.go +++ b/internal/checker/nodebuilderimpl.go @@ -2403,7 +2403,7 @@ func (b *nodeBuilderImpl) createTypeNodeFromObjectType(t *Type) *ast.TypeNode { }) if len(abstractSignatures) > 0 { types := core.Map(abstractSignatures, func(s *Signature) *Type { - return b.ch.getOrCreateTypeFromSignature(s, nil) + return b.ch.getOrCreateTypeFromSignature(s) }) // count the number of type elements excluding abstract constructors typeElementCount := len(callSigs) + (len(ctorSigs) - len(abstractSignatures)) + len(resolved.indexInfos) + (core.IfElse(b.ctx.flags&nodebuilder.FlagsWriteClassExpressionAsTypeLiteral != 0, core.CountWhere(resolved.properties, func(p *ast.Symbol) bool { diff --git a/internal/checker/types.go b/internal/checker/types.go index 0a66c81c2f3..f9b6f642e1e 100644 --- a/internal/checker/types.go +++ b/internal/checker/types.go @@ -574,11 +574,10 @@ func (t *Type) ObjectFlags() ObjectFlags { // Casts for concrete struct types -func (t *Type) AsIntrinsicType() *IntrinsicType { return t.data.(*IntrinsicType) } -func (t *Type) AsLiteralType() *LiteralType { return t.data.(*LiteralType) } -func (t *Type) AsUniqueESSymbolType() *UniqueESSymbolType { return t.data.(*UniqueESSymbolType) } -func (t *Type) AsTupleType() *TupleType { return t.data.(*TupleType) } -func (t *Type) AsSingleSignatureType() *SingleSignatureType { return t.data.(*SingleSignatureType) } +func (t *Type) AsIntrinsicType() *IntrinsicType { return t.data.(*IntrinsicType) } +func (t *Type) AsLiteralType() *LiteralType { return t.data.(*LiteralType) } +func (t *Type) AsUniqueESSymbolType() *UniqueESSymbolType { return t.data.(*UniqueESSymbolType) } +func (t *Type) AsTupleType() *TupleType { return t.data.(*TupleType) } func (t *Type) AsInstantiationExpressionType() *InstantiationExpressionType { return t.data.(*InstantiationExpressionType) } @@ -838,10 +837,6 @@ func (t *StructuredType) Properties() []*ast.Symbol { // ObjectFlagsAnonymous|ObjectFlagsInstantiationExpression: Originating instantiation expression type // ObjectFlagsAnonymous|ObjectFlagsInstantiated|ObjectFlagsInstantiationExpression: Instantiated instantiation expression type -// SingleSignatureType: -// ObjectFlagsAnonymous|ObjectFlagsSingleSignatureType: Originating single signature type -// ObjectFlagsAnonymous|ObjectFlagsInstantiated|ObjectFlagsSingleSignatureType: Instantiated single signature type - // ReverseMappedType: // ObjectFlagsAnonymous|ObjectFlagsReverseMapped: Reverse mapped type @@ -948,13 +943,6 @@ func (t *TupleType) ElementFlags() []ElementFlags { return elementFlags } -// SingleSignatureType - -type SingleSignatureType struct { - ObjectType - outerTypeParameters []*Type -} - // InstantiationExpressionType type InstantiationExpressionType struct { diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 2a1a7a5ac04..db441acbb29 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -76,12 +76,8 @@ func getSelectedModifierFlags(node *ast.Node, flags ast.ModifierFlags) ast.Modif return node.ModifierFlags() & flags } -func HasModifier(node *ast.Node, flags ast.ModifierFlags) bool { - return node.ModifierFlags()&flags != 0 -} - func hasReadonlyModifier(node *ast.Node) bool { - return HasModifier(node, ast.ModifierFlagsReadonly) + return ast.HasModifier(node, ast.ModifierFlagsReadonly) } func isStaticPrivateIdentifierProperty(s *ast.Symbol) bool { @@ -405,7 +401,7 @@ func declarationBelongsToPrivateAmbientMember(declaration *ast.Node) bool { } func isPrivateWithinAmbient(node *ast.Node) bool { - return (HasModifier(node, ast.ModifierFlagsPrivate) || ast.IsPrivateIdentifierClassElementDeclaration(node)) && node.Flags&ast.NodeFlagsAmbient != 0 + return (ast.HasModifier(node, ast.ModifierFlagsPrivate) || ast.IsPrivateIdentifierClassElementDeclaration(node)) && node.Flags&ast.NodeFlagsAmbient != 0 } func isTypeAssertion(node *ast.Node) bool { @@ -911,10 +907,6 @@ func (s *orderedSet[T]) add(value T) { s.values = append(s.values, value) } -func getContainingFunction(node *ast.Node) *ast.Node { - return ast.FindAncestor(node.Parent, ast.IsFunctionLike) -} - func getContainingFunctionOrClassStaticBlock(node *ast.Node) *ast.Node { return ast.FindAncestor(node.Parent, ast.IsFunctionLikeOrClassStaticBlockDeclaration) } diff --git a/internal/collections/ordered_map.go b/internal/collections/ordered_map.go index 6c9d334c0f4..02f0a567814 100644 --- a/internal/collections/ordered_map.go +++ b/internal/collections/ordered_map.go @@ -300,6 +300,11 @@ func DiffOrderedMaps[K comparable, V comparable](m1 *OrderedMap[K, V], m2 *Order } func DiffOrderedMapsFunc[K comparable, V any](m1 *OrderedMap[K, V], m2 *OrderedMap[K, V], equalValues func(a, b V) bool, onAdded func(key K, value V), onRemoved func(key K, value V), onModified func(key K, oldValue V, newValue V)) { + for k, v2 := range m2.Entries() { + if _, ok := m1.Get(k); !ok { + onAdded(k, v2) + } + } for k, v1 := range m1.Entries() { if v2, ok := m2.Get(k); ok { if !equalValues(v1, v2) { @@ -309,10 +314,4 @@ func DiffOrderedMapsFunc[K comparable, V any](m1 *OrderedMap[K, V], m2 *OrderedM onRemoved(k, v1) } } - - for k, v2 := range m2.Entries() { - if _, ok := m1.Get(k); !ok { - onAdded(k, v2) - } - } } diff --git a/internal/compiler/emitter.go b/internal/compiler/emitter.go index c6f6b9b60eb..62f3e162851 100644 --- a/internal/compiler/emitter.go +++ b/internal/compiler/emitter.go @@ -64,6 +64,7 @@ func getModuleTransformer(opts *transformers.TransformOptions) *transformers.Tra core.ModuleKindES2022, core.ModuleKindES2020, core.ModuleKindES2015, + core.ModuleKindNode20, core.ModuleKindNode18, core.ModuleKindNode16, core.ModuleKindNodeNext, diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index f08866f896f..aae6fed1604 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -190,6 +190,8 @@ func (options *CompilerOptions) GetEmitScriptTarget() ScriptTarget { switch options.GetEmitModuleKind() { case ModuleKindNode16, ModuleKindNode18: return ScriptTargetES2022 + case ModuleKindNode20: + return ScriptTargetES2023 case ModuleKindNodeNext: return ScriptTargetESNext default: @@ -212,7 +214,7 @@ func (options *CompilerOptions) GetModuleResolutionKind() ModuleResolutionKind { return options.ModuleResolution } switch options.GetEmitModuleKind() { - case ModuleKindNode16, ModuleKindNode18: + case ModuleKindNode16, ModuleKindNode18, ModuleKindNode20: return ModuleResolutionKindNode16 case ModuleKindNodeNext: return ModuleResolutionKindNodeNext @@ -226,7 +228,7 @@ func (options *CompilerOptions) GetEmitModuleDetectionKind() ModuleDetectionKind return options.ModuleDetection } switch options.GetEmitModuleKind() { - case ModuleKindNode16, ModuleKindNodeNext: + case ModuleKindNode16, ModuleKindNode20, ModuleKindNodeNext: return ModuleDetectionKindForce default: return ModuleDetectionKindAuto @@ -254,7 +256,7 @@ func (options *CompilerOptions) GetESModuleInterop() bool { return options.ESModuleInterop == TSTrue } switch options.GetEmitModuleKind() { - case ModuleKindNode16, ModuleKindNode18, ModuleKindNodeNext, ModuleKindPreserve: + case ModuleKindNode16, ModuleKindNode18, ModuleKindNode20, ModuleKindNodeNext, ModuleKindPreserve: return true } return false @@ -273,6 +275,11 @@ func (options *CompilerOptions) GetResolveJsonModule() bool { if options.ResolveJsonModule != TSUnknown { return options.ResolveJsonModule == TSTrue } + switch options.GetEmitModuleKind() { + // TODO in 6.0: add Node16/Node18 + case ModuleKindNode20, ModuleKindESNext: + return true + } return options.GetModuleResolutionKind() == ModuleResolutionKindBundler } diff --git a/internal/core/core.go b/internal/core/core.go index 3bd84b8075a..f284826edae 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -606,6 +606,11 @@ func DiffMaps[K comparable, V comparable](m1 map[K]V, m2 map[K]V, onAdded func(K } func DiffMapsFunc[K comparable, V any](m1 map[K]V, m2 map[K]V, equalValues func(V, V) bool, onAdded func(K, V), onRemoved func(K, V), onChanged func(K, V, V)) { + for k, v2 := range m2 { + if _, ok := m1[k]; !ok { + onAdded(k, v2) + } + } for k, v1 := range m1 { if v2, ok := m2[k]; ok { if !equalValues(v1, v2) { @@ -615,12 +620,6 @@ func DiffMapsFunc[K comparable, V any](m1 map[K]V, m2 map[K]V, equalValues func( onRemoved(k, v1) } } - - for k, v2 := range m2 { - if _, ok := m1[k]; !ok { - onAdded(k, v2) - } - } } // CopyMapInto is maps.Copy, unless dst is nil, in which case it clones and returns src. diff --git a/internal/jsnum/jsnum.go b/internal/jsnum/jsnum.go index 14d8338a08b..9e54baaf727 100644 --- a/internal/jsnum/jsnum.go +++ b/internal/jsnum/jsnum.go @@ -41,31 +41,33 @@ func isNonFinite(x float64) bool { } // https://tc39.es/ecma262/2024/multipage/abstract-operations.html#sec-touint32 -func (n Number) toUint32() uint32 { +func (x Number) toUint32() uint32 { + // The only difference between ToUint32 and ToInt32 is the interpretation of the bits. + return uint32(x.toInt32()) +} + +// https://tc39.es/ecma262/2024/multipage/abstract-operations.html#sec-toint32 +func (n Number) toInt32() int32 { x := float64(n) - // Fast path: if the number is the range (-2^31, 2^32), i.e. an SMI, + + // Fast path: if the number is in the range (-2^31, 2^32), i.e. an SMI, // then we don't need to do any special mapping. if smi := int32(x); float64(smi) == x { - return uint32(smi) + return smi } - // If the number is non-finite (NaN, +Inf, -Inf; exp=0x7FF), it maps to zero. + // 2. If number is not finite or number is either +0𝔽 or -0𝔽, return +0𝔽. + // Zero was covered by the test above. if isNonFinite(x) { return 0 } - // Otherwise, take x modulo 2^32, mapping positive numbers - // to [0, 2^32) and negative numbers to (-2^32, -0.0]. + // Let int be truncate(ℝ(number)). + x = math.Trunc(x) + // Let int32bit be int modulo 2**32. x = math.Mod(x, 1<<32) - - // Convert to uint32, which will wrap negative numbers. - return uint32(x) -} - -// https://tc39.es/ecma262/2024/multipage/abstract-operations.html#sec-toint32 -func (x Number) toInt32() int32 { - // The only difference between ToUint32 and ToInt32 is the interpretation of the bits. - return int32(x.toUint32()) + // If int32bit ≥ 2**31, return 𝔽(int32bit - 2**32); otherwise return 𝔽(int32bit). + return int32(int64(x)) } func (x Number) toShiftCount() uint32 { diff --git a/internal/jsnum/jsnum_test.go b/internal/jsnum/jsnum_test.go index 6036d0be9d5..53c358204d5 100644 --- a/internal/jsnum/jsnum_test.go +++ b/internal/jsnum/jsnum_test.go @@ -109,18 +109,18 @@ func TestBitwiseNOT(t *testing.T) { t.Parallel() tests := []struct { - input, want Number + got, want Number }{ - {-2147483649, Number(2147483647).BitwiseNOT()}, - {-4294967296, Number(0).BitwiseNOT()}, - {2147483648, Number(-2147483648).BitwiseNOT()}, - {4294967296, Number(0).BitwiseNOT()}, + {Number(-2147483649).BitwiseNOT(), Number(2147483647).BitwiseNOT()}, + {Number(-4294967296).BitwiseNOT(), Number(0).BitwiseNOT()}, + {Number(2147483648).BitwiseNOT(), Number(-2147483648).BitwiseNOT()}, + {Number(4294967296).BitwiseNOT(), Number(0).BitwiseNOT()}, } for _, test := range tests { - t.Run(test.input.String(), func(t *testing.T) { + t.Run(test.got.String(), func(t *testing.T) { t.Parallel() - assertEqualNumber(t, test.input.BitwiseNOT(), test.want) + assertEqualNumber(t, test.got, test.want) }) } } diff --git a/internal/ls/autoimports.go b/internal/ls/autoimports.go index b1bb17660e8..781d7edac6b 100644 --- a/internal/ls/autoimports.go +++ b/internal/ls/autoimports.go @@ -1237,7 +1237,7 @@ func getUmdImportKind(importingFile *ast.SourceFile /* | FutureSourceFile */, pr case core.ModuleKindES2015, core.ModuleKindES2020, core.ModuleKindES2022, core.ModuleKindESNext, core.ModuleKindNone, core.ModuleKindPreserve: // Fall back to the `import * as ns` style import. return ImportKindNamespace - case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNodeNext: + case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNode20, core.ModuleKindNodeNext: if program.GetImpliedNodeFormatForEmit(importingFile) == core.ModuleKindESNext { return ImportKindNamespace } diff --git a/internal/ls/completions.go b/internal/ls/completions.go index 783813f91e2..74d31b48bfb 100644 --- a/internal/ls/completions.go +++ b/internal/ls/completions.go @@ -767,6 +767,7 @@ func (l *LanguageService) getCompletionData( } if firstAccessibleSymbolId != 0 && seenPropertySymbols.AddIfAbsent(firstAccessibleSymbolId) { symbols = append(symbols, firstAccessibleSymbol) + symbolToSortTextMap[firstAccessibleSymbolId] = SortTextGlobalsOrKeywords moduleSymbol := firstAccessibleSymbol.Parent if moduleSymbol == nil || !checker.IsExternalModuleSymbol(moduleSymbol) || diff --git a/internal/ls/documenthighlights.go b/internal/ls/documenthighlights.go index 8469c0935df..f0ed4ce0e03 100644 --- a/internal/ls/documenthighlights.go +++ b/internal/ls/documenthighlights.go @@ -550,14 +550,14 @@ func getLoopBreakContinueOccurrences(node *ast.Node, sourceFile *ast.SourceFile) } func getAsyncAndAwaitOccurrences(node *ast.Node, sourceFile *ast.SourceFile) []*ast.Node { - parent := ast.FindAncestor(node.Parent, ast.IsFunctionLike) - if parent == nil { + fun := ast.GetContainingFunction(node) + if fun == nil { return nil } - parentFunc := parent.AsFunctionDeclaration() + var keywords []*ast.Node - modifiers := parentFunc.Modifiers() + modifiers := fun.Modifiers() if modifiers != nil { for _, modifier := range modifiers.Nodes { if modifier.Kind == ast.KindAsyncKeyword { @@ -566,7 +566,7 @@ func getAsyncAndAwaitOccurrences(node *ast.Node, sourceFile *ast.SourceFile) []* } } - parentFunc.ForEachChild(func(child *ast.Node) bool { + fun.ForEachChild(func(child *ast.Node) bool { traverseWithoutCrossingFunction(child, sourceFile, func(child *ast.Node) { if ast.IsAwaitExpression(child) { token := lsutil.GetFirstToken(child, sourceFile) diff --git a/internal/ls/findallreferences.go b/internal/ls/findallreferences.go index 3845bed6d6a..f97981931fb 100644 --- a/internal/ls/findallreferences.go +++ b/internal/ls/findallreferences.go @@ -349,7 +349,7 @@ func getSymbolScope(symbol *ast.Symbol) *ast.Node { // If this is private property or method, the scope is the containing class if symbol.Flags&(ast.SymbolFlagsProperty|ast.SymbolFlagsMethod) != 0 { privateDeclaration := core.Find(declarations, func(d *ast.Node) bool { - return checker.HasModifier(d, ast.ModifierFlagsPrivate) || ast.IsPrivateIdentifierClassElementDeclaration(d) + return ast.HasModifier(d, ast.ModifierFlagsPrivate) || ast.IsPrivateIdentifierClassElementDeclaration(d) }) if privateDeclaration != nil { return ast.FindAncestorKind(privateDeclaration, ast.KindClassDeclaration) diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 4b2922c4c4a..de34bf41944 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -23,6 +23,7 @@ import ( "github.com/microsoft/typescript-go/internal/project" "github.com/microsoft/typescript-go/internal/project/ata" "github.com/microsoft/typescript-go/internal/project/logging" + "github.com/microsoft/typescript-go/internal/tspath" "github.com/microsoft/typescript-go/internal/vfs" "golang.org/x/sync/errgroup" "golang.org/x/text/language" @@ -651,9 +652,27 @@ func (s *Server) handleInitialized(ctx context.Context, params *lsproto.Initiali s.watchEnabled = true } + cwd := s.cwd + if s.initializeParams.Capabilities != nil && + s.initializeParams.Capabilities.Workspace != nil && + s.initializeParams.Capabilities.Workspace.WorkspaceFolders != nil && + ptrIsTrue(s.initializeParams.Capabilities.Workspace.WorkspaceFolders) && + s.initializeParams.WorkspaceFolders != nil && + s.initializeParams.WorkspaceFolders.WorkspaceFolders != nil && + len(*s.initializeParams.WorkspaceFolders.WorkspaceFolders) == 1 { + cwd = lsproto.DocumentUri((*s.initializeParams.WorkspaceFolders.WorkspaceFolders)[0].Uri).FileName() + } else if s.initializeParams.RootUri.DocumentUri != nil { + cwd = s.initializeParams.RootUri.DocumentUri.FileName() + } else if s.initializeParams.RootPath != nil && s.initializeParams.RootPath.String != nil { + cwd = *s.initializeParams.RootPath.String + } + if !tspath.PathIsAbsolute(cwd) { + cwd = s.cwd + } + s.session = project.NewSession(&project.SessionInit{ Options: &project.SessionOptions{ - CurrentDirectory: s.cwd, + CurrentDirectory: cwd, DefaultLibraryPath: s.defaultLibraryPath, TypingsLocation: s.typingsLocation, PositionEncoding: s.positionEncoding, diff --git a/internal/module/resolver.go b/internal/module/resolver.go index ac383748511..29bbef86af1 100644 --- a/internal/module/resolver.go +++ b/internal/module/resolver.go @@ -1747,7 +1747,11 @@ func (r *resolutionState) readPackageJsonPeerDependencies(packageJsonInfo *packa r.tracer.write(diagnostics.X_package_json_has_a_peerDependencies_field.Message()) } packageDirectory := r.realPath(packageJsonInfo.PackageDirectory) - nodeModules := packageDirectory[:strings.LastIndex(packageDirectory, "/node_modules")+len("/node_modules")] + "/" + nodeModulesIndex := strings.LastIndex(packageDirectory, "/node_modules") + if nodeModulesIndex == -1 { + return "" + } + nodeModules := packageDirectory[:nodeModulesIndex+len("/node_modules")] + "/" builder := strings.Builder{} for name := range peerDependencies.Value { peerPackageJson := r.getPackageJsonInfo(nodeModules+name /*onlyRecordFailures*/, false) diff --git a/internal/parser/parser.go b/internal/parser/parser.go index ef87829bb67..a51566f02d1 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -296,7 +296,7 @@ func (p *Parser) lookAhead(callback func(p *Parser) bool) bool { func (p *Parser) nextToken() ast.Kind { // if the keyword had an escape - if isKeyword(p.token) && (p.scanner.HasUnicodeEscape() || p.scanner.HasExtendedUnicodeEscape()) { + if ast.IsKeyword(p.token) && (p.scanner.HasUnicodeEscape() || p.scanner.HasExtendedUnicodeEscape()) { // issue a parse error for the escape p.parseErrorAtCurrentToken(diagnostics.Keywords_cannot_contain_escape_characters) } @@ -644,7 +644,7 @@ func (p *Parser) parsingContextErrors(context ParsingContext) { case PCHeritageClauseElement: p.parseErrorAtCurrentToken(diagnostics.Expression_expected) case PCVariableDeclarations: - if isKeyword(p.token) { + if ast.IsKeyword(p.token) { p.parseErrorAtCurrentToken(diagnostics.X_0_is_not_allowed_as_a_variable_declaration_name, scanner.TokenToString(p.token)) } else { p.parseErrorAtCurrentToken(diagnostics.Variable_declaration_expected) @@ -662,7 +662,7 @@ func (p *Parser) parsingContextErrors(context ParsingContext) { case PCJSDocParameters: p.parseErrorAtCurrentToken(diagnostics.Parameter_declaration_expected) case PCParameters: - if isKeyword(p.token) { + if ast.IsKeyword(p.token) { p.parseErrorAtCurrentToken(diagnostics.X_0_is_not_allowed_as_a_parameter_name, scanner.TokenToString(p.token)) } else { p.parseErrorAtCurrentToken(diagnostics.Parameter_declaration_expected) @@ -2352,7 +2352,7 @@ func (p *Parser) parseModuleExportName(disallowKeywords bool) (node *ast.Node, n if p.token == ast.KindStringLiteral { return p.parseLiteralExpression(false /*intern*/), nameOk } - if disallowKeywords && isKeyword(p.token) && !p.isIdentifier() { + if disallowKeywords && ast.IsKeyword(p.token) && !p.isIdentifier() { nameOk = false } return p.parseIdentifierName(), nameOk @@ -5835,7 +5835,7 @@ func (p *Parser) scanClassMemberStart() bool { // If we were able to get any potential identifier... if idToken != ast.KindUnknown { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if !isKeyword(idToken) || idToken == ast.KindSetKeyword || idToken == ast.KindGetKeyword { + if !ast.IsKeyword(idToken) || idToken == ast.KindSetKeyword || idToken == ast.KindGetKeyword { return true } // If it *is* a keyword, but not an accessor, check a little farther along @@ -6235,10 +6235,6 @@ func (p *Parser) skipRangeTrivia(textRange core.TextRange) core.TextRange { return core.NewTextRange(scanner.SkipTrivia(p.sourceText, textRange.Pos()), textRange.End()) } -func isKeyword(token ast.Kind) bool { - return ast.KindFirstKeyword <= token && token <= ast.KindLastKeyword -} - func isReservedWord(token ast.Kind) bool { return ast.KindFirstReservedWord <= token && token <= ast.KindLastReservedWord } diff --git a/internal/project/configfileregistry.go b/internal/project/configfileregistry.go index bae60b66c92..801d249be71 100644 --- a/internal/project/configfileregistry.go +++ b/internal/project/configfileregistry.go @@ -41,7 +41,7 @@ type configFileEntry struct { // when this is set, no other fields will be used. retainingConfigs map[tspath.Path]struct{} // rootFilesWatch is a watch for the root files of this config file. - rootFilesWatch *WatchedFiles[[]string] + rootFilesWatch *WatchedFiles[patternsAndIgnored] } func newConfigFileEntry(fileName string) *configFileEntry { diff --git a/internal/project/configfileregistrybuilder.go b/internal/project/configfileregistrybuilder.go index 725bc343a84..a4b5a7ff6d9 100644 --- a/internal/project/configfileregistrybuilder.go +++ b/internal/project/configfileregistrybuilder.go @@ -165,21 +165,61 @@ func (c *configFileRegistryBuilder) updateRootFilesWatch(fileName string, entry return } - wildcardGlobs := entry.commandLine.WildcardDirectories() - rootFileGlobs := make([]string, 0, len(wildcardGlobs)+1+len(entry.commandLine.ExtendedSourceFiles())) - rootFileGlobs = append(rootFileGlobs, fileName) - for _, extendedConfig := range entry.commandLine.ExtendedSourceFiles() { - rootFileGlobs = append(rootFileGlobs, extendedConfig) + var ignored map[string]struct{} + var globs []string + var externalDirectories []string + var includeWorkspace bool + var includeTsconfigDir bool + tsconfigDir := tspath.GetDirectoryPath(fileName) + wildcardDirectories := entry.commandLine.WildcardDirectories() + comparePathsOptions := tspath.ComparePathsOptions{ + CurrentDirectory: c.sessionOptions.CurrentDirectory, + UseCaseSensitiveFileNames: c.FS().UseCaseSensitiveFileNames(), } - for dir, recursive := range wildcardGlobs { - rootFileGlobs = append(rootFileGlobs, fmt.Sprintf("%s/%s", tspath.NormalizePath(dir), core.IfElse(recursive, recursiveFileGlobPattern, fileGlobPattern))) + for dir := range wildcardDirectories { + if tspath.ContainsPath(c.sessionOptions.CurrentDirectory, dir, comparePathsOptions) { + includeWorkspace = true + } else if tspath.ContainsPath(tsconfigDir, dir, comparePathsOptions) { + includeTsconfigDir = true + } else { + externalDirectories = append(externalDirectories, dir) + } } for _, fileName := range entry.commandLine.LiteralFileNames() { - rootFileGlobs = append(rootFileGlobs, fileName) + if tspath.ContainsPath(c.sessionOptions.CurrentDirectory, fileName, comparePathsOptions) { + includeWorkspace = true + } else if tspath.ContainsPath(tsconfigDir, fileName, comparePathsOptions) { + includeTsconfigDir = true + } else { + externalDirectories = append(externalDirectories, tspath.GetDirectoryPath(fileName)) + } } - slices.Sort(rootFileGlobs) - entry.rootFilesWatch = entry.rootFilesWatch.Clone(rootFileGlobs) + if includeWorkspace { + globs = append(globs, getRecursiveGlobPattern(c.sessionOptions.CurrentDirectory)) + } + if includeTsconfigDir { + globs = append(globs, getRecursiveGlobPattern(tsconfigDir)) + } + for _, fileName := range entry.commandLine.ExtendedSourceFiles() { + if includeWorkspace && tspath.ContainsPath(c.sessionOptions.CurrentDirectory, fileName, comparePathsOptions) { + continue + } + globs = append(globs, fileName) + } + if len(externalDirectories) > 0 { + commonParents, ignoredExternalDirs := tspath.GetCommonParents(externalDirectories, minWatchLocationDepth, getPathComponentsForWatching, comparePathsOptions) + for _, parent := range commonParents { + globs = append(globs, getRecursiveGlobPattern(parent)) + } + ignored = ignoredExternalDirs + } + + slices.Sort(globs) + entry.rootFilesWatch = entry.rootFilesWatch.Clone(patternsAndIgnored{ + patterns: globs, + ignored: ignored, + }) } // acquireConfigForProject loads a config file entry from the cache, or parses it if not already @@ -347,11 +387,8 @@ func (c *configFileRegistryBuilder) DidChangeFiles(summary FileChangeSummary, lo } logger.Logf("Checking if any of %d created files match root files for config %s", len(createdFiles), entry.Key()) for _, fileName := range createdFiles { - parsedGlobs := config.rootFilesWatch.ParsedGlobs() - for _, g := range parsedGlobs { - if g.Match(fileName) { - return true - } + if config.commandLine.PossiblyMatchesFileName(fileName) { + return true } } return false diff --git a/internal/project/project.go b/internal/project/project.go index 14c72987955..ed734b7e7fa 100644 --- a/internal/project/project.go +++ b/internal/project/project.go @@ -69,10 +69,10 @@ type Project struct { // The ID of the snapshot that created the program stored in this project. ProgramLastUpdate uint64 + programFilesWatch *WatchedFiles[patternsAndIgnored] failedLookupsWatch *WatchedFiles[map[tspath.Path]string] affectingLocationsWatch *WatchedFiles[map[tspath.Path]string] - typingsFilesWatch *WatchedFiles[map[tspath.Path]string] - typingsDirectoryWatch *WatchedFiles[map[tspath.Path]string] + typingsWatch *WatchedFiles[patternsAndIgnored] checkerPool *checkerPool @@ -146,26 +146,26 @@ func NewProject( project.configFilePath = tspath.ToPath(configFileName, currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames()) if builder.sessionOptions.WatchEnabled { + project.programFilesWatch = NewWatchedFiles( + "non-root program files for "+configFileName, + lsproto.WatchKindCreate|lsproto.WatchKindChange|lsproto.WatchKindDelete, + core.Identity, + ) project.failedLookupsWatch = NewWatchedFiles( "failed lookups for "+configFileName, lsproto.WatchKindCreate, - createResolutionLookupGlobMapper(project.currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames()), + createResolutionLookupGlobMapper(builder.sessionOptions.CurrentDirectory, builder.sessionOptions.DefaultLibraryPath, project.currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames()), ) project.affectingLocationsWatch = NewWatchedFiles( "affecting locations for "+configFileName, lsproto.WatchKindCreate|lsproto.WatchKindChange|lsproto.WatchKindDelete, - createResolutionLookupGlobMapper(project.currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames()), + createResolutionLookupGlobMapper(builder.sessionOptions.CurrentDirectory, builder.sessionOptions.DefaultLibraryPath, project.currentDirectory, builder.fs.fs.UseCaseSensitiveFileNames()), ) if builder.sessionOptions.TypingsLocation != "" { - project.typingsFilesWatch = NewWatchedFiles( + project.typingsWatch = NewWatchedFiles( "typings installer files", lsproto.WatchKindCreate|lsproto.WatchKindChange|lsproto.WatchKindDelete, - globMapperForTypingsInstaller, - ) - project.typingsDirectoryWatch = NewWatchedFiles( - "typings installer directories", - lsproto.WatchKindCreate|lsproto.WatchKindDelete, - globMapperForTypingsInstaller, + core.Identity, ) } } @@ -221,10 +221,10 @@ func (p *Project) Clone() *Project { ProgramUpdateKind: ProgramUpdateKindNone, ProgramLastUpdate: p.ProgramLastUpdate, + programFilesWatch: p.programFilesWatch, failedLookupsWatch: p.failedLookupsWatch, affectingLocationsWatch: p.affectingLocationsWatch, - typingsFilesWatch: p.typingsFilesWatch, - typingsDirectoryWatch: p.typingsDirectoryWatch, + typingsWatch: p.typingsWatch, checkerPool: p.checkerPool, @@ -327,14 +327,19 @@ func (p *Project) CreateProgram() CreateProgramResult { } } -func (p *Project) CloneWatchers() (failedLookupsWatch *WatchedFiles[map[tspath.Path]string], affectingLocationsWatch *WatchedFiles[map[tspath.Path]string]) { +func (p *Project) CloneWatchers(workspaceDir string, libDir string) (programFilesWatch *WatchedFiles[patternsAndIgnored], failedLookupsWatch *WatchedFiles[map[tspath.Path]string], affectingLocationsWatch *WatchedFiles[map[tspath.Path]string]) { failedLookups := make(map[tspath.Path]string) affectingLocations := make(map[tspath.Path]string) + programFiles := getNonRootFileGlobs(workspaceDir, libDir, p.Program.GetSourceFiles(), p.CommandLine.FileNamesByPath(), tspath.ComparePathsOptions{ + UseCaseSensitiveFileNames: p.host.FS().UseCaseSensitiveFileNames(), + CurrentDirectory: p.currentDirectory, + }) extractLookups(p.toPath, failedLookups, affectingLocations, p.Program.GetResolvedModules()) extractLookups(p.toPath, failedLookups, affectingLocations, p.Program.GetResolvedTypeReferenceDirectives()) + programFilesWatch = p.programFilesWatch.Clone(programFiles) failedLookupsWatch = p.failedLookupsWatch.Clone(failedLookups) affectingLocationsWatch = p.affectingLocationsWatch.Clone(affectingLocations) - return failedLookupsWatch, affectingLocationsWatch + return programFilesWatch, failedLookupsWatch, affectingLocationsWatch } func (p *Project) log(msg string) { diff --git a/internal/project/projectcollectionbuilder.go b/internal/project/projectcollectionbuilder.go index a979415e03c..a5338b3fe34 100644 --- a/internal/project/projectcollectionbuilder.go +++ b/internal/project/projectcollectionbuilder.go @@ -347,14 +347,14 @@ func (b *ProjectCollectionBuilder) DidUpdateATAState(ataChanges map[tspath.Path] // the set of typings files is actually different. p.installedTypingsInfo = ataChange.TypingsInfo p.typingsFiles = ataChange.TypingsFiles - fileWatchGlobs, directoryWatchGlobs := getTypingsLocationsGlobs( + typingsWatchGlobs := getTypingsLocationsGlobs( ataChange.TypingsFilesToWatch, b.sessionOptions.TypingsLocation, + b.sessionOptions.CurrentDirectory, p.currentDirectory, b.fs.fs.UseCaseSensitiveFileNames(), ) - p.typingsFilesWatch = p.typingsFilesWatch.Clone(fileWatchGlobs) - p.typingsDirectoryWatch = p.typingsDirectoryWatch.Clone(directoryWatchGlobs) + p.typingsWatch = p.typingsWatch.Clone(typingsWatchGlobs) p.dirty = true p.dirtyFilePath = "" }, @@ -539,7 +539,7 @@ func (b *ProjectCollectionBuilder) findOrCreateDefaultConfiguredProjectWorker( // For composite projects, we can get an early negative result. // !!! what about declaration files in node_modules? wouldn't it be better to // check project inclusion if the project is already loaded? - if !config.MatchesFileName(fileName) { + if _, ok := config.FileNamesByPath()[path]; !ok { node.logger.Log("Project does not contain file (by composite config inclusion)") return false, false } @@ -797,7 +797,8 @@ func (b *ProjectCollectionBuilder) updateProgram(entry dirty.Value[*Project], lo if result.UpdateKind == ProgramUpdateKindNewFiles { filesChanged = true if b.sessionOptions.WatchEnabled { - failedLookupsWatch, affectingLocationsWatch := project.CloneWatchers() + programFilesWatch, failedLookupsWatch, affectingLocationsWatch := project.CloneWatchers(b.sessionOptions.CurrentDirectory, b.sessionOptions.DefaultLibraryPath) + project.programFilesWatch = programFilesWatch project.failedLookupsWatch = failedLookupsWatch project.affectingLocationsWatch = affectingLocationsWatch } diff --git a/internal/project/projectlifetime_test.go b/internal/project/projectlifetime_test.go index 0e824f2d96b..5c7b8c41948 100644 --- a/internal/project/projectlifetime_test.go +++ b/internal/project/projectlifetime_test.go @@ -70,7 +70,7 @@ func TestProjectLifetime(t *testing.T) { assert.Equal(t, len(snapshot.ProjectCollection.Projects()), 2) assert.Assert(t, snapshot.ProjectCollection.ConfiguredProject(tspath.Path("/home/projects/ts/p1/tsconfig.json")) != nil) assert.Assert(t, snapshot.ProjectCollection.ConfiguredProject(tspath.Path("/home/projects/ts/p2/tsconfig.json")) != nil) - assert.Equal(t, len(utils.Client().WatchFilesCalls()), 2) + assert.Equal(t, len(utils.Client().WatchFilesCalls()), 1) assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p1/tsconfig.json")) != nil) assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p2/tsconfig.json")) != nil) @@ -89,8 +89,8 @@ func TestProjectLifetime(t *testing.T) { assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p1/tsconfig.json")) == nil) assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p2/tsconfig.json")) != nil) assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p3/tsconfig.json")) != nil) - assert.Equal(t, len(utils.Client().WatchFilesCalls()), 3) - assert.Equal(t, len(utils.Client().UnwatchFilesCalls()), 1) + assert.Equal(t, len(utils.Client().WatchFilesCalls()), 1) + assert.Equal(t, len(utils.Client().UnwatchFilesCalls()), 0) // Close p2 and p3 files, open p1 file again session.DidCloseFile(context.Background(), uri2) @@ -105,8 +105,8 @@ func TestProjectLifetime(t *testing.T) { assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p1/tsconfig.json")) != nil) assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p2/tsconfig.json")) == nil) assert.Assert(t, snapshot.ConfigFileRegistry.GetConfig(tspath.Path("/home/projects/ts/p3/tsconfig.json")) == nil) - assert.Equal(t, len(utils.Client().WatchFilesCalls()), 4) - assert.Equal(t, len(utils.Client().UnwatchFilesCalls()), 3) + assert.Equal(t, len(utils.Client().WatchFilesCalls()), 1) + assert.Equal(t, len(utils.Client().UnwatchFilesCalls()), 0) }) t.Run("unrooted inferred projects", func(t *testing.T) { diff --git a/internal/project/session.go b/internal/project/session.go index 025526ac97c..bcd01ddf90e 100644 --- a/internal/project/session.go +++ b/internal/project/session.go @@ -111,6 +111,11 @@ type Session struct { diagnosticsRefreshMu sync.Mutex makeHost func(currentDirectory string, project *Project, builder *ProjectCollectionBuilder, logger *logging.LogTree) ProjectHost + + // watches tracks the current watch globs and how many individual WatchedFiles + // are using each glob. + watches map[fileSystemWatcherKey]*fileSystemWatcherValue + watchesMu sync.Mutex } func NewSession(init *SessionInit) *Session { @@ -153,6 +158,7 @@ func NewSession(init *SessionInit) *Session { ), pendingATAChanges: make(map[tspath.Path]*ATAStateChange), makeHost: init.Options.MakeHost, + watches: make(map[fileSystemWatcherKey]*fileSystemWatcherValue), } if init.Options.TypingsLocation != "" && init.NpmExecutor != nil { @@ -414,33 +420,71 @@ func (s *Session) WaitForBackgroundTasks() { s.backgroundQueue.Wait() } -func updateWatch[T any](ctx context.Context, client Client, logger logging.Logger, oldWatcher, newWatcher *WatchedFiles[T]) []error { +func updateWatch[T any](ctx context.Context, session *Session, logger logging.Logger, oldWatcher, newWatcher *WatchedFiles[T]) []error { var errors []error + session.watchesMu.Lock() + defer session.watchesMu.Unlock() if newWatcher != nil { - if id, watchers := newWatcher.Watchers(); len(watchers) > 0 { - if err := client.WatchFiles(ctx, id, watchers); err != nil { - errors = append(errors, err) - } - if logger != nil { - if oldWatcher == nil { - logger.Log(fmt.Sprintf("Added new watch: %s", id)) - } else { - logger.Log(fmt.Sprintf("Updated watch: %s", id)) + if id, watchers, ignored := newWatcher.Watchers(); len(watchers) > 0 { + var newWatchers collections.OrderedMap[WatcherID, *lsproto.FileSystemWatcher] + for i, watcher := range watchers { + key := toFileSystemWatcherKey(watcher) + value := session.watches[key] + globId := WatcherID(fmt.Sprintf("%s.%d", id, i)) + if value == nil { + value = &fileSystemWatcherValue{id: globId} + session.watches[key] = value + } + value.count++ + if value.count == 1 { + newWatchers.Set(globId, watcher) } - for _, watcher := range watchers { + } + for id, watcher := range newWatchers.Entries() { + if err := session.client.WatchFiles(ctx, id, []*lsproto.FileSystemWatcher{watcher}); err != nil { + errors = append(errors, err) + } else if logger != nil { + if oldWatcher == nil { + logger.Log(fmt.Sprintf("Added new watch: %s", id)) + } else { + logger.Log(fmt.Sprintf("Updated watch: %s", id)) + } logger.Log("\t" + *watcher.GlobPattern.Pattern) + logger.Log("") + } + } + if len(ignored) > 0 { + logger.Logf("%d paths ineligible for watching", len(ignored)) + if logger.IsVerbose() { + for path := range ignored { + logger.Log("\t" + path) + } } - logger.Log("") } } } if oldWatcher != nil { - if id, watchers := oldWatcher.Watchers(); len(watchers) > 0 { - if err := client.UnwatchFiles(ctx, id); err != nil { - errors = append(errors, err) + if _, watchers, _ := oldWatcher.Watchers(); len(watchers) > 0 { + var removedWatchers []WatcherID + for _, watcher := range watchers { + key := toFileSystemWatcherKey(watcher) + value := session.watches[key] + if value == nil { + continue + } + if value.count <= 1 { + delete(session.watches, key) + removedWatchers = append(removedWatchers, value.id) + } else { + value.count-- + } } - if logger != nil && newWatcher == nil { - logger.Log(fmt.Sprintf("Removed watch: %s", id)) + for _, id := range removedWatchers { + if err := session.client.UnwatchFiles(ctx, id); err != nil { + errors = append(errors, err) + } else if logger != nil && newWatcher == nil { + logger.Log(fmt.Sprintf("Removed watch: %s", id)) + } } } } @@ -449,6 +493,7 @@ func updateWatch[T any](ctx context.Context, client Client, logger logging.Logge func (s *Session) updateWatches(oldSnapshot *Snapshot, newSnapshot *Snapshot) error { var errors []error + start := time.Now() ctx := context.Background() core.DiffMapsFunc( oldSnapshot.ConfigFileRegistry.configs, @@ -457,13 +502,13 @@ func (s *Session) updateWatches(oldSnapshot *Snapshot, newSnapshot *Snapshot) er return a.rootFilesWatch.ID() == b.rootFilesWatch.ID() }, func(_ tspath.Path, addedEntry *configFileEntry) { - errors = append(errors, updateWatch(ctx, s.client, s.logger, nil, addedEntry.rootFilesWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, nil, addedEntry.rootFilesWatch)...) }, func(_ tspath.Path, removedEntry *configFileEntry) { - errors = append(errors, updateWatch(ctx, s.client, s.logger, removedEntry.rootFilesWatch, nil)...) + errors = append(errors, updateWatch(ctx, s, s.logger, removedEntry.rootFilesWatch, nil)...) }, func(_ tspath.Path, oldEntry, newEntry *configFileEntry) { - errors = append(errors, updateWatch(ctx, s.client, s.logger, oldEntry.rootFilesWatch, newEntry.rootFilesWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, oldEntry.rootFilesWatch, newEntry.rootFilesWatch)...) }, ) @@ -471,35 +516,37 @@ func (s *Session) updateWatches(oldSnapshot *Snapshot, newSnapshot *Snapshot) er oldSnapshot.ProjectCollection.ProjectsByPath(), newSnapshot.ProjectCollection.ProjectsByPath(), func(_ tspath.Path, addedProject *Project) { - errors = append(errors, updateWatch(ctx, s.client, s.logger, nil, addedProject.affectingLocationsWatch)...) - errors = append(errors, updateWatch(ctx, s.client, s.logger, nil, addedProject.failedLookupsWatch)...) - errors = append(errors, updateWatch(ctx, s.client, s.logger, nil, addedProject.typingsFilesWatch)...) - errors = append(errors, updateWatch(ctx, s.client, s.logger, nil, addedProject.typingsDirectoryWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, nil, addedProject.programFilesWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, nil, addedProject.affectingLocationsWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, nil, addedProject.failedLookupsWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, nil, addedProject.typingsWatch)...) }, func(_ tspath.Path, removedProject *Project) { - errors = append(errors, updateWatch(ctx, s.client, s.logger, removedProject.affectingLocationsWatch, nil)...) - errors = append(errors, updateWatch(ctx, s.client, s.logger, removedProject.failedLookupsWatch, nil)...) - errors = append(errors, updateWatch(ctx, s.client, s.logger, removedProject.typingsFilesWatch, nil)...) - errors = append(errors, updateWatch(ctx, s.client, s.logger, removedProject.typingsDirectoryWatch, nil)...) + errors = append(errors, updateWatch(ctx, s, s.logger, removedProject.programFilesWatch, nil)...) + errors = append(errors, updateWatch(ctx, s, s.logger, removedProject.affectingLocationsWatch, nil)...) + errors = append(errors, updateWatch(ctx, s, s.logger, removedProject.failedLookupsWatch, nil)...) + errors = append(errors, updateWatch(ctx, s, s.logger, removedProject.typingsWatch, nil)...) }, func(_ tspath.Path, oldProject, newProject *Project) { + if oldProject.programFilesWatch.ID() != newProject.programFilesWatch.ID() { + errors = append(errors, updateWatch(ctx, s, s.logger, oldProject.programFilesWatch, newProject.programFilesWatch)...) + } if oldProject.affectingLocationsWatch.ID() != newProject.affectingLocationsWatch.ID() { - errors = append(errors, updateWatch(ctx, s.client, s.logger, oldProject.affectingLocationsWatch, newProject.affectingLocationsWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, oldProject.affectingLocationsWatch, newProject.affectingLocationsWatch)...) } if oldProject.failedLookupsWatch.ID() != newProject.failedLookupsWatch.ID() { - errors = append(errors, updateWatch(ctx, s.client, s.logger, oldProject.failedLookupsWatch, newProject.failedLookupsWatch)...) - } - if oldProject.typingsFilesWatch.ID() != newProject.typingsFilesWatch.ID() { - errors = append(errors, updateWatch(ctx, s.client, s.logger, oldProject.typingsFilesWatch, newProject.typingsFilesWatch)...) + errors = append(errors, updateWatch(ctx, s, s.logger, oldProject.failedLookupsWatch, newProject.failedLookupsWatch)...) } - if oldProject.typingsDirectoryWatch.ID() != newProject.typingsDirectoryWatch.ID() { - errors = append(errors, updateWatch(ctx, s.client, s.logger, oldProject.typingsDirectoryWatch, newProject.typingsDirectoryWatch)...) + if oldProject.typingsWatch.ID() != newProject.typingsWatch.ID() { + errors = append(errors, updateWatch(ctx, s, s.logger, oldProject.typingsWatch, newProject.typingsWatch)...) } }, ) if len(errors) > 0 { return fmt.Errorf("errors updating watches: %v", errors) + } else if s.options.LoggingEnabled { + s.logger.Log(fmt.Sprintf("Updated watches in %v", time.Since(start))) } return nil } diff --git a/internal/project/session_test.go b/internal/project/session_test.go index 9da57316bd9..164f7eea68d 100644 --- a/internal/project/session_test.go +++ b/internal/project/session_test.go @@ -3,10 +3,14 @@ package project_test import ( "context" "maps" + "strings" "testing" "github.com/microsoft/typescript-go/internal/bundled" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/glob" "github.com/microsoft/typescript-go/internal/lsp/lsproto" + "github.com/microsoft/typescript-go/internal/project" "github.com/microsoft/typescript-go/internal/testutil/projecttestutil" "github.com/microsoft/typescript-go/internal/tspath" "gotest.tools/v3/assert" @@ -548,6 +552,67 @@ func TestSession(t *testing.T) { assert.Check(t, lsAfter.GetProgram() != programBefore) }) + t.Run("change program file not in tsconfig root files", func(t *testing.T) { + t.Parallel() + for _, workspaceDir := range []string{"/", "/home/projects/TS/p1", "/somewhere/else/entirely"} { + t.Run("workspaceDir="+strings.ReplaceAll(workspaceDir, "/", "_"), func(t *testing.T) { + t.Parallel() + files := map[string]any{ + "/home/projects/TS/p1/tsconfig.json": `{ + "compilerOptions": { + "noLib": true, + "module": "nodenext", + "strict": true + }, + "files": ["src/index.ts"] + }`, + "/home/projects/TS/p1/src/index.ts": `import { x } from "../../x";`, + "/home/projects/TS/x.ts": `export const x = 1;`, + } + + session, utils := projecttestutil.SetupWithOptions(files, &project.SessionOptions{ + CurrentDirectory: workspaceDir, + DefaultLibraryPath: bundled.LibPath(), + TypingsLocation: projecttestutil.TestTypingsLocation, + PositionEncoding: lsproto.PositionEncodingKindUTF8, + WatchEnabled: true, + LoggingEnabled: true, + }) + session.DidOpenFile(context.Background(), "file:///home/projects/TS/p1/src/index.ts", 1, files["/home/projects/TS/p1/src/index.ts"].(string), lsproto.LanguageKindTypeScript) + lsBefore, err := session.GetLanguageService(context.Background(), "file:///home/projects/TS/p1/src/index.ts") + assert.NilError(t, err) + programBefore := lsBefore.GetProgram() + session.WaitForBackgroundTasks() + + var xWatched bool + outer: + for _, call := range utils.Client().WatchFilesCalls() { + for _, watcher := range call.Watchers { + if core.Must(glob.Parse(*watcher.GlobPattern.Pattern)).Match("/home/projects/TS/x.ts") { + xWatched = true + break outer + } + } + } + assert.Check(t, xWatched) + + err = utils.FS().WriteFile("/home/projects/TS/x.ts", `export const x = 2;`, false) + assert.NilError(t, err) + + session.DidChangeWatchedFiles(context.Background(), []*lsproto.FileEvent{ + { + Type: lsproto.FileChangeTypeChanged, + Uri: "file:///home/projects/TS/x.ts", + }, + }) + + lsAfter, err := session.GetLanguageService(context.Background(), "file:///home/projects/TS/p1/src/index.ts") + assert.NilError(t, err) + assert.Check(t, lsAfter.GetProgram() != programBefore) + }) + } + }) + t.Run("change config file", func(t *testing.T) { t.Parallel() files := map[string]any{ diff --git a/internal/project/watch.go b/internal/project/watch.go index 7d36ad9a43e..2354040e3e2 100644 --- a/internal/project/watch.go +++ b/internal/project/watch.go @@ -8,19 +8,44 @@ import ( "sync" "sync/atomic" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" - "github.com/microsoft/typescript-go/internal/glob" "github.com/microsoft/typescript-go/internal/lsp/lsproto" "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/tspath" ) const ( - fileGlobPattern = "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json}" - recursiveFileGlobPattern = "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json}" + minWatchLocationDepth = 2 ) +type fileSystemWatcherKey struct { + pattern string + kind lsproto.WatchKind +} + +type fileSystemWatcherValue struct { + count int + id WatcherID +} + +type patternsAndIgnored struct { + patterns []string + ignored map[string]struct{} +} + +func toFileSystemWatcherKey(w *lsproto.FileSystemWatcher) fileSystemWatcherKey { + if w.GlobPattern.RelativePattern != nil { + panic("relative globs not implemented") + } + kind := w.Kind + if kind == nil { + kind = ptrTo(lsproto.WatchKindCreate | lsproto.WatchKindChange | lsproto.WatchKindDelete) + } + return fileSystemWatcherKey{pattern: *w.GlobPattern.Pattern, kind: *kind} +} + type WatcherID string var watcherID atomic.Uint64 @@ -28,17 +53,17 @@ var watcherID atomic.Uint64 type WatchedFiles[T any] struct { name string watchKind lsproto.WatchKind - computeGlobPatterns func(input T) []string - - input T - computeWatchersOnce sync.Once - watchers []*lsproto.FileSystemWatcher - computeParsedGlobsOnce sync.Once - parsedGlobs []*glob.Glob - id uint64 + computeGlobPatterns func(input T) patternsAndIgnored + + mu sync.RWMutex + input T + computeWatchersOnce sync.Once + watchers []*lsproto.FileSystemWatcher + ignored map[string]struct{} + id uint64 } -func NewWatchedFiles[T any](name string, watchKind lsproto.WatchKind, computeGlobPatterns func(input T) []string) *WatchedFiles[T] { +func NewWatchedFiles[T any](name string, watchKind lsproto.WatchKind, computeGlobPatterns func(input T) patternsAndIgnored) *WatchedFiles[T] { return &WatchedFiles[T]{ id: watcherID.Add(1), name: name, @@ -47,31 +72,40 @@ func NewWatchedFiles[T any](name string, watchKind lsproto.WatchKind, computeGlo } } -func (w *WatchedFiles[T]) Watchers() (WatcherID, []*lsproto.FileSystemWatcher) { +func (w *WatchedFiles[T]) Watchers() (WatcherID, []*lsproto.FileSystemWatcher, map[string]struct{}) { w.computeWatchersOnce.Do(func() { - newWatchers := core.Map(w.computeGlobPatterns(w.input), func(glob string) *lsproto.FileSystemWatcher { - return &lsproto.FileSystemWatcher{ - GlobPattern: lsproto.PatternOrRelativePattern{ - Pattern: &glob, - }, - Kind: &w.watchKind, - } - }) - if !slices.EqualFunc(w.watchers, newWatchers, func(a, b *lsproto.FileSystemWatcher) bool { - return *a.GlobPattern.Pattern == *b.GlobPattern.Pattern + w.mu.Lock() + defer w.mu.Unlock() + result := w.computeGlobPatterns(w.input) + globs := result.patterns + ignored := result.ignored + // ignored is only used for logging and doesn't affect watcher identity + w.ignored = ignored + if !slices.EqualFunc(w.watchers, globs, func(a *lsproto.FileSystemWatcher, b string) bool { + return *a.GlobPattern.Pattern == b }) { - w.watchers = newWatchers + w.watchers = core.Map(globs, func(glob string) *lsproto.FileSystemWatcher { + return &lsproto.FileSystemWatcher{ + GlobPattern: lsproto.PatternOrRelativePattern{ + Pattern: &glob, + }, + Kind: &w.watchKind, + } + }) w.id = watcherID.Add(1) } }) - return WatcherID(fmt.Sprintf("%s watcher %d", w.name, w.id)), w.watchers + + w.mu.RLock() + defer w.mu.RUnlock() + return WatcherID(fmt.Sprintf("%s watcher %d", w.name, w.id)), w.watchers, w.ignored } func (w *WatchedFiles[T]) ID() WatcherID { if w == nil { return "" } - id, _ := w.Watchers() + id, _, _ := w.Watchers() return id } @@ -83,44 +117,29 @@ func (w *WatchedFiles[T]) WatchKind() lsproto.WatchKind { return w.watchKind } -func (w *WatchedFiles[T]) ParsedGlobs() []*glob.Glob { - w.computeParsedGlobsOnce.Do(func() { - patterns := w.computeGlobPatterns(w.input) - w.parsedGlobs = make([]*glob.Glob, 0, len(patterns)) - for _, pattern := range patterns { - if g, err := glob.Parse(pattern); err == nil { - w.parsedGlobs = append(w.parsedGlobs, g) - } else { - panic("failed to parse glob pattern: " + pattern) - } - } - }) - return w.parsedGlobs -} - func (w *WatchedFiles[T]) Clone(input T) *WatchedFiles[T] { + w.mu.RLock() + defer w.mu.RUnlock() return &WatchedFiles[T]{ name: w.name, watchKind: w.watchKind, computeGlobPatterns: w.computeGlobPatterns, + watchers: w.watchers, input: input, - parsedGlobs: w.parsedGlobs, } } -func globMapperForTypingsInstaller(data map[tspath.Path]string) []string { - return slices.AppendSeq(make([]string, 0, len(data)), maps.Values(data)) -} - -func createResolutionLookupGlobMapper(currentDirectory string, useCaseSensitiveFileNames bool) func(data map[tspath.Path]string) []string { - rootPath := tspath.ToPath(currentDirectory, "", useCaseSensitiveFileNames) - rootPathComponents := tspath.GetPathComponents(string(rootPath), "") - isRootWatchable := canWatchDirectoryOrFile(rootPathComponents) +func createResolutionLookupGlobMapper(workspaceDirectory string, libDirectory string, currentDirectory string, useCaseSensitiveFileNames bool) func(data map[tspath.Path]string) patternsAndIgnored { + comparePathsOptions := tspath.ComparePathsOptions{ + CurrentDirectory: currentDirectory, + UseCaseSensitiveFileNames: useCaseSensitiveFileNames, + } - return func(data map[tspath.Path]string) []string { - // dir -> recursive - globSet := make(map[string]bool) + return func(data map[tspath.Path]string) patternsAndIgnored { + var ignored map[string]struct{} var seenDirs collections.Set[string] + var includeWorkspace, includeRoot, includeLib bool + var nodeModulesDirectories, externalDirectories map[tspath.Path]string for path, fileName := range data { // Assuming all of the input paths are filenames, we can avoid @@ -130,277 +149,138 @@ func createResolutionLookupGlobMapper(currentDirectory string, useCaseSensitiveF continue } - w := getDirectoryToWatchFailedLookupLocation( - fileName, - path, - currentDirectory, - rootPath, - rootPathComponents, - isRootWatchable, - true, - ) - if w == nil { - continue + if tspath.ContainsPath(workspaceDirectory, fileName, comparePathsOptions) { + includeWorkspace = true + } else if tspath.ContainsPath(currentDirectory, fileName, comparePathsOptions) { + includeRoot = true + } else if tspath.ContainsPath(libDirectory, fileName, comparePathsOptions) { + includeLib = true + } else if idx := strings.Index(fileName, "/node_modules/"); idx != -1 { + if nodeModulesDirectories == nil { + nodeModulesDirectories = make(map[tspath.Path]string) + } + dir := fileName[:idx+len("/node_modules")] + nodeModulesDirectories[tspath.ToPath(dir, currentDirectory, useCaseSensitiveFileNames)] = dir + } else { + if externalDirectories == nil { + externalDirectories = make(map[tspath.Path]string) + } + externalDirectories[path.GetDirectoryPath()] = tspath.GetDirectoryPath(fileName) } - globSet[w.dir] = globSet[w.dir] || !w.nonRecursive } - globs := make([]string, 0, len(globSet)) - for dir, recursive := range globSet { - if recursive { - globs = append(globs, dir+"/"+recursiveFileGlobPattern) - } else { - globs = append(globs, dir+"/"+fileGlobPattern) + var globs []string + if includeWorkspace { + globs = append(globs, getRecursiveGlobPattern(workspaceDirectory)) + } + if includeRoot { + globs = append(globs, getRecursiveGlobPattern(currentDirectory)) + } + if includeLib { + globs = append(globs, getRecursiveGlobPattern(libDirectory)) + } + for _, dir := range nodeModulesDirectories { + globs = append(globs, getRecursiveGlobPattern(dir)) + } + if len(externalDirectories) > 0 { + externalDirectoryParents, ignoredExternalDirs := tspath.GetCommonParents( + slices.Collect(maps.Values(externalDirectories)), + minWatchLocationDepth, + getPathComponentsForWatching, + comparePathsOptions, + ) + slices.Sort(externalDirectoryParents) + ignored = ignoredExternalDirs + for _, dir := range externalDirectoryParents { + globs = append(globs, getRecursiveGlobPattern(dir)) } } - slices.Sort(globs) - return globs + return patternsAndIgnored{ + patterns: globs, + ignored: ignored, + } } } -func getTypingsLocationsGlobs(typingsFiles []string, typingsLocation string, currentDirectory string, useCaseSensitiveFileNames bool) (fileGlobs map[tspath.Path]string, directoryGlobs map[tspath.Path]string) { +func getTypingsLocationsGlobs( + typingsFiles []string, + typingsLocation string, + workspaceDirectory string, + currentDirectory string, + useCaseSensitiveFileNames bool, +) patternsAndIgnored { + var includeTypingsLocation, includeWorkspace bool + externalDirectories := make(map[tspath.Path]string) + globs := make(map[tspath.Path]string) comparePathsOptions := tspath.ComparePathsOptions{ CurrentDirectory: currentDirectory, UseCaseSensitiveFileNames: useCaseSensitiveFileNames, } for _, file := range typingsFiles { - basename := tspath.GetBaseFileName(file) - if basename == "package.json" || basename == "bower.json" { - // package.json or bower.json exists, watch the file to detect changes and update typings - if fileGlobs == nil { - fileGlobs = map[tspath.Path]string{} - } - fileGlobs[tspath.ToPath(file, currentDirectory, useCaseSensitiveFileNames)] = file - } else { - var globLocation string - // path in projectRoot, watch project root - if tspath.ContainsPath(currentDirectory, file, comparePathsOptions) { - currentDirectoryLen := len(currentDirectory) + 1 - subDirectory := strings.IndexRune(file[currentDirectoryLen:], tspath.DirectorySeparator) - if subDirectory != -1 { - // Watch subDirectory - globLocation = file[0 : currentDirectoryLen+subDirectory] - } else { - // Watch the directory itself - globLocation = file - } - } else { - // path in global cache, watch global cache - // else watch node_modules or bower_components - globLocation = core.IfElse(tspath.ContainsPath(typingsLocation, file, comparePathsOptions), typingsLocation, file) - } - // package.json or bower.json exists, watch the file to detect changes and update typings - if directoryGlobs == nil { - directoryGlobs = map[tspath.Path]string{} - } - directoryGlobs[tspath.ToPath(globLocation, currentDirectory, useCaseSensitiveFileNames)] = fmt.Sprintf("%s/%s", globLocation, recursiveFileGlobPattern) - } - } - return fileGlobs, directoryGlobs -} - -type directoryOfFailedLookupWatch struct { - dir string - dirPath tspath.Path - nonRecursive bool - packageDir *string - packageDirPath *tspath.Path -} - -func getDirectoryToWatchFailedLookupLocation( - failedLookupLocation string, - failedLookupLocationPath tspath.Path, - rootDir string, - rootPath tspath.Path, - rootPathComponents []string, - isRootWatchable bool, - preferNonRecursiveWatch bool, -) *directoryOfFailedLookupWatch { - failedLookupPathComponents := tspath.GetPathComponents(string(failedLookupLocationPath), "") - failedLookupComponents := tspath.GetPathComponents(failedLookupLocation, "") - perceivedOsRootLength := perceivedOsRootLengthForWatching(failedLookupPathComponents, len(failedLookupPathComponents)) - if len(failedLookupPathComponents) <= perceivedOsRootLength+1 { - return nil - } - // If directory path contains node module, get the most parent node_modules directory for watching - nodeModulesIndex := slices.Index(failedLookupPathComponents, "node_modules") - if nodeModulesIndex != -1 && nodeModulesIndex+1 <= perceivedOsRootLength+1 { - return nil - } - lastNodeModulesIndex := lastIndex(failedLookupPathComponents, "node_modules") - if isRootWatchable && isInDirectoryPath(rootPathComponents, failedLookupPathComponents) { - if len(failedLookupPathComponents) > len(rootPathComponents)+1 { - // Instead of watching root, watch directory in root to avoid watching excluded directories not needed for module resolution - return getDirectoryOfFailedLookupWatch( - failedLookupComponents, - failedLookupPathComponents, - max(len(rootPathComponents)+1, perceivedOsRootLength+1), - lastNodeModulesIndex, - false, - ) + if tspath.ContainsPath(typingsLocation, file, comparePathsOptions) { + includeTypingsLocation = true + } else if !tspath.ContainsPath(workspaceDirectory, file, comparePathsOptions) { + directory := tspath.GetDirectoryPath(file) + externalDirectories[tspath.ToPath(directory, currentDirectory, useCaseSensitiveFileNames)] = directory } else { - // Always watch root directory non recursively - return &directoryOfFailedLookupWatch{ - dir: rootDir, - dirPath: rootPath, - nonRecursive: true, - } + includeWorkspace = true } } - - return getDirectoryToWatchFromFailedLookupLocationDirectory( - failedLookupComponents, - failedLookupPathComponents, - len(failedLookupPathComponents)-1, - perceivedOsRootLength, - nodeModulesIndex, - rootPathComponents, - lastNodeModulesIndex, - preferNonRecursiveWatch, + externalDirectoryParents, ignored := tspath.GetCommonParents( + slices.Collect(maps.Values(externalDirectories)), + minWatchLocationDepth, + getPathComponentsForWatching, + comparePathsOptions, ) -} - -func getDirectoryToWatchFromFailedLookupLocationDirectory( - dirComponents []string, - dirPathComponents []string, - dirPathComponentsLength int, - perceivedOsRootLength int, - nodeModulesIndex int, - rootPathComponents []string, - lastNodeModulesIndex int, - preferNonRecursiveWatch bool, -) *directoryOfFailedLookupWatch { - // If directory path contains node module, get the most parent node_modules directory for watching - if nodeModulesIndex != -1 { - // If the directory is node_modules use it to watch, always watch it recursively - return getDirectoryOfFailedLookupWatch( - dirComponents, - dirPathComponents, - nodeModulesIndex+1, - lastNodeModulesIndex, - false, - ) + slices.Sort(externalDirectoryParents) + if includeWorkspace { + globs[tspath.ToPath(workspaceDirectory, currentDirectory, useCaseSensitiveFileNames)] = getRecursiveGlobPattern(workspaceDirectory) } - - // Use some ancestor of the root directory - nonRecursive := true - length := dirPathComponentsLength - if !preferNonRecursiveWatch { - for i := range dirPathComponentsLength { - if dirPathComponents[i] != rootPathComponents[i] { - nonRecursive = false - length = max(i+1, perceivedOsRootLength+1) - break - } - } + if includeTypingsLocation { + globs[tspath.ToPath(typingsLocation, currentDirectory, useCaseSensitiveFileNames)] = getRecursiveGlobPattern(typingsLocation) } - return getDirectoryOfFailedLookupWatch( - dirComponents, - dirPathComponents, - length, - lastNodeModulesIndex, - nonRecursive, - ) -} - -func getDirectoryOfFailedLookupWatch( - dirComponents []string, - dirPathComponents []string, - length int, - lastNodeModulesIndex int, - nonRecursive bool, -) *directoryOfFailedLookupWatch { - packageDirLength := -1 - if lastNodeModulesIndex != -1 && lastNodeModulesIndex+1 >= length && lastNodeModulesIndex+2 < len(dirPathComponents) { - if !strings.HasPrefix(dirPathComponents[lastNodeModulesIndex+1], "@") { - packageDirLength = lastNodeModulesIndex + 2 - } else if lastNodeModulesIndex+3 < len(dirPathComponents) { - packageDirLength = lastNodeModulesIndex + 3 - } - } - var packageDir *string - var packageDirPath *tspath.Path - if packageDirLength != -1 { - packageDir = ptrTo(tspath.GetPathFromPathComponents(dirPathComponents[:packageDirLength])) - packageDirPath = ptrTo(tspath.Path(tspath.GetPathFromPathComponents(dirComponents[:packageDirLength]))) + for _, dir := range externalDirectoryParents { + globs[tspath.ToPath(dir, currentDirectory, useCaseSensitiveFileNames)] = getRecursiveGlobPattern(dir) } - - return &directoryOfFailedLookupWatch{ - dir: tspath.GetPathFromPathComponents(dirComponents[:length]), - dirPath: tspath.Path(tspath.GetPathFromPathComponents(dirPathComponents[:length])), - nonRecursive: nonRecursive, - packageDir: packageDir, - packageDirPath: packageDirPath, + return patternsAndIgnored{ + patterns: slices.Collect(maps.Values(globs)), + ignored: ignored, } } -func perceivedOsRootLengthForWatching(pathComponents []string, length int) int { - // Ignore "/", "c:/" - if length <= 1 { - return 1 - } - indexAfterOsRoot := 1 - firstComponent := pathComponents[0] - isDosStyle := len(firstComponent) >= 2 && tspath.IsVolumeCharacter(firstComponent[0]) && firstComponent[1] == ':' - if firstComponent != "/" && !isDosStyle && isDosStyleNextPart(pathComponents[1]) { - // ignore "//vda1cs4850/c$/folderAtRoot" - if length == 2 { - return 2 - } - indexAfterOsRoot = 2 - isDosStyle = true - } - - afterOsRoot := pathComponents[indexAfterOsRoot] - if isDosStyle && !strings.EqualFold(afterOsRoot, "users") { - // Paths like c:/notUsers - return indexAfterOsRoot +func getPathComponentsForWatching(path string, currentDirectory string) []string { + components := tspath.GetPathComponents(path, currentDirectory) + rootLength := perceivedOsRootLengthForWatching(components) + if rootLength <= 1 { + return components } - - if strings.EqualFold(afterOsRoot, "workspaces") { - // Paths like: /workspaces as codespaces hoist the repos in /workspaces so we have to exempt these from "2" level from root rule - return indexAfterOsRoot + 1 - } - - // Paths like: c:/users/username or /home/username - return indexAfterOsRoot + 2 + newRoot := tspath.CombinePaths(components[0], components[1:rootLength]...) + return append([]string{newRoot}, components[rootLength:]...) } -func canWatchDirectoryOrFile(pathComponents []string) bool { +func perceivedOsRootLengthForWatching(pathComponents []string) int { length := len(pathComponents) - // Ignore "/", "c:/" - // ignore "/user", "c:/users" or "c:/folderAtRoot" - if length < 2 { - return false + if length <= 1 { + return length } - perceivedOsRootLength := perceivedOsRootLengthForWatching(pathComponents, length) - return length > perceivedOsRootLength+1 -} - -func isDosStyleNextPart(part string) bool { - return len(part) == 2 && tspath.IsVolumeCharacter(part[0]) && part[1] == '$' -} - -func lastIndex[T comparable](s []T, v T) int { - for i := len(s) - 1; i >= 0; i-- { - if s[i] == v { - return i - } + if strings.HasPrefix(pathComponents[0], "//") { + // Group UNC roots (//server/share) into a single component + return 2 } - return -1 -} - -func isInDirectoryPath(dirComponents []string, fileOrDirComponents []string) bool { - if len(fileOrDirComponents) < len(dirComponents) { - return false - } - for i := range dirComponents { - if dirComponents[i] != fileOrDirComponents[i] { - return false + if len(pathComponents[0]) == 3 && tspath.IsVolumeCharacter(pathComponents[0][0]) && pathComponents[0][1] == ':' && pathComponents[0][2] == '/' { + // Windows-style volume + if strings.EqualFold(pathComponents[1], "users") { + // Group C:/Users/username into a single component + return min(3, length) } + return 1 } - return true + if pathComponents[1] == "home" { + // Group /home/username into a single component + return min(3, length) + } + return 1 } func ptrTo[T any](v T) *T { @@ -434,3 +314,48 @@ func extractLookups[T resolutionWithLookupLocations]( } } } + +func getNonRootFileGlobs(workspaceDir string, libDirectory string, sourceFiles []*ast.SourceFile, rootFiles map[tspath.Path]string, comparePathsOptions tspath.ComparePathsOptions) patternsAndIgnored { + var globs []string + var includeWorkspace, includeLib bool + var ignored map[string]struct{} + externalDirectories := make([]string, 0, max(0, len(sourceFiles)-len(rootFiles))) + for _, sourceFile := range sourceFiles { + if _, ok := rootFiles[sourceFile.Path()]; !ok { + if tspath.ContainsPath(workspaceDir, sourceFile.FileName(), comparePathsOptions) { + includeWorkspace = true + } else if tspath.ContainsPath(libDirectory, sourceFile.FileName(), comparePathsOptions) { + includeLib = true + } else { + externalDirectories = append(externalDirectories, tspath.GetDirectoryPath(sourceFile.FileName())) + } + } + } + + if includeWorkspace { + globs = append(globs, getRecursiveGlobPattern(workspaceDir)) + } + if includeLib { + globs = append(globs, getRecursiveGlobPattern(libDirectory)) + } + if len(externalDirectories) > 0 { + commonParents, ignoredDirs := tspath.GetCommonParents( + externalDirectories, + minWatchLocationDepth, + getPathComponentsForWatching, + comparePathsOptions, + ) + globs = append(globs, core.Map(commonParents, func(dir string) string { + return getRecursiveGlobPattern(dir) + })...) + ignored = ignoredDirs + } + return patternsAndIgnored{ + patterns: globs, + ignored: ignored, + } +} + +func getRecursiveGlobPattern(directory string) string { + return fmt.Sprintf("%s/%s", tspath.RemoveTrailingDirectorySeparator(directory), "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json}") +} diff --git a/internal/project/watch_test.go b/internal/project/watch_test.go new file mode 100644 index 00000000000..ed3159a2ede --- /dev/null +++ b/internal/project/watch_test.go @@ -0,0 +1,20 @@ +package project + +import ( + "testing" + + "gotest.tools/v3/assert" +) + +func TestGetPathComponentsForWatching(t *testing.T) { + t.Parallel() + + assert.DeepEqual(t, getPathComponentsForWatching("/project", ""), []string{"/", "project"}) + assert.DeepEqual(t, getPathComponentsForWatching("C:\\project", ""), []string{"C:/", "project"}) + assert.DeepEqual(t, getPathComponentsForWatching("//server/share/project/tsconfig.json", ""), []string{"//server/share", "project", "tsconfig.json"}) + assert.DeepEqual(t, getPathComponentsForWatching(`\\server\share\project\tsconfig.json`, ""), []string{"//server/share", "project", "tsconfig.json"}) + assert.DeepEqual(t, getPathComponentsForWatching("C:\\Users", ""), []string{"C:/Users"}) + assert.DeepEqual(t, getPathComponentsForWatching("C:\\Users\\andrew\\project", ""), []string{"C:/Users/andrew", "project"}) + assert.DeepEqual(t, getPathComponentsForWatching("/home", ""), []string{"/home"}) + assert.DeepEqual(t, getPathComponentsForWatching("/home/andrew/project", ""), []string{"/home/andrew", "project"}) +} diff --git a/internal/testrunner/compiler_runner.go b/internal/testrunner/compiler_runner.go index 1eb993988ac..215cba9c8d8 100644 --- a/internal/testrunner/compiler_runner.go +++ b/internal/testrunner/compiler_runner.go @@ -105,9 +105,6 @@ var skippedTests = []string{ "noImplicitUseStrict_amd.ts", "noImplicitAnyIndexingSuppressed.ts", "excessPropertyErrorsSuppressed.ts", - - // Broken - "inferenceFromGenericClassNoCrash1.ts", } func (r *CompilerBaselineRunner) RunTests(t *testing.T) { diff --git a/internal/transformers/declarations/transform.go b/internal/transformers/declarations/transform.go index 6217557d5fa..58cef207d5f 100644 --- a/internal/transformers/declarations/transform.go +++ b/internal/transformers/declarations/transform.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/debug" "github.com/microsoft/typescript-go/internal/diagnostics" @@ -11,6 +12,7 @@ import ( "github.com/microsoft/typescript-go/internal/modulespecifiers" "github.com/microsoft/typescript-go/internal/nodebuilder" "github.com/microsoft/typescript-go/internal/printer" + "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/transformers" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -56,6 +58,7 @@ type DeclarationTransformer struct { resultHasExternalModuleIndicator bool suppressNewDiagnosticContexts bool lateStatementReplacementMap map[ast.NodeId]*ast.Node + expandoHosts collections.Set[ast.NodeId] rawReferencedFiles []ReferencedFilePair rawTypeReferenceDirectives []*ast.FileReference rawLibReferenceDirectives []*ast.FileReference @@ -124,7 +127,6 @@ func (tx *DeclarationTransformer) visit(node *ast.Node) *ast.Node { ast.KindContinueStatement, ast.KindDebuggerStatement, ast.KindDoStatement, - ast.KindExpressionStatement, ast.KindEmptyStatement, ast.KindForInStatement, ast.KindForOfStatement, @@ -141,6 +143,8 @@ func (tx *DeclarationTransformer) visit(node *ast.Node) *ast.Node { ast.KindBlock, ast.KindMissingDeclaration: return nil + case ast.KindExpressionStatement: + return tx.visitExpressionStatement(node.AsExpressionStatement()) // parts of things, things we just visit children of default: return tx.visitDeclarationSubtree(node) @@ -166,6 +170,7 @@ func (tx *DeclarationTransformer) visitSourceFile(node *ast.SourceFile) *ast.Nod tx.suppressNewDiagnosticContexts = false tx.state.lateMarkedStatements = make([]*ast.Node, 0) tx.lateStatementReplacementMap = make(map[ast.NodeId]*ast.Node) + tx.expandoHosts = collections.Set[ast.NodeId]{} tx.rawReferencedFiles = make([]ReferencedFilePair, 0) tx.rawTypeReferenceDirectives = make([]*ast.FileReference, 0) tx.rawLibReferenceDirectives = make([]*ast.FileReference, 0) @@ -231,12 +236,12 @@ func (tx *DeclarationTransformer) transformAndReplaceLatePaintedStatements(state next := tx.state.lateMarkedStatements[0] tx.state.lateMarkedStatements = tx.state.lateMarkedStatements[1:] - priorNeedsDeclare := tx.needsDeclare + saveNeedsDeclare := tx.needsDeclare tx.needsDeclare = next.Parent != nil && ast.IsSourceFile(next.Parent) && !(ast.IsExternalModule(next.Parent.AsSourceFile()) && tx.isBundledEmit) result := tx.transformTopLevelDeclaration(next) - tx.needsDeclare = priorNeedsDeclare + tx.needsDeclare = saveNeedsDeclare original := tx.EmitContext().MostOriginal(next) id := ast.GetNodeId(original) tx.lateStatementReplacementMap[id] = result @@ -789,8 +794,6 @@ func (tx *DeclarationTransformer) transformGetAccesorDeclaration(input *ast.GetA ) } -const defaultModifierFlagsMask = ast.ModifierFlagsAll ^ ast.ModifierFlagsPublic - func (tx *DeclarationTransformer) updateAccessorParamList(input *ast.Node, isPrivate bool) *ast.ParameterList { var newParams []*ast.Node if !isPrivate { @@ -955,11 +958,11 @@ func (tx *DeclarationTransformer) visitDeclarationStatements(input *ast.Node) *a tx.removeAllComments(assignment) return tx.Factory().NewSyntaxList([]*ast.Node{statement, assignment}) default: - result := tx.transformTopLevelDeclaration(input) - // Don't actually transform yet; just leave as original node - will be elided/swapped by late pass - original := tx.EmitContext().MostOriginal(input) - id := ast.GetNodeId(original) - tx.lateStatementReplacementMap[id] = result + id := ast.GetNodeId(tx.EmitContext().MostOriginal(input)) + if tx.lateStatementReplacementMap[id] == nil { + // Don't actually transform yet; just leave as original node - will be elided/swapped by late pass + tx.lateStatementReplacementMap[id] = tx.transformTopLevelDeclaration(input) + } return input } } @@ -1100,7 +1103,7 @@ func (tx *DeclarationTransformer) transformTopLevelDeclaration(input *ast.Node) if canProdiceDiagnostic { tx.state.getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(input) } - previousNeedsDeclare := tx.needsDeclare + saveNeedsDeclare := tx.needsDeclare var result *ast.Node switch input.Kind { @@ -1125,7 +1128,7 @@ func (tx *DeclarationTransformer) transformTopLevelDeclaration(input *ast.Node) tx.enclosingDeclaration = previousEnclosingDeclaration tx.state.getSymbolAccessibilityDiagnostic = oldDiag - tx.needsDeclare = previousNeedsDeclare + tx.needsDeclare = saveNeedsDeclare tx.state.errorNameNode = oldName return result } @@ -1153,7 +1156,7 @@ func (tx *DeclarationTransformer) transformInterfaceDeclaration(input *ast.Inter } func (tx *DeclarationTransformer) transformFunctionDeclaration(input *ast.FunctionDeclaration) *ast.Node { - updated := tx.Factory().UpdateFunctionDeclaration( + return tx.Factory().UpdateFunctionDeclaration( input, tx.ensureModifiers(input.AsNode()), nil, @@ -1164,17 +1167,6 @@ func (tx *DeclarationTransformer) transformFunctionDeclaration(input *ast.Functi nil, /*fullSignature*/ nil, ) - if updated == nil || !tx.resolver.IsExpandoFunctionDeclaration(input.AsNode()) || !shouldEmitFunctionProperties(input) { - return updated - } - // Add expando function properties to result - - // !!! TODO: expando function support - // props := tx.resolver.GetPropertiesOfContainerFunction(input) - // if tx.state.isolatedDeclarations { - // tx.state.reportExpandoFunctionErrors(input.AsNode()) - // } - return updated // !!! } func (tx *DeclarationTransformer) transformModuleDeclaration(input *ast.ModuleDeclaration) *ast.Node { @@ -1182,7 +1174,7 @@ func (tx *DeclarationTransformer) transformModuleDeclaration(input *ast.ModuleDe // It'd be good to collapse those back in the declaration output, but the AST can't represent the // `namespace a.b.c` shape for the printer (without using invalid identifier names). mods := tx.ensureModifiers(input.AsNode()) - oldNeedsDeclare := tx.needsDeclare + saveNeedsDeclare := tx.needsDeclare tx.needsDeclare = false inner := input.Body keyword := input.Keyword @@ -1213,7 +1205,7 @@ func (tx *DeclarationTransformer) transformModuleDeclaration(input *ast.ModuleDe } body := tx.Factory().UpdateModuleBlock(inner.AsModuleBlock(), lateStatements) - tx.needsDeclare = oldNeedsDeclare + tx.needsDeclare = saveNeedsDeclare tx.needsScopeFixMarker = oldNeedsScopeFix tx.resultHasScopeMarker = oldHasScopeFix @@ -1817,3 +1809,172 @@ func (tx *DeclarationTransformer) transformJSDocOptionalType(input *ast.JSDocOpt tx.EmitContext().SetOriginal(replacement, input.AsNode()) return replacement } + +func (tx *DeclarationTransformer) visitExpressionStatement(node *ast.ExpressionStatement) *ast.Node { + expression := node.Expression + if expression == nil { + return nil + } + + if expression.Kind == ast.KindBinaryExpression && + ast.GetAssignmentDeclarationKind(expression.AsBinaryExpression()) == ast.JSDeclarationKindProperty { + return tx.transformExpandoAssignment(expression.AsBinaryExpression()) + } + + return nil +} + +func (tx *DeclarationTransformer) transformExpandoAssignment(node *ast.BinaryExpression) *ast.Node { + left := node.Left + + symbol := node.Symbol + if symbol == nil || symbol.Flags&ast.SymbolFlagsAssignment == 0 { + return nil + } + + ns := ast.GetLeftmostAccessExpression(left) + if ns == nil || ns.Kind != ast.KindIdentifier { + return nil + } + + declaration := tx.resolver.GetReferencedValueDeclaration(ns) + if declaration == nil { + return nil + } + + host := declaration.Symbol() + if host == nil { + return nil + } + + name := tx.Factory().NewIdentifier(ns.Text()) + property := tx.tryGetPropertyName(left) + if property == "" || !scanner.IsIdentifierText(property, core.LanguageVariantStandard) { + return nil + } + + tx.transformExpandoHost(name, declaration) + + if ast.IsFunctionDeclaration(declaration) && !shouldEmitFunctionProperties(declaration.AsFunctionDeclaration()) { + return nil + } + + isNonContextualKeywordName := ast.IsNonContextualKeyword(scanner.StringToToken(property)) + exportName := core.IfElse(isNonContextualKeywordName, tx.Factory().NewGeneratedNameForNode(left), tx.Factory().NewIdentifier(property)) + + synthesizedNamespace := tx.Factory().NewModuleDeclaration(nil /*modifiers*/, ast.KindNamespaceKeyword, name, tx.Factory().NewModuleBlock(tx.Factory().NewNodeList([]*ast.Node{}))) + synthesizedNamespace.Parent = tx.enclosingDeclaration + + declarationData := synthesizedNamespace.DeclarationData() + declarationData.Symbol = host + + containerData := synthesizedNamespace.LocalsContainerData() + containerData.Locals = ast.NewSymbolTable() + + saveDiag := tx.state.getSymbolAccessibilityDiagnostic + tx.state.getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(node.AsNode()) + t := tx.resolver.CreateTypeOfExpression(tx.EmitContext(), left, synthesizedNamespace, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags|nodebuilder.InternalFlagsNoSyntacticPrinter, tx.tracker) + tx.state.getSymbolAccessibilityDiagnostic = saveDiag + + statements := []*ast.Statement{ + tx.Factory().NewVariableStatement( + nil, /*modifiers*/ + tx.Factory().NewVariableDeclarationList( + ast.NodeFlagsNone, + tx.Factory().NewNodeList([]*ast.Node{ + tx.Factory().NewVariableDeclaration(exportName, nil /*exclamationToken*/, t, nil /*initializer*/), + }), + ), + ), + } + + if isNonContextualKeywordName { + namedExports := tx.Factory().NewNamedExports(tx.Factory().NewNodeList( + []*ast.Node{ + tx.Factory().NewExportSpecifier(false /*isTypeOnly*/, exportName, tx.Factory().NewIdentifier(left.Name().Text())), + }, + )) + statements = append(statements, tx.Factory().NewExportDeclaration(nil /*modifiers*/, false /*isTypeOnly*/, namedExports, nil /*moduleSpecifier*/, nil /*attributes*/)) + } + + flags := tx.host.GetEffectiveDeclarationFlags(tx.EmitContext().ParseNode(declaration), ast.ModifierFlagsAll) + modifierFlags := ast.ModifierFlagsAmbient + + if flags&ast.ModifierFlagsExport != 0 { + if flags&ast.ModifierFlagsDefault == 0 { + modifierFlags |= ast.ModifierFlagsExport + } + tx.resultHasScopeMarker = true + tx.resultHasExternalModuleIndicator = true + } + + return tx.Factory().NewModuleDeclaration(tx.Factory().NewModifierList(ast.CreateModifiersFromModifierFlags(modifierFlags, tx.Factory().NewModifier)), ast.KindNamespaceKeyword, name, tx.Factory().NewModuleBlock(tx.Factory().NewNodeList(statements))) +} + +func (tx *DeclarationTransformer) transformExpandoHost(name *ast.Node, declaration *ast.Declaration) { + root := core.IfElse(ast.IsVariableDeclaration(declaration), declaration.Parent.Parent, declaration) + id := ast.GetNodeId(tx.EmitContext().MostOriginal(root)) + + if tx.expandoHosts.Has(id) { + return + } + + saveNeedsDeclare := tx.needsDeclare + tx.needsDeclare = true + + modifierFlags := tx.ensureModifierFlags(root) + defaultExport := modifierFlags&ast.ModifierFlagsExport != 0 && modifierFlags&ast.ModifierFlagsDefault != 0 + + tx.needsDeclare = saveNeedsDeclare + + if defaultExport { + modifierFlags |= ast.ModifierFlagsAmbient + modifierFlags ^= ast.ModifierFlagsDefault + modifierFlags ^= ast.ModifierFlagsExport + } + + modifiers := tx.Factory().NewModifierList(ast.CreateModifiersFromModifierFlags(modifierFlags, tx.Factory().NewModifier)) + replacement := make([]*ast.Node, 0) + + if ast.IsFunctionDeclaration(declaration) { + typeParameters, parameters, asteriskToken := extractExpandoHostParams(declaration) + replacement = append(replacement, tx.Factory().UpdateFunctionDeclaration(declaration.AsFunctionDeclaration(), modifiers, asteriskToken, declaration.Name(), tx.ensureTypeParams(declaration, typeParameters), tx.updateParamList(declaration, parameters), tx.ensureType(declaration, false), nil /*fullSignature*/, nil /*body*/)) + } else if ast.IsVariableDeclaration(declaration) && ast.IsFunctionExpressionOrArrowFunction(declaration.Initializer()) { + fn := declaration.Initializer() + typeParameters, parameters, asteriskToken := extractExpandoHostParams(fn) + replacement = append(replacement, tx.Factory().NewFunctionDeclaration(modifiers, asteriskToken, tx.Factory().NewIdentifier(name.Text()), tx.ensureTypeParams(fn, typeParameters), tx.updateParamList(fn, parameters), tx.ensureType(fn, false), nil /*fullSignature*/, nil /*body*/)) + } else { + return + } + + if defaultExport { + replacement = append(replacement, tx.Factory().NewExportAssignment(nil /*modifiers*/, false /*isExportEquals*/, nil /*typeNode*/, name)) + } + + tx.expandoHosts.Add(id) + tx.lateStatementReplacementMap[id] = tx.Factory().NewSyntaxList(replacement) +} + +func extractExpandoHostParams(node *ast.Node) (typeParameters *ast.TypeParameterList, parameters *ast.ParameterList, asteriskToken *ast.TokenNode) { + switch node.Kind { + case ast.KindFunctionExpression: + fn := node.AsFunctionExpression() + return fn.TypeParameters, fn.Parameters, fn.AsteriskToken + case ast.KindArrowFunction: + fn := node.AsArrowFunction() + return fn.TypeParameters, fn.Parameters, fn.AsteriskToken + default: + fn := node.AsFunctionDeclaration() + return fn.TypeParameters, fn.Parameters, fn.AsteriskToken + } +} + +func (tx *DeclarationTransformer) tryGetPropertyName(node *ast.Node) string { + if ast.IsElementAccessExpression(node) { + return tx.resolver.GetElementAccessExpressionName(node.AsElementAccessExpression()) + } + if ast.IsPropertyAccessExpression(node) { + return node.Name().Text() + } + return "" +} diff --git a/internal/tsoptions/parsedcommandline.go b/internal/tsoptions/parsedcommandline.go index 198f9cafb4e..e60649300b9 100644 --- a/internal/tsoptions/parsedcommandline.go +++ b/internal/tsoptions/parsedcommandline.go @@ -1,19 +1,26 @@ package tsoptions import ( + "fmt" "iter" "slices" + "strings" "sync" "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/glob" "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/tspath" "github.com/microsoft/typescript-go/internal/vfs" ) +const ( + fileGlobPattern = "*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json}" + recursiveFileGlobPattern = "**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,json}" +) + type ParsedCommandLine struct { ParsedConfig *core.ParsedOptions `json:"parsedConfig"` @@ -25,6 +32,8 @@ type ParsedCommandLine struct { comparePathsOptions tspath.ComparePathsOptions wildcardDirectoriesOnce sync.Once wildcardDirectories map[string]bool + includeGlobsOnce sync.Once + includeGlobs []*glob.Glob extraFileExtensions []FileExtensionInfo sourceAndOutputMapsOnce sync.Once @@ -197,21 +206,40 @@ func (p *ParsedCommandLine) WildcardDirectories() map[string]bool { return nil } - if p.wildcardDirectories != nil { - return p.wildcardDirectories - } - p.wildcardDirectoriesOnce.Do(func() { - p.wildcardDirectories = getWildcardDirectories( - p.ConfigFile.configFileSpecs.validatedIncludeSpecs, - p.ConfigFile.configFileSpecs.validatedExcludeSpecs, - p.comparePathsOptions, - ) + if p.wildcardDirectories == nil { + p.wildcardDirectories = getWildcardDirectories( + p.ConfigFile.configFileSpecs.validatedIncludeSpecs, + p.ConfigFile.configFileSpecs.validatedExcludeSpecs, + p.comparePathsOptions, + ) + } }) return p.wildcardDirectories } +func (p *ParsedCommandLine) WildcardDirectoryGlobs() []*glob.Glob { + wildcardDirectories := p.WildcardDirectories() + if wildcardDirectories == nil { + return nil + } + + p.includeGlobsOnce.Do(func() { + if p.includeGlobs == nil { + globs := make([]*glob.Glob, 0, len(wildcardDirectories)) + for dir, recursive := range wildcardDirectories { + if parsed, err := glob.Parse(fmt.Sprintf("%s/%s", tspath.NormalizePath(dir), core.IfElse(recursive, recursiveFileGlobPattern, fileGlobPattern))); err == nil { + globs = append(globs, parsed) + } + } + p.includeGlobs = globs + } + }) + + return p.includeGlobs +} + // Normalized file names explicitly specified in `files` func (p *ParsedCommandLine) LiteralFileNames() []string { if p != nil && p.ConfigFile != nil { @@ -285,48 +313,30 @@ func (p *ParsedCommandLine) GetConfigFileParsingDiagnostics() []*ast.Diagnostic return p.Errors } -// Porting reference: ProjectService.isMatchedByConfig -func (p *ParsedCommandLine) MatchesFileName(fileName string) bool { +// PossiblyMatchesFileName is a fast check to see if a file is currently included by a config +// or would be included if the file were to be created. It may return false positives. +func (p *ParsedCommandLine) PossiblyMatchesFileName(fileName string) bool { path := tspath.ToPath(fileName, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames()) - if slices.ContainsFunc(p.FileNames(), func(f string) bool { - return path == tspath.ToPath(f, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames()) - }) { + if _, ok := p.FileNamesByPath()[path]; ok { return true } - if p.ConfigFile == nil { - return false - } - - if len(p.ConfigFile.configFileSpecs.validatedIncludeSpecs) == 0 { - return false - } - - supportedExtensions := GetSupportedExtensionsWithJsonIfResolveJsonModule( - p.CompilerOptions(), - GetSupportedExtensions(p.CompilerOptions(), p.extraFileExtensions), - ) - - if !tspath.FileExtensionIsOneOf(fileName, core.Flatten(supportedExtensions)) { - return false - } - - if p.ConfigFile.configFileSpecs.matchesExclude(fileName, p.comparePathsOptions) { - return false - } - - var allFileNames collections.Set[tspath.Path] - for _, fileName := range p.FileNames() { - allFileNames.Add(tspath.ToPath(fileName, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames())) + for _, include := range p.ConfigFile.configFileSpecs.validatedIncludeSpecs { + if !strings.ContainsAny(include, "*?") && !vfs.IsImplicitGlob(include) { + includePath := tspath.ToPath(include, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames()) + if includePath == path { + return true + } + } } - - if hasFileWithHigherPriorityExtension(string(path), supportedExtensions, func(fileName string) bool { - return allFileNames.Has(tspath.Path(fileName)) - }) { - return false + if wildcardDirectoryGlobs := p.WildcardDirectoryGlobs(); len(wildcardDirectoryGlobs) > 0 { + for _, glob := range wildcardDirectoryGlobs { + if glob.Match(fileName) { + return true + } + } } - - return p.ConfigFile.configFileSpecs.getMatchedIncludeSpec(fileName, p.comparePathsOptions) != "" + return false } func (p *ParsedCommandLine) GetMatchedFileSpec(fileName string) string { @@ -363,6 +373,7 @@ func (p *ParsedCommandLine) ReloadFileNamesOfParsedCommandLine(fs vfs.FS) *Parse CompileOnSave: p.CompileOnSave, comparePathsOptions: p.comparePathsOptions, wildcardDirectories: p.wildcardDirectories, + includeGlobs: p.includeGlobs, extraFileExtensions: p.extraFileExtensions, literalFileNamesLen: literalFileNamesLen, } diff --git a/internal/tsoptions/parsedcommandline_test.go b/internal/tsoptions/parsedcommandline_test.go index 18c83ba6339..8015a820a80 100644 --- a/internal/tsoptions/parsedcommandline_test.go +++ b/internal/tsoptions/parsedcommandline_test.go @@ -12,7 +12,7 @@ import ( func TestParsedCommandLine(t *testing.T) { t.Parallel() - t.Run("MatchesFileName", func(t *testing.T) { + t.Run("PossiblyMatchesFileName", func(t *testing.T) { t.Parallel() noFiles := map[string]string{} @@ -47,13 +47,13 @@ func TestParsedCommandLine(t *testing.T) { assertMatches := func(t *testing.T, parsedCommandLine *tsoptions.ParsedCommandLine, files map[string]string, matches []string) { t.Helper() for fileName := range files { - actual := parsedCommandLine.MatchesFileName(fileName) + actual := parsedCommandLine.PossiblyMatchesFileName(fileName) expected := slices.Contains(matches, fileName) assert.Equal(t, actual, expected, "fileName: %s", fileName) } for _, fileName := range matches { if _, ok := files[fileName]; !ok { - actual := parsedCommandLine.MatchesFileName(fileName) + actual := parsedCommandLine.PossiblyMatchesFileName(fileName) assert.Equal(t, actual, true, "fileName: %s", fileName) } } @@ -163,229 +163,6 @@ func TestParsedCommandLine(t *testing.T) { "/dev/b.ts", }) }) - - t.Run("with non .ts file extensions", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "include": [ - "a.js", - "b.js" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{}) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{}) - }) - - t.Run("with literal excludes", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "include": [ - "a.ts", - "b.ts" - ], - "exclude": [ - "b.ts" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{ - "/dev/a.ts", - }) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{ - "/dev/a.ts", - }) - }) - - t.Run("with wildcard excludes", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "include": [ - "a.ts", - "b.ts", - "z/a.ts", - "z/abz.ts", - "z/aba.ts", - "x/b.ts" - ], - "exclude": [ - "*.ts", - "z/??z.ts", - "*/b.ts" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{ - "/dev/z/a.ts", - "/dev/z/aba.ts", - }) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{ - "/dev/z/a.ts", - "/dev/z/aba.ts", - }) - }) - - t.Run("with wildcard include list", func(t *testing.T) { - t.Parallel() - - t.Run("star matches only ts files", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "include": [ - "*" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{ - "/dev/a.ts", - "/dev/b.ts", - "/dev/c.d.ts", - }) - - // a.d.ts matches if a.ts is not already included - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{ - "/dev/a.ts", - "/dev/a.d.ts", - "/dev/b.ts", - "/dev/c.d.ts", - }) - }) - - t.Run("question matches only a single character", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "include": [ - "x/?.ts" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{ - "/dev/x/a.ts", - "/dev/x/b.ts", - }) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{ - "/dev/x/a.ts", - "/dev/x/b.ts", - }) - }) - - t.Run("exclude .js files when allowJs=false", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "include": [ - "js/*" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{}) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{}) - }) - - t.Run("include .js files when allowJs=true", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "compilerOptions": { - "allowJs": true - }, - "include": [ - "js/*" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{ - "/dev/js/a.js", - "/dev/js/b.js", - }) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{ - "/dev/js/a.js", - "/dev/js/b.js", - }) - }) - - t.Run("include explicitly listed .min.js files when allowJs=true", func(t *testing.T) { - t.Parallel() - parsedCommandLine := tsoptionstest.GetParsedCommandLine( - t, - `{ - "compilerOptions": { - "allowJs": true - }, - "include": [ - "js/*.min.js" - ] - }`, - files, - "/dev", - /*useCaseSensitiveFileNames*/ true, - ) - - assertMatches(t, parsedCommandLine, files, []string{ - "/dev/js/d.min.js", - "/dev/js/ab.min.js", - }) - - emptyParsedCommandLine := parsedCommandLine.ReloadFileNamesOfParsedCommandLine(noFilesFS) - assertMatches(t, emptyParsedCommandLine, noFiles, []string{ - "/dev/js/d.min.js", - "/dev/js/ab.min.js", - }) - }) - }) }) }) } diff --git a/internal/tspath/path.go b/internal/tspath/path.go index 7e726dfa001..fae34237210 100644 --- a/internal/tspath/path.go +++ b/internal/tspath/path.go @@ -2,6 +2,7 @@ package tspath import ( "cmp" + "slices" "strings" "unicode" @@ -1023,3 +1024,106 @@ func SplitVolumePath(path string) (volume string, rest string, ok bool) { } return "", path, false } + +// GetCommonParents returns the smallest set of directories that are parents of all paths with +// at least `minComponents` directory components. Any path that has fewer than `minComponents` directory components +// will be returned in the second return value. Examples: +// +// /a/b/c/d, /a/b/c/e, /a/b/f/g => /a/b +// /a/b/c/d, /a/b/c/e, /a/b/f/g, /x/y => / +// /a/b/c/d, /a/b/c/e, /a/b/f/g, /x/y (minComponents: 2) => /a/b, /x/y +// c:/a/b/c/d, d:/a/b/c/d => c:/a/b/c/d, d:/a/b/c/d +func GetCommonParents( + paths []string, + minComponents int, + getPathComponents func(path string, currentDirectory string) []string, + options ComparePathsOptions, +) (parents []string, ignored map[string]struct{}) { + if minComponents < 1 { + panic("minComponents must be at least 1") + } + if len(paths) == 0 { + return nil, nil + } + if len(paths) == 1 { + if len(reducePathComponents(getPathComponents(paths[0], options.CurrentDirectory))) < minComponents { + return nil, map[string]struct{}{paths[0]: {}} + } + return paths, nil + } + + ignored = make(map[string]struct{}) + pathComponents := make([][]string, 0, len(paths)) + for _, path := range paths { + components := reducePathComponents(getPathComponents(path, options.CurrentDirectory)) + if len(components) < minComponents { + ignored[path] = struct{}{} + } else { + pathComponents = append(pathComponents, components) + } + } + + results := getCommonParentsWorker(pathComponents, minComponents, options) + resultPaths := make([]string, len(results)) + for i, comps := range results { + resultPaths[i] = GetPathFromPathComponents(comps) + } + + return resultPaths, ignored +} + +func getCommonParentsWorker(componentGroups [][]string, minComponents int, options ComparePathsOptions) [][]string { + if len(componentGroups) == 0 { + return nil + } + // Determine the maximum depth we can consider + maxDepth := len(componentGroups[0]) + for _, comps := range componentGroups[1:] { + if l := len(comps); l < maxDepth { + maxDepth = l + } + } + + equality := options.getEqualityComparer() + for lastCommonIndex := range maxDepth { + candidate := componentGroups[0][lastCommonIndex] + for j, comps := range componentGroups[1:] { + if !equality(candidate, comps[lastCommonIndex]) { // divergence + if lastCommonIndex < minComponents { + // Not enough components, we need to fan out + orderedGroups := make([]Path, 0, len(componentGroups)-j) + newGroups := make(map[Path]struct { + head []string + tails [][]string + }) + for _, g := range componentGroups { + key := ToPath(g[lastCommonIndex], options.CurrentDirectory, options.UseCaseSensitiveFileNames) + if _, ok := newGroups[key]; !ok { + orderedGroups = append(orderedGroups, key) + } + newGroups[key] = struct { + head []string + tails [][]string + }{ + head: g[:lastCommonIndex+1], + tails: append(newGroups[key].tails, g[lastCommonIndex+1:]), + } + } + slices.Sort(orderedGroups) + result := make([][]string, 0, len(newGroups)) + for _, key := range orderedGroups { + group := newGroups[key] + subResults := getCommonParentsWorker(group.tails, minComponents-(lastCommonIndex+1), options) + for _, sr := range subResults { + result = append(result, append(group.head, sr...)) + } + } + return result + } + return [][]string{componentGroups[0][:lastCommonIndex]} + } + } + } + + return [][]string{componentGroups[0][:maxDepth]} +} diff --git a/internal/tspath/path_test.go b/internal/tspath/path_test.go index 07683b88255..85d7829de69 100644 --- a/internal/tspath/path_test.go +++ b/internal/tspath/path_test.go @@ -704,3 +704,107 @@ func normalizePath_old(path string) string { func getNormalizedAbsolutePath_old(fileName string, currentDirectory string) string { return GetPathFromPathComponents(GetNormalizedPathComponents(fileName, currentDirectory)) } + +func TestGetCommonParents(t *testing.T) { + t.Parallel() + + opts := ComparePathsOptions{} + + t.Run("empty input", func(t *testing.T) { + t.Parallel() + var paths []string + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + assert.DeepEqual(t, got, ([]string)(nil)) + }) + + t.Run("single path returns itself", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d"} + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{paths[0]} + assert.DeepEqual(t, got, expected) + }) + + t.Run("paths shorter than minComponents are ignored", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/a/b/c/e", "/a/b/f/g", "/x/y"} + got, ignored := GetCommonParents(paths, 4, GetPathComponents, opts) + assert.DeepEqual(t, ignored, map[string]struct{}{"/x/y": {}}) + expected := []string{"/a/b/c", "/a/b/f/g"} + assert.DeepEqual(t, got, expected) + }) + + t.Run("three paths share /a/b", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/a/b/c/e", "/a/b/f/g"} + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{"/a/b"} + assert.DeepEqual(t, got, expected) + }) + + t.Run("mixed with short path collapses to root when minComponents=1", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/a/b/c/e", "/a/b/f/g", "/x/y/z"} + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{"/"} + assert.DeepEqual(t, got, expected) + }) + + t.Run("mixed with short path preserves both when minComponents=3", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/a/b/c/e", "/a/b/f/g", "/x/y/z"} + got, ignored := GetCommonParents(paths, 3, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{"/a/b", "/x/y/z"} + assert.DeepEqual(t, got, expected) + }) + + t.Run("different volumes are returned individually", func(t *testing.T) { + t.Parallel() + paths := []string{"c:/a/b/c/d", "d:/a/b/c/d"} + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{paths[0], paths[1]} + assert.DeepEqual(t, got, expected) + }) + + t.Run("duplicate paths deduplicate result", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/a/b/c/d"} + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{paths[0]} + assert.DeepEqual(t, got, expected) + }) + + t.Run("paths with few components are returned as-is when minComponents met", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/x/y"} + got, ignored := GetCommonParents(paths, 2, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{"/a/b/c/d", "/x/y"} + assert.DeepEqual(t, got, expected) + }) + + t.Run("minComponents=2", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/c/d", "/a/z/c/e", "/a/aaa/f/g", "/x/y/z"} + got, ignored := GetCommonParents(paths, 2, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{"/a", "/x/y/z"} + assert.DeepEqual(t, got, expected) + }) + + t.Run("trailing separators are handled", func(t *testing.T) { + t.Parallel() + paths := []string{"/a/b/", "/a/b/c"} + got, ignored := GetCommonParents(paths, 1, GetPathComponents, opts) + assert.Equal(t, len(ignored), 0) + expected := []string{"/a/b"} + assert.DeepEqual(t, got, expected) + }) +} diff --git a/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.js b/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.js new file mode 100644 index 00000000000..54a3a527f96 --- /dev/null +++ b/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/blockedScopeVariableNotUnused1.ts] //// + +//// [blockedScopeVariableNotUnused1.ts] +export function foo() { + const _fn = () => { + ;(() => numFilesSelected)() + } + + const numFilesSelected = 1 +} + + +//// [blockedScopeVariableNotUnused1.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = foo; +function foo() { + const _fn = () => { + ; + (() => numFilesSelected)(); + }; + const numFilesSelected = 1; +} diff --git a/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.symbols b/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.symbols new file mode 100644 index 00000000000..7cb8b2fb753 --- /dev/null +++ b/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.symbols @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/blockedScopeVariableNotUnused1.ts] //// + +=== blockedScopeVariableNotUnused1.ts === +export function foo() { +>foo : Symbol(foo, Decl(blockedScopeVariableNotUnused1.ts, 0, 0)) + + const _fn = () => { +>_fn : Symbol(_fn, Decl(blockedScopeVariableNotUnused1.ts, 1, 7)) + + ;(() => numFilesSelected)() +>numFilesSelected : Symbol(numFilesSelected, Decl(blockedScopeVariableNotUnused1.ts, 5, 7)) + } + + const numFilesSelected = 1 +>numFilesSelected : Symbol(numFilesSelected, Decl(blockedScopeVariableNotUnused1.ts, 5, 7)) +} + diff --git a/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.types b/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.types new file mode 100644 index 00000000000..51f64d7851b --- /dev/null +++ b/testdata/baselines/reference/compiler/blockedScopeVariableNotUnused1.types @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/blockedScopeVariableNotUnused1.ts] //// + +=== blockedScopeVariableNotUnused1.ts === +export function foo() { +>foo : () => void + + const _fn = () => { +>_fn : () => void +>() => { ;(() => numFilesSelected)() } : () => void + + ;(() => numFilesSelected)() +>(() => numFilesSelected)() : number +>(() => numFilesSelected) : () => number +>() => numFilesSelected : () => number +>numFilesSelected : 1 + } + + const numFilesSelected = 1 +>numFilesSelected : 1 +>1 : 1 +} + diff --git a/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.js b/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.js new file mode 100644 index 00000000000..c54f345dd50 --- /dev/null +++ b/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.js @@ -0,0 +1,57 @@ +//// [tests/cases/compiler/declarationEmitExpandoFunction.ts] //// + +//// [declarationEmitExpandoFunction.ts] +export function A() { + return 'A'; +} + +export function B() { + return 'B'; +} + +export enum C { + C +} + +A.a = C; +A.b = C; + +B.c = C; + + +//// [declarationEmitExpandoFunction.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +exports.A = A; +exports.B = B; +function A() { + return 'A'; +} +function B() { + return 'B'; +} +var C; +(function (C) { + C[C["C"] = 0] = "C"; +})(C || (exports.C = C = {})); +A.a = C; +A.b = C; +B.c = C; + + +//// [declarationEmitExpandoFunction.d.ts] +export declare function A(): string; +export declare function B(): string; +export declare enum C { + C = 0 +} +export declare namespace A { + var a: typeof C; +} +export declare namespace A { + var b: typeof C; +} +export declare namespace B { + var c: typeof C; +} diff --git a/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.symbols b/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.symbols new file mode 100644 index 00000000000..41183b30b51 --- /dev/null +++ b/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.symbols @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/declarationEmitExpandoFunction.ts] //// + +=== declarationEmitExpandoFunction.ts === +export function A() { +>A : Symbol(A, Decl(declarationEmitExpandoFunction.ts, 0, 0)) + + return 'A'; +} + +export function B() { +>B : Symbol(B, Decl(declarationEmitExpandoFunction.ts, 2, 1)) + + return 'B'; +} + +export enum C { +>C : Symbol(C, Decl(declarationEmitExpandoFunction.ts, 6, 1)) + + C +>C : Symbol(C.C, Decl(declarationEmitExpandoFunction.ts, 8, 15)) +} + +A.a = C; +>A.a : Symbol(A.a, Decl(declarationEmitExpandoFunction.ts, 10, 1)) +>A : Symbol(A, Decl(declarationEmitExpandoFunction.ts, 0, 0)) +>a : Symbol(A.a, Decl(declarationEmitExpandoFunction.ts, 10, 1)) +>C : Symbol(C, Decl(declarationEmitExpandoFunction.ts, 6, 1)) + +A.b = C; +>A.b : Symbol(A.b, Decl(declarationEmitExpandoFunction.ts, 12, 8)) +>A : Symbol(A, Decl(declarationEmitExpandoFunction.ts, 0, 0)) +>b : Symbol(A.b, Decl(declarationEmitExpandoFunction.ts, 12, 8)) +>C : Symbol(C, Decl(declarationEmitExpandoFunction.ts, 6, 1)) + +B.c = C; +>B.c : Symbol(B.c, Decl(declarationEmitExpandoFunction.ts, 13, 8)) +>B : Symbol(B, Decl(declarationEmitExpandoFunction.ts, 2, 1)) +>c : Symbol(B.c, Decl(declarationEmitExpandoFunction.ts, 13, 8)) +>C : Symbol(C, Decl(declarationEmitExpandoFunction.ts, 6, 1)) + diff --git a/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.types b/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.types new file mode 100644 index 00000000000..0e7b87870c8 --- /dev/null +++ b/testdata/baselines/reference/compiler/declarationEmitExpandoFunction.types @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/declarationEmitExpandoFunction.ts] //// + +=== declarationEmitExpandoFunction.ts === +export function A() { +>A : { (): string; a: typeof C; b: typeof C; } + + return 'A'; +>'A' : "A" +} + +export function B() { +>B : { (): string; c: typeof C; } + + return 'B'; +>'B' : "B" +} + +export enum C { +>C : C + + C +>C : C.C +} + +A.a = C; +>A.a = C : typeof C +>A.a : typeof C +>A : { (): string; a: typeof C; b: typeof C; } +>a : typeof C +>C : typeof C + +A.b = C; +>A.b = C : typeof C +>A.b : typeof C +>A : { (): string; a: typeof C; b: typeof C; } +>b : typeof C +>C : typeof C + +B.c = C; +>B.c = C : typeof C +>B.c : typeof C +>B : { (): string; c: typeof C; } +>c : typeof C +>C : typeof C + diff --git a/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types b/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types index afc238dd4cb..41f28f004c4 100644 --- a/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types +++ b/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types @@ -14,7 +14,7 @@ >A : A new A(); ->new A() : any +>new A() : A >A : typeof A new B(); diff --git a/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types.diff b/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types.diff new file mode 100644 index 00000000000..0b33e3aff5f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/abstractClassInLocalScopeIsAbstract.types.diff @@ -0,0 +1,11 @@ +--- old.abstractClassInLocalScopeIsAbstract.types ++++ new.abstractClassInLocalScopeIsAbstract.types +@@= skipped -13, +13 lines =@@ + >A : A + + new A(); +->new A() : any ++>new A() : A + >A : typeof A + + new B(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types b/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types index a96a8da61bb..efede2b107d 100644 --- a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types +++ b/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types @@ -2,13 +2,13 @@ === bar.d.ts === import * as foo from './foo' ->foo : Root +>foo : { default: Root; } export as namespace foo ->foo : Root +>foo : { default: Root; } export = foo; ->foo : Root +>foo : { default: Root; } declare global { >global : typeof global diff --git a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types.diff b/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types.diff deleted file mode 100644 index 130feaff3d3..00000000000 --- a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.crashDeclareGlobalTypeofExport.types -+++ new.crashDeclareGlobalTypeofExport.types -@@= skipped -1, +1 lines =@@ - - === bar.d.ts === - import * as foo from './foo' -->foo : { default: Root; } -+>foo : Root - - export as namespace foo -->foo : { default: Root; } -+>foo : Root - - export = foo; -->foo : { default: Root; } -+>foo : Root - - declare global { - >global : typeof global \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js b/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js index 345ebd102f2..9a3ef3a1462 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js @@ -82,14 +82,32 @@ C.B = B; export declare class Foo { } //// [index1.d.ts] -export default function Example(): void; +declare function Example(): void; +export default Example; +declare namespace Example { + var Foo: typeof import("./foo").Foo; +} //// [index2.d.ts] import { Foo } from './foo'; export { Foo }; -export default function Example(): void; +declare function Example(): void; +export default Example; +declare namespace Example { + var Foo: typeof import("./foo").Foo; +} //// [index3.d.ts] export declare class Bar { } -export default function Example(): void; +declare function Example(): void; +export default Example; +declare namespace Example { + var Bar: typeof import("./index3").Bar; +} //// [index4.d.ts] export declare function C(): any; +export declare namespace C { + var A: () => void; +} +export declare namespace C { + var B: () => void; +} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff index ff4abd456fe..552d88daf09 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitDefaultExportWithStaticAssignment.js.diff @@ -18,37 +18,38 @@ Object.defineProperty(exports, "Foo", { enumerable: true, get: function () { return foo_1.Foo; } }); function Example() { } Example.Foo = foo_1.Foo; -@@= skipped -31, +31 lines =@@ - export declare class Foo { +@@= skipped -32, +32 lines =@@ } //// [index1.d.ts] --declare function Example(): void; --declare namespace Example { -- var Foo: typeof import("./foo").Foo; --} + declare function Example(): void; ++export default Example; + declare namespace Example { + var Foo: typeof import("./foo").Foo; + } -export default Example; -+export default function Example(): void; //// [index2.d.ts] import { Foo } from './foo'; export { Foo }; --declare function Example(): void; --declare namespace Example { -- var Foo: typeof import("./foo").Foo; --} + declare function Example(): void; ++export default Example; + declare namespace Example { + var Foo: typeof import("./foo").Foo; + } -export default Example; -+export default function Example(): void; //// [index3.d.ts] export declare class Bar { } --declare function Example(): void; --declare namespace Example { -- var Bar: typeof import("./index3").Bar; --} + declare function Example(): void; ++export default Example; + declare namespace Example { + var Bar: typeof import("./index3").Bar; + } -export default Example; -+export default function Example(): void; //// [index4.d.ts] export declare function C(): any; --export declare namespace C { -- var A: () => void; -- var B: () => void; --} \ No newline at end of file + export declare namespace C { + var A: () => void; ++} ++export declare namespace C { + var B: () => void; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt new file mode 100644 index 00000000000..1ed386c351d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt @@ -0,0 +1,14 @@ +b.ts(4,1): error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"a"'. + + +==== a.ts (0 errors) ==== + interface I {} + export function f(): I { return null as I; } +==== b.ts (1 errors) ==== + import {f} from "./a"; + + export function q() {} + q.val = f(); + ~~~~~~~~~~~ +!!! error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"a"'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt.diff index fc2ba7171aa..e5704b00b0c 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.errors.txt.diff @@ -1,18 +1,10 @@ --- old.declarationEmitExpandoPropertyPrivateName.errors.txt +++ new.declarationEmitExpandoPropertyPrivateName.errors.txt -@@= skipped -0, +0 lines =@@ --b.ts(4,1): error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"a"'. -- -- --==== a.ts (0 errors) ==== -- interface I {} -- export function f(): I { return null as I; } --==== b.ts (1 errors) ==== -- import {f} from "./a"; -- -- export function q() {} -- q.val = f(); +@@= skipped -8, +8 lines =@@ + + export function q() {} + q.val = f(); - ~~~~~ --!!! error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"a"'. -- -+ \ No newline at end of file ++ ~~~~~~~~~~~ + !!! error TS4032: Property 'val' of exported interface has or is using name 'I' from private module '"a"'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js index 4b994cff3cc..62611a4b50a 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js @@ -31,3 +31,6 @@ export declare function f(): I; export {}; //// [b.d.ts] export declare function q(): void; +export declare namespace q { + var val: I; +} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff index e97c2407443..1a0346d4ab2 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoPropertyPrivateName.js.diff @@ -14,4 +14,7 @@ export declare function f(): I; export {}; +//// [b.d.ts] -+export declare function q(): void; \ No newline at end of file ++export declare function q(): void; ++export declare namespace q { ++ var val: I; ++} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js index 02c1beb29a7..cf2922f1107 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js @@ -36,8 +36,8 @@ export interface Rect

{ readonly a: p; readonly b: p; } -export declare const Point: { - (x: number, y: number): Point; - zero: () => Point; -}; +export declare function Point(x: number, y: number): Point; export declare const Rect:

(a: p, b: p) => Rect

; +export declare namespace Point { + var zero: () => Point; +} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js.diff index 6b591946c63..eca527388e9 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitExpandoWithGenericConstraint.js.diff @@ -1,10 +1,15 @@ --- old.declarationEmitExpandoWithGenericConstraint.js +++ new.declarationEmitExpandoWithGenericConstraint.js -@@= skipped -37, +37 lines =@@ +@@= skipped -35, +35 lines =@@ + readonly a: p; + readonly b: p; } - export declare const Point: { - (x: number, y: number): Point; +-export declare const Point: { +- (x: number, y: number): Point; - zero(): Point; -+ zero: () => Point; - }; - export declare const Rect:

(a: p, b: p) => Rect

; \ No newline at end of file +-}; ++export declare function Point(x: number, y: number): Point; + export declare const Rect:

(a: p, b: p) => Rect

; ++export declare namespace Point { ++ var zero: () => Point; ++} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js b/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js index f5ce29f90a5..0c8480ef02d 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js @@ -25,5 +25,22 @@ baz.normal = false; //// [declarationEmitFunctionKeywordProp.d.ts] declare function foo(): void; +declare namespace foo { + var _a: boolean; + export { _a as null }; +} declare function bar(): void; +declare namespace bar { + var async: boolean; +} +declare namespace bar { + var normal: boolean; +} declare function baz(): void; +declare namespace baz { + var _b: boolean; + export { _b as class }; +} +declare namespace baz { + var normal: boolean; +} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js.diff index 5628351b230..06133cdc842 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitFunctionKeywordProp.js.diff @@ -1,21 +1,21 @@ --- old.declarationEmitFunctionKeywordProp.js +++ new.declarationEmitFunctionKeywordProp.js -@@= skipped -24, +24 lines =@@ - - //// [declarationEmitFunctionKeywordProp.d.ts] - declare function foo(): void; --declare namespace foo { -- var _a: boolean; -- export { _a as null }; --} +@@= skipped -31, +31 lines =@@ declare function bar(): void; --declare namespace bar { -- var async: boolean; -- var normal: boolean; --} + declare namespace bar { + var async: boolean; ++} ++declare namespace bar { + var normal: boolean; + } declare function baz(): void; --declare namespace baz { + declare namespace baz { - var _a: boolean; - export var normal: boolean; - export { _a as class }; --} \ No newline at end of file ++ var _b: boolean; ++ export { _b as class }; ++} ++declare namespace baz { ++ var normal: boolean; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js index fc844a9af66..9d36f2464b7 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js @@ -36,3 +36,9 @@ const a = foo[dashStrMem]; //// [declarationEmitLateBoundAssignments.d.ts] export declare function foo(): void; +export declare namespace foo { + var bar: number; +} +export declare namespace foo { + var strMemName: string; +} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js.diff index 9b5edc4ae8b..e6fc1de8ea4 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments.js.diff @@ -1,10 +1,10 @@ --- old.declarationEmitLateBoundAssignments.js +++ new.declarationEmitLateBoundAssignments.js -@@= skipped -35, +35 lines =@@ - - //// [declarationEmitLateBoundAssignments.d.ts] +@@= skipped -37, +37 lines =@@ export declare function foo(): void; --export declare namespace foo { -- var bar: number; -- var strMemName: string; --} \ No newline at end of file + export declare namespace foo { + var bar: number; ++} ++export declare namespace foo { + var strMemName: string; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js index dbace19f242..370aaf1b304 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js @@ -121,7 +121,13 @@ arrow10[emoji] = 0; //// [declarationEmitLateBoundAssignments2.d.ts] export declare function decl(): void; +export declare namespace decl { + var B: string; +} export declare function decl2(): void; +export declare namespace decl2 { + var C: number; +} export declare function decl3(): void; export declare function decl4(): void; export declare function decl5(): void; @@ -130,14 +136,14 @@ export declare function decl7(): void; export declare function decl8(): void; export declare function decl9(): void; export declare function decl10(): void; -export declare const arrow: { - (): void; - B: string; -}; -export declare const arrow2: { - (): void; - C: number; -}; +export declare function arrow(): void; +export declare namespace arrow { + var B: string; +} +export declare function arrow2(): void; +export declare namespace arrow2 { + var C: number; +} export declare const arrow3: { (): void; 77: number; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js.diff index 7b63352120d..d2275bb5562 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundAssignments2.js.diff @@ -1,16 +1,8 @@ --- old.declarationEmitLateBoundAssignments2.js +++ new.declarationEmitLateBoundAssignments2.js -@@= skipped -120, +120 lines =@@ - - //// [declarationEmitLateBoundAssignments2.d.ts] - export declare function decl(): void; --export declare namespace decl { -- var B: string; --} - export declare function decl2(): void; --export declare namespace decl2 { -- var C: number; --} +@@= skipped -128, +128 lines =@@ + var C: number; + } export declare function decl3(): void; -export declare namespace decl3 { } export declare function decl4(): void; @@ -27,6 +19,22 @@ -export declare namespace decl9 { } export declare function decl10(): void; -export declare namespace decl10 { } - export declare const arrow: { +-export declare const arrow: { +- (): void; +- B: string; +-}; +-export declare const arrow2: { +- (): void; +- C: number; +-}; ++export declare function arrow(): void; ++export declare namespace arrow { ++ var B: string; ++} ++export declare function arrow2(): void; ++export declare namespace arrow2 { ++ var C: number; ++} + export declare const arrow3: { (): void; - B: string; \ No newline at end of file + 77: number; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js index b3e5b3073c5..c8070974330 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js @@ -26,3 +26,9 @@ const a = foo[dashStrMem]; //// [file.d.ts] export declare function foo(): void; +export declare namespace foo { + var bar: number; +} +export declare namespace foo { + var strMemName: string; +} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js.diff index 62c383b58d4..3f66ad50ff1 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitLateBoundJSAssignments.js.diff @@ -8,5 +8,10 @@ -export namespace foo { - let bar: number; - let strMemName: string; --} -+export declare function foo(): void; \ No newline at end of file ++export declare function foo(): void; ++export declare namespace foo { ++ var bar: number; ++} ++export declare namespace foo { ++ var strMemName: string; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols index ec3445c3ef9..3469ef64407 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols @@ -19,12 +19,12 @@ import a from "./a"; >a : Symbol(a, Decl(b.ts, 0, 6)) import { default as b } from "./a"; ->default : Symbol(self.default, Decl(a.ts, 0, 30)) +>default : Symbol(mod, Decl(a.ts, 0, 30)) >b : Symbol(b, Decl(b.ts, 1, 8)) import c, { default as d } from "./a"; >c : Symbol(c, Decl(b.ts, 2, 6)) ->default : Symbol(self.default, Decl(a.ts, 0, 30)) +>default : Symbol(mod, Decl(a.ts, 0, 30)) >d : Symbol(d, Decl(b.ts, 2, 11)) import * as self from "./b"; @@ -34,7 +34,7 @@ export { default } from "./a"; >default : Symbol(self.default, Decl(b.ts, 4, 8)) export { default as def } from "./a"; ->default : Symbol(self.default, Decl(a.ts, 0, 30)) +>default : Symbol(mod, Decl(a.ts, 0, 30)) >def : Symbol(self.def, Decl(b.ts, 5, 8)) a === b; diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols.diff deleted file mode 100644 index a021aeed2ce..00000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.esModuleInteropDefaultImports.symbols -+++ new.esModuleInteropDefaultImports.symbols -@@= skipped -18, +18 lines =@@ - >a : Symbol(a, Decl(b.ts, 0, 6)) - - import { default as b } from "./a"; -->default : Symbol(mod, Decl(a.ts, 0, 30)) -+>default : Symbol(self.default, Decl(a.ts, 0, 30)) - >b : Symbol(b, Decl(b.ts, 1, 8)) - - import c, { default as d } from "./a"; - >c : Symbol(c, Decl(b.ts, 2, 6)) -->default : Symbol(mod, Decl(a.ts, 0, 30)) -+>default : Symbol(self.default, Decl(a.ts, 0, 30)) - >d : Symbol(d, Decl(b.ts, 2, 11)) - - import * as self from "./b"; -@@= skipped -15, +15 lines =@@ - >default : Symbol(self.default, Decl(b.ts, 4, 8)) - - export { default as def } from "./a"; -->default : Symbol(mod, Decl(a.ts, 0, 30)) -+>default : Symbol(self.default, Decl(a.ts, 0, 30)) - >def : Symbol(self.def, Decl(b.ts, 5, 8)) - - a === b; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt deleted file mode 100644 index 5bcfcacb5b8..00000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -index.ts(2,5): error TS2339: Property 'default' does not exist on type '() => void'. - - -==== foo.d.ts (0 errors) ==== - declare function foo(): void; - declare namespace foo {} - export = foo; - -==== index.ts (1 errors) ==== - import * as foo from "./foo"; - foo.default; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt.diff deleted file mode 100644 index 287ec5a608e..00000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.esModuleInteropImportNamespace.errors.txt -+++ new.esModuleInteropImportNamespace.errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(2,5): error TS2339: Property 'default' does not exist on type '() => void'. -+ -+ -+==== foo.d.ts (0 errors) ==== -+ declare function foo(): void; -+ declare namespace foo {} -+ export = foo; -+ -+==== index.ts (1 errors) ==== -+ import * as foo from "./foo"; -+ foo.default; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols index e9ce7e39f1a..1f8d1afb2d1 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols @@ -15,5 +15,7 @@ import * as foo from "./foo"; >foo : Symbol(foo, Decl(index.ts, 0, 6)) foo.default; +>foo.default : Symbol(default) >foo : Symbol(foo, Decl(index.ts, 0, 6)) +>default : Symbol(default) diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols.diff deleted file mode 100644 index b2c12e00470..00000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.esModuleInteropImportNamespace.symbols -+++ new.esModuleInteropImportNamespace.symbols -@@= skipped -14, +14 lines =@@ - >foo : Symbol(foo, Decl(index.ts, 0, 6)) - - foo.default; -->foo.default : Symbol(default) - >foo : Symbol(foo, Decl(index.ts, 0, 6)) -->default : Symbol(default) diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types index d2c7c1140be..db0f209bc66 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types @@ -10,10 +10,10 @@ export = foo; === index.ts === import * as foo from "./foo"; ->foo : () => void +>foo : { default: () => void; } foo.default; ->foo.default : any ->foo : () => void ->default : any +>foo.default : () => void +>foo : { default: () => void; } +>default : () => void diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types.diff deleted file mode 100644 index 104c7f2bc2b..00000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.esModuleInteropImportNamespace.types -+++ new.esModuleInteropImportNamespace.types -@@= skipped -9, +9 lines =@@ - - === index.ts === - import * as foo from "./foo"; -->foo : { default: () => void; } -+>foo : () => void - - foo.default; -->foo.default : () => void -->foo : { default: () => void; } -->default : () => void -+>foo.default : any -+>foo : () => void -+>default : any diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt new file mode 100644 index 00000000000..0fb5881599c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt @@ -0,0 +1,26 @@ +index.ts:3:8 - error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. + Type '{ default: () => void; }' provides no match for the signature '(): void'. + +3 invoke(foo); +   ~~~ + + index.ts:1:1 - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. + 1 import * as foo from "./foo"; +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +==== foo.d.ts (0 errors) ==== + declare function foo(): void; + declare namespace foo {} + export = foo; +==== index.ts (1 errors) ==== + import * as foo from "./foo"; + function invoke(f: () => void) { f(); } + invoke(foo); + ~~~ +!!! error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. +!!! error TS2345: Type '{ default: () => void; }' provides no match for the signature '(): void'. +!!! related TS7038 index.ts:1:1: Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. + +Found 1 error in index.ts:3 + diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff index 5b962e5fbed..77b601d0673 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff @@ -1,31 +1,14 @@ --- old.esModuleInteropPrettyErrorRelatedInformation.errors.txt +++ new.esModuleInteropPrettyErrorRelatedInformation.errors.txt -@@= skipped -0, +0 lines =@@ --index.ts:3:8 - error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. -- Type '{ default: () => void; }' provides no match for the signature '(): void'. -- --3 invoke(foo); --   ~~~ -- +@@= skipped -3, +3 lines =@@ + 3 invoke(foo); +    ~~~ + - index.ts:1:1 -- 1 import * as foo from "./foo"; --   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++ index.ts:1:1 - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. + 1 import * as foo from "./foo"; +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. -- -- --==== foo.d.ts (0 errors) ==== -- declare function foo(): void; -- declare namespace foo {} -- export = foo; --==== index.ts (1 errors) ==== -- import * as foo from "./foo"; -- function invoke(f: () => void) { f(); } -- invoke(foo); -- ~~~ --!!! error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. --!!! error TS2345: Type '{ default: () => void; }' provides no match for the signature '(): void'. --!!! related TS7038 index.ts:1:1: Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. -- --Found 1 error in index.ts:3 -- -+ \ No newline at end of file + + + ==== foo.d.ts (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types index a26e74be286..4ea79b5cfaf 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types @@ -10,7 +10,7 @@ export = foo; === index.ts === import * as foo from "./foo"; ->foo : () => void +>foo : { default: () => void; } function invoke(f: () => void) { f(); } >invoke : (f: () => void) => void @@ -21,5 +21,5 @@ function invoke(f: () => void) { f(); } invoke(foo); >invoke(foo) : void >invoke : (f: () => void) => void ->foo : () => void +>foo : { default: () => void; } diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types.diff deleted file mode 100644 index 81a06b9aedb..00000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.esModuleInteropPrettyErrorRelatedInformation.types -+++ new.esModuleInteropPrettyErrorRelatedInformation.types -@@= skipped -9, +9 lines =@@ - - === index.ts === - import * as foo from "./foo"; -->foo : { default: () => void; } -+>foo : () => void - - function invoke(f: () => void) { f(); } - >invoke : (f: () => void) => void -@@= skipped -11, +11 lines =@@ - invoke(foo); - >invoke(foo) : void - >invoke : (f: () => void) => void -->foo : { default: () => void; } -+>foo : () => void diff --git a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types index c7a44d4cb4e..c908965ecb8 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types +++ b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types @@ -19,15 +19,15 @@ declare namespace modObj { } === idx.ts === import * as mod from "./mod"; ->mod : mod.A & mod.B +>mod : { a: string; b: string; default: mod.A & mod.B; } mod.a; >mod.a : string ->mod : mod.A & mod.B +>mod : { a: string; b: string; default: mod.A & mod.B; } >a : string mod.b; >mod.b : string ->mod : mod.A & mod.B +>mod : { a: string; b: string; default: mod.A & mod.B; } >b : string diff --git a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff index 5baf024ae07..7b6f1d59de7 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff +++ b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff @@ -12,22 +12,3 @@ +>modObj : import("mod").A & import("mod").B >modObj : any >modObj : any - -@@= skipped -17, +17 lines =@@ - } - === idx.ts === - import * as mod from "./mod"; -->mod : { a: string; b: string; default: mod.A & mod.B; } -+>mod : mod.A & mod.B - - mod.a; - >mod.a : string -->mod : { a: string; b: string; default: mod.A & mod.B; } -+>mod : mod.A & mod.B - >a : string - - mod.b; - >mod.b : string -->mod : { a: string; b: string; default: mod.A & mod.B; } -+>mod : mod.A & mod.B - >b : string diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js b/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js index a5f9b593d55..1b378912059 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js @@ -45,3 +45,6 @@ if (Math.random()) { //// [expandoFunctionBlockShadowing.d.ts] export declare function X(): void; export declare function Y(): void; +export declare namespace Y { + var test: string; +} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js.diff index fa0b90a7ec1..ad675825bb6 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionBlockShadowing.js.diff @@ -11,11 +11,4 @@ +// https://github.com/microsoft/TypeScript/issues/56538 function X() { } if (Math.random()) { - const X = {}; -@@= skipped -23, +23 lines =@@ - //// [expandoFunctionBlockShadowing.d.ts] - export declare function X(): void; - export declare function Y(): void; --export declare namespace Y { -- var test: string; --} \ No newline at end of file + const X = {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js b/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js index 984cc063336..054a90b860f 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js @@ -27,11 +27,11 @@ exports.expr2[s] = 0; //// [expandoFunctionExpressionsWithDynamicNames.d.ts] -export declare const expr: { - (): void; - X: number; -}; -export declare const expr2: { - (): void; - X: number; -}; +export declare function expr(): void; +export declare namespace expr { + var X: number; +} +export declare function expr2(): void; +export declare namespace expr2 { + var X: number; +} diff --git a/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js.diff b/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js.diff index 91ce438dddb..df20fd2068f 100644 --- a/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js.diff +++ b/testdata/baselines/reference/submodule/compiler/expandoFunctionExpressionsWithDynamicNames.js.diff @@ -10,4 +10,24 @@ +// https://github.com/microsoft/TypeScript/issues/54809 const s = "X"; const expr = () => { }; - exports.expr = expr; \ No newline at end of file + exports.expr = expr; +@@= skipped -13, +13 lines =@@ + + + //// [expandoFunctionExpressionsWithDynamicNames.d.ts] +-export declare const expr: { +- (): void; +- X: number; +-}; +-export declare const expr2: { +- (): void; +- X: number; +-}; ++export declare function expr(): void; ++export declare namespace expr { ++ var X: number; ++} ++export declare function expr2(): void; ++export declare namespace expr2 { ++ var X: number; ++} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt index 27620864d5e..4d54d16ef5d 100644 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt @@ -1,4 +1,4 @@ -/index.ts(7,7): error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. +/index.ts(7,7): error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. Types of property 'configs' are incompatible. Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. Property ''stage-0'' is incompatible with index signature. @@ -43,7 +43,7 @@ const p: Plugin = pluginImportX; ~ -!!! error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. +!!! error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. !!! error TS2322: Types of property 'configs' are incompatible. !!! error TS2322: Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. !!! error TS2322: Property ''stage-0'' is incompatible with index signature. diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff index 75c6c458354..aa4d5bb0b8b 100644 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff @@ -2,7 +2,7 @@ +++ new.exportAssignmentExpressionIsExpressionNode.errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(7,7): error TS2322: Type '{ default: { configs: { 'stage-0': PluginConfig; }; }; configs: { 'stage-0': PluginConfig; }; }' is not assignable to type 'Plugin'. -+/index.ts(7,7): error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. ++/index.ts(7,7): error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. Types of property 'configs' are incompatible. - Type '{ 'stage-0': PluginConfig; }' is not assignable to type 'Record'. + Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. @@ -14,7 +14,7 @@ const p: Plugin = pluginImportX; ~ -!!! error TS2322: Type '{ default: { configs: { 'stage-0': PluginConfig; }; }; configs: { 'stage-0': PluginConfig; }; }' is not assignable to type 'Plugin'. -+!!! error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. ++!!! error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. !!! error TS2322: Types of property 'configs' are incompatible. -!!! error TS2322: Type '{ 'stage-0': PluginConfig; }' is not assignable to type 'Record'. +!!! error TS2322: Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. diff --git a/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types b/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types index bbceb8c94b0..303a9ff827c 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types +++ b/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types @@ -80,7 +80,7 @@ type Result1 = ComponentProps; // that could be incorrectly reused by this one type Result2 = Test<{ component: typeof ComponentWithForwardRef }>; // no `T` leak ->Result2 : PropsWithoutRef> & { ref?: Ref | undefined; } +>Result2 : Omit & { ref?: Ref | undefined; } >component : >(props: PropsWithoutRef> & { ref?: Ref | undefined; }) => unknown >ComponentWithForwardRef : >(props: PropsWithoutRef> & { ref?: Ref | undefined; }) => unknown diff --git a/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types.diff b/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types.diff index ba4ea891647..d581065c3c3 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/genericCallInferenceInConditionalTypes1.types.diff @@ -29,14 +29,7 @@ props: ComponentPropsWithoutRef, >props : PropsWithoutRef> -@@= skipped -38, +38 lines =@@ - - // that could be incorrectly reused by this one - type Result2 = Test<{ component: typeof ComponentWithForwardRef }>; // no `T` leak -->Result2 : Omit & { ref?: Ref | undefined; } -+>Result2 : PropsWithoutRef> & { ref?: Ref | undefined; } - >component : >(props: PropsWithoutRef> & { ref?: Ref | undefined; }) => unknown - >ComponentWithForwardRef : >(props: PropsWithoutRef> & { ref?: Ref | undefined; }) => unknown +@@= skipped -44, +44 lines =@@ // same as ComponentWithForwardRef above but using a resolved signature instead of a direct inferred result of `forwardRef` declare const ComponentWithForwardRef2: >( @@ -49,7 +42,7 @@ className?: string; >className : string | undefined -@@= skipped -25, +25 lines =@@ +@@= skipped -19, +19 lines =@@ ) => unknown; type Result3 = ComponentProps; diff --git a/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types b/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types index ba58eb67872..11ebc59664f 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types +++ b/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types @@ -96,25 +96,25 @@ const added3 = addedSome3({ c: true }); >true : true const addP3_other = withP3({ foo: 'bar' }); ->addP3_other : (from: I) => (from2: I2) => I & I2 & { a: number; } ->withP3({ foo: 'bar' }) : (from: I) => (from2: I2) => I & I2 & { a: number; } +>addP3_other : (from: I) => (from2: I2) => I & I2 & { foo: string; } +>withP3({ foo: 'bar' }) : (from: I) => (from2: I2) => I & I2 & { foo: string; } >withP3 :

(p: P) => (from: I) => (from2: I2) => I & I2 & P >{ foo: 'bar' } : { foo: string; } >foo : string >'bar' : "bar" const addedSome3_other = addP3_other({ qwerty: 123 }); ->addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { a: number; } ->addP3_other({ qwerty: 123 }) : (from2: I2) => { qwerty: number; } & I2 & { a: number; } ->addP3_other : (from: I) => (from2: I2) => I & I2 & { a: number; } +>addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { foo: string; } +>addP3_other({ qwerty: 123 }) : (from2: I2) => { qwerty: number; } & I2 & { foo: string; } +>addP3_other : (from: I) => (from2: I2) => I & I2 & { foo: string; } >{ qwerty: 123 } : { qwerty: number; } >qwerty : number >123 : 123 const added3_other = addedSome3_other({ bazinga: true }); ->added3_other : { qwerty: number; } & { bazinga: boolean; } & { a: number; } ->addedSome3_other({ bazinga: true }) : { qwerty: number; } & { bazinga: boolean; } & { a: number; } ->addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { a: number; } +>added3_other : { qwerty: number; } & { bazinga: boolean; } & { foo: string; } +>addedSome3_other({ bazinga: true }) : { qwerty: number; } & { bazinga: boolean; } & { foo: string; } +>addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { foo: string; } >{ bazinga: true } : { bazinga: true; } >bazinga : true >true : true diff --git a/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types.diff b/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types.diff deleted file mode 100644 index 1bd90ecba2a..00000000000 --- a/testdata/baselines/reference/submodule/compiler/genericCallInferenceWithGenericLocalFunction.types.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.genericCallInferenceWithGenericLocalFunction.types -+++ new.genericCallInferenceWithGenericLocalFunction.types -@@= skipped -95, +95 lines =@@ - >true : true - - const addP3_other = withP3({ foo: 'bar' }); -->addP3_other : (from: I) => (from2: I2) => I & I2 & { foo: string; } -->withP3({ foo: 'bar' }) : (from: I) => (from2: I2) => I & I2 & { foo: string; } -+>addP3_other : (from: I) => (from2: I2) => I & I2 & { a: number; } -+>withP3({ foo: 'bar' }) : (from: I) => (from2: I2) => I & I2 & { a: number; } - >withP3 :

(p: P) => (from: I) => (from2: I2) => I & I2 & P - >{ foo: 'bar' } : { foo: string; } - >foo : string - >'bar' : "bar" - - const addedSome3_other = addP3_other({ qwerty: 123 }); -->addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { foo: string; } -->addP3_other({ qwerty: 123 }) : (from2: I2) => { qwerty: number; } & I2 & { foo: string; } -->addP3_other : (from: I) => (from2: I2) => I & I2 & { foo: string; } -+>addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { a: number; } -+>addP3_other({ qwerty: 123 }) : (from2: I2) => { qwerty: number; } & I2 & { a: number; } -+>addP3_other : (from: I) => (from2: I2) => I & I2 & { a: number; } - >{ qwerty: 123 } : { qwerty: number; } - >qwerty : number - >123 : 123 - - const added3_other = addedSome3_other({ bazinga: true }); -->added3_other : { qwerty: number; } & { bazinga: boolean; } & { foo: string; } -->addedSome3_other({ bazinga: true }) : { qwerty: number; } & { bazinga: boolean; } & { foo: string; } -->addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { foo: string; } -+>added3_other : { qwerty: number; } & { bazinga: boolean; } & { a: number; } -+>addedSome3_other({ bazinga: true }) : { qwerty: number; } & { bazinga: boolean; } & { a: number; } -+>addedSome3_other : (from2: I2) => { qwerty: number; } & I2 & { a: number; } - >{ bazinga: true } : { bazinga: true; } - >bazinga : true - >true : true \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.errors.txt b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.errors.txt new file mode 100644 index 00000000000..6103c38d6d7 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.errors.txt @@ -0,0 +1,14 @@ +inferenceFromGenericClassNoCrash1.ts(5,3): error TS2564: Property 't' has no initializer and is not definitely assigned in the constructor. + + +==== inferenceFromGenericClassNoCrash1.ts (1 errors) ==== + // https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576 + + function RenderFlagsMixin object>(Base?: T) {} + class Container { + t: T; + ~ +!!! error TS2564: Property 't' has no initializer and is not definitely assigned in the constructor. + } + RenderFlagsMixin(Container); + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.symbols b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.symbols new file mode 100644 index 00000000000..aa8dca0a912 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.symbols @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/inferenceFromGenericClassNoCrash1.ts] //// + +=== inferenceFromGenericClassNoCrash1.ts === +// https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576 + +function RenderFlagsMixin object>(Base?: T) {} +>RenderFlagsMixin : Symbol(RenderFlagsMixin, Decl(inferenceFromGenericClassNoCrash1.ts, 0, 0)) +>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 26)) +>args : Symbol(args, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 41)) +>Base : Symbol(Base, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 68)) +>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 26)) + +class Container { +>Container : Symbol(Container, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 80)) +>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 3, 16)) + + t: T; +>t : Symbol(Container.t, Decl(inferenceFromGenericClassNoCrash1.ts, 3, 20)) +>T : Symbol(T, Decl(inferenceFromGenericClassNoCrash1.ts, 3, 16)) +} +RenderFlagsMixin(Container); +>RenderFlagsMixin : Symbol(RenderFlagsMixin, Decl(inferenceFromGenericClassNoCrash1.ts, 0, 0)) +>Container : Symbol(Container, Decl(inferenceFromGenericClassNoCrash1.ts, 2, 80)) + diff --git a/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.types b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.types new file mode 100644 index 00000000000..1db355347a6 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.types @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/inferenceFromGenericClassNoCrash1.ts] //// + +=== inferenceFromGenericClassNoCrash1.ts === +// https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576 + +function RenderFlagsMixin object>(Base?: T) {} +>RenderFlagsMixin : object>(Base?: T | undefined) => void +>args : any[] +>Base : T | undefined + +class Container { +>Container : Container + + t: T; +>t : T +} +RenderFlagsMixin(Container); +>RenderFlagsMixin(Container) : void +>RenderFlagsMixin : object>(Base?: T | undefined) => void +>Container : typeof Container + diff --git a/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.types.diff b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.types.diff new file mode 100644 index 00000000000..5ac0241f8ce --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/inferenceFromGenericClassNoCrash1.types.diff @@ -0,0 +1,18 @@ +--- old.inferenceFromGenericClassNoCrash1.types ++++ new.inferenceFromGenericClassNoCrash1.types +@@= skipped -3, +3 lines =@@ + // https://github.com/microsoft/TypeScript/issues/61633#issuecomment-2841778576 + + function RenderFlagsMixin object>(Base?: T) {} +->RenderFlagsMixin : object>(Base?: T) => void ++>RenderFlagsMixin : object>(Base?: T | undefined) => void + >args : any[] + >Base : T | undefined + +@@= skipped -12, +12 lines =@@ + } + RenderFlagsMixin(Container); + >RenderFlagsMixin(Container) : void +->RenderFlagsMixin : object>(Base?: T) => void ++>RenderFlagsMixin : object>(Base?: T | undefined) => void + >Container : typeof Container diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js index 8f211bd2371..6616dff4937 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js @@ -22,11 +22,14 @@ errorOnMissingReturn.a = ""; //// [isolatedDeclarationErrors.d.ts] declare function errorOnAssignmentBelowDecl(): void; -declare const errorOnAssignmentBelow: { - (): void; - a: string; -}; -declare const errorOnMissingReturn: { - (): void; - a: string; -}; +declare namespace errorOnAssignmentBelowDecl { + var a: string; +} +declare function errorOnAssignmentBelow(): void; +declare namespace errorOnAssignmentBelow { + var a: string; +} +declare function errorOnMissingReturn(): void; +declare namespace errorOnMissingReturn { + var a: string; +} diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js.diff index a2e2b81506f..47bb029ded5 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js.diff +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrors.js.diff @@ -8,11 +8,14 @@ + +//// [isolatedDeclarationErrors.d.ts] +declare function errorOnAssignmentBelowDecl(): void; -+declare const errorOnAssignmentBelow: { -+ (): void; -+ a: string; -+}; -+declare const errorOnMissingReturn: { -+ (): void; -+ a: string; -+}; \ No newline at end of file ++declare namespace errorOnAssignmentBelowDecl { ++ var a: string; ++} ++declare function errorOnAssignmentBelow(): void; ++declare namespace errorOnAssignmentBelow { ++ var a: string; ++} ++declare function errorOnMissingReturn(): void; ++declare namespace errorOnMissingReturn { ++ var a: string; ++} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js index 52f0d4f7c57..32cbc8903c2 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js @@ -25,3 +25,24 @@ foo.length = 10; //// [isolatedDeclarationErrorsExpandoFunctions.d.ts] export declare function foo(): void; +export declare namespace foo { + var apply: () => void; +} +export declare namespace foo { + var call: () => void; +} +export declare namespace foo { + var bind: () => void; +} +export declare namespace foo { + var caller: () => void; +} +export declare namespace foo { + var toString: () => void; +} +export declare namespace foo { + var length: number; +} +export declare namespace foo { + var length: number; +} diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js.diff index ea6e1338aac..158cd2ae6c4 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js.diff +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpandoFunctions.js.diff @@ -7,4 +7,25 @@ + + +//// [isolatedDeclarationErrorsExpandoFunctions.d.ts] -+export declare function foo(): void; \ No newline at end of file ++export declare function foo(): void; ++export declare namespace foo { ++ var apply: () => void; ++} ++export declare namespace foo { ++ var call: () => void; ++} ++export declare namespace foo { ++ var bind: () => void; ++} ++export declare namespace foo { ++ var caller: () => void; ++} ++export declare namespace foo { ++ var toString: () => void; ++} ++export declare namespace foo { ++ var length: number; ++} ++export declare namespace foo { ++ var length: number; ++} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js index 9d4cfaead5d..8e4843d111e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js @@ -19,11 +19,11 @@ SomeConstructor3.staticMember = "str"; //// [file.d.ts] declare const SomeConstructor: () => void; -declare const SomeConstructor2: { - (): void; - staticMember: string; -}; -declare const SomeConstructor3: { - (): void; - staticMember: string; -}; +declare function SomeConstructor2(): void; +declare namespace SomeConstructor2 { + var staticMember: string; +} +declare function SomeConstructor3(): void; +declare namespace SomeConstructor3 { + var staticMember: string; +} diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js.diff index 171c3332a5b..d115dfd622f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunction.js.diff @@ -8,24 +8,18 @@ -declare class SomeConstructor { - x: number; -} --declare function SomeConstructor2(): void; --declare namespace SomeConstructor2 { ++declare const SomeConstructor: () => void; + declare function SomeConstructor2(): void; + declare namespace SomeConstructor2 { - let staticMember: string; --} --declare function SomeConstructor3(): void; --declare namespace SomeConstructor3 { ++ var staticMember: string; + } + declare function SomeConstructor3(): void; + declare namespace SomeConstructor3 { - let staticMember_1: string; - export { staticMember_1 as staticMember }; -} -declare class SomeConstructor3 { - x: number; --} -+declare const SomeConstructor: () => void; -+declare const SomeConstructor2: { -+ (): void; -+ staticMember: string; -+}; -+declare const SomeConstructor3: { -+ (): void; -+ staticMember: string; -+}; \ No newline at end of file ++ var staticMember: string; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js index b4b7986cec3..4b6b9263382 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js @@ -25,15 +25,15 @@ SelfReference.staticMember = "str"; //// [file.d.ts] declare const SomeConstructor: () => void; -declare const SomeConstructor2: { - (): void; - staticMember: string; -}; -declare const SomeConstructor3: { - (): void; - staticMember: string; -}; -declare const SelfReference: { - (): any; - staticMember: string; -}; +declare function SomeConstructor2(): void; +declare namespace SomeConstructor2 { + var staticMember: string; +} +declare function SomeConstructor3(): void; +declare namespace SomeConstructor3 { + var staticMember: string; +} +declare function SelfReference(): any; +declare namespace SelfReference { + var staticMember: string; +} diff --git a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js.diff b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js.diff index 3b57bcf92d8..74d665cceee 100644 --- a/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsDeclarationsGlobalFileConstFunctionNamed.js.diff @@ -8,12 +8,14 @@ -declare class SomeConstructor { - x: number; -} --declare function SomeConstructor2(): void; --declare namespace SomeConstructor2 { ++declare const SomeConstructor: () => void; + declare function SomeConstructor2(): void; + declare namespace SomeConstructor2 { - let staticMember: string; --} --declare function SomeConstructor3(): void; --declare namespace SomeConstructor3 { ++ var staticMember: string; + } + declare function SomeConstructor3(): void; + declare namespace SomeConstructor3 { - let staticMember_1: string; - export { staticMember_1 as staticMember }; -} @@ -21,23 +23,14 @@ - x: number; -} -declare function SelfReference(): SelfReference; --declare namespace SelfReference { ++ var staticMember: string; ++} ++declare function SelfReference(): any; + declare namespace SelfReference { - let staticMember_2: string; - export { staticMember_2 as staticMember }; -} -declare class SelfReference { - x: number; --} -+declare const SomeConstructor: () => void; -+declare const SomeConstructor2: { -+ (): void; -+ staticMember: string; -+}; -+declare const SomeConstructor3: { -+ (): void; -+ staticMember: string; -+}; -+declare const SelfReference: { -+ (): any; -+ staticMember: string; -+}; \ No newline at end of file ++ var staticMember: string; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js b/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js index d3a96f6c160..cede538469c 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js +++ b/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js @@ -26,7 +26,18 @@ export default Foo; //// [jsxDeclarationsWithEsModuleInteropNoCrash.d.ts] /// +import PropTypes from 'prop-types'; declare function Foo({ bar }: { bar: any; }): JSX.Element; +declare namespace Foo { + var propTypes: { + bar: PropTypes.Requireable; + }; +} +declare namespace Foo { + var defaultProps: { + bar: boolean; + }; +} export default Foo; diff --git a/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js.diff b/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js.diff index 1b8d5ca4394..282833a6e00 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxDeclarationsWithEsModuleInteropNoCrash.js.diff @@ -5,10 +5,11 @@ //// [jsxDeclarationsWithEsModuleInteropNoCrash.d.ts] /// -export default Foo; ++import PropTypes from 'prop-types'; declare function Foo({ bar }: { bar: any; }): JSX.Element; --declare namespace Foo { + declare namespace Foo { - export { propTypes }; - export { defaultProps }; -} @@ -20,4 +21,13 @@ - export { bar_1 as bar }; -} -import PropTypes from 'prop-types'; ++ var propTypes: { ++ bar: PropTypes.Requireable; ++ }; ++} ++declare namespace Foo { ++ var defaultProps: { ++ bar: boolean; ++ }; ++} +export default Foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js b/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js index 328d1a72eaf..05ce6daa8c1 100644 --- a/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js +++ b/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js @@ -19,3 +19,6 @@ const x = foo[_private]; //// [index.d.ts] export declare function foo(): void; +export declare namespace foo { + var bar: number; +} diff --git a/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js.diff b/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js.diff deleted file mode 100644 index 9b1699fd257..00000000000 --- a/testdata/baselines/reference/submodule/compiler/lateBoundFunctionMemberAssignmentDeclarations.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.lateBoundFunctionMemberAssignmentDeclarations.js -+++ new.lateBoundFunctionMemberAssignmentDeclarations.js -@@= skipped -18, +18 lines =@@ - - //// [index.d.ts] - export declare function foo(): void; --export declare namespace foo { -- var bar: number; --} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types index 2a05f428bbb..9832a96f5a5 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types +++ b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types @@ -4,7 +4,7 @@ /// import moment = require("moment-timezone"); ->moment : () => moment.Moment +>moment : { default: () => moment.Moment; } === node_modules/moment/index.d.ts === declare function moment(): moment.Moment; @@ -22,10 +22,10 @@ export = moment; === node_modules/moment-timezone/index.d.ts === import * as moment from 'moment'; ->moment : () => moment.Moment +>moment : { default: () => moment.Moment; } export = moment; ->moment : () => moment.Moment +>moment : { default: () => moment.Moment; } declare module "moment" { >"moment" : () => Moment diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff index ce8a9e3a79d..20fc62626db 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff @@ -1,11 +1,6 @@ --- old.moduleAugmentationDuringSyntheticDefaultCheck.types +++ new.moduleAugmentationDuringSyntheticDefaultCheck.types -@@= skipped -3, +3 lines =@@ - /// - - import moment = require("moment-timezone"); -->moment : { default: () => moment.Moment; } -+>moment : () => moment.Moment +@@= skipped -7, +7 lines =@@ === node_modules/moment/index.d.ts === declare function moment(): moment.Moment; @@ -14,7 +9,7 @@ >moment : any declare namespace moment { -@@= skipped -14, +14 lines =@@ +@@= skipped -10, +10 lines =@@ } } export = moment; @@ -23,15 +18,6 @@ === node_modules/moment-timezone/index.d.ts === import * as moment from 'moment'; -->moment : { default: () => moment.Moment; } -+>moment : () => moment.Moment - - export = moment; -->moment : { default: () => moment.Moment; } -+>moment : () => moment.Moment - - declare module "moment" { - >"moment" : () => Moment @@= skipped -15, +15 lines =@@ interface Moment { tz(): string; diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types b/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types index 3e5fab7c23d..5d979796093 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types +++ b/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types @@ -2,22 +2,22 @@ === index.mts === import * as exportAny from "./exportAny.cjs"; ->exportAny : any +>exportAny : { default: any; } import * as exportUnknown from "./exportUnknown.cjs"; ->exportUnknown : unknown +>exportUnknown : { default: unknown; } import * as exportSymbol from "./exportSymbol.cjs"; ->exportSymbol : symbol +>exportSymbol : { default: symbol; } import type * as exportAnyType from "./exportAny.cjs"; ->exportAnyType : any +>exportAnyType : { default: any; } import type * as exportUnknownType from "./exportUnknown.cjs"; ->exportUnknownType : unknown +>exportUnknownType : { default: unknown; } import type * as exportSymbolType from "./exportSymbol.cjs"; ->exportSymbolType : symbol +>exportSymbolType : { default: symbol; } === exportAny.d.cts === declare const __: any; diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types.diff b/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types.diff deleted file mode 100644 index 08137ed3457..00000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.moduleExportNonStructured.types -+++ new.moduleExportNonStructured.types -@@= skipped -1, +1 lines =@@ - - === index.mts === - import * as exportAny from "./exportAny.cjs"; -->exportAny : { default: any; } -+>exportAny : any - - import * as exportUnknown from "./exportUnknown.cjs"; -->exportUnknown : { default: unknown; } -+>exportUnknown : unknown - - import * as exportSymbol from "./exportSymbol.cjs"; -->exportSymbol : { default: symbol; } -+>exportSymbol : symbol - - import type * as exportAnyType from "./exportAny.cjs"; -->exportAnyType : { default: any; } -+>exportAnyType : any - - import type * as exportUnknownType from "./exportUnknown.cjs"; -->exportUnknownType : { default: unknown; } -+>exportUnknownType : unknown - - import type * as exportSymbolType from "./exportSymbol.cjs"; -->exportSymbolType : { default: symbol; } -+>exportSymbolType : symbol - - === exportAny.d.cts === - declare const __: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt index a5942033823..2fd1d68ba8d 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. b.mts(15,1): error TS2349: This expression is not callable. Type 'typeof import("mod")' has no call signatures. b.mts(16,1): error TS2349: This expression is not callable. @@ -13,7 +12,6 @@ b.mts(20,6): error TS2349: This expression is not callable. Type 'typeof import("mod")' has no call signatures. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== mod.cts (0 errors) ==== declare function fun(): void; export default fun; diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt.diff deleted file mode 100644 index a5d08c5658e..00000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node20).errors.txt -+++ new.moduleNodeDefaultImports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - b.mts(15,1): error TS2349: This expression is not callable. - Type 'typeof import("mod")' has no call signatures. - b.mts(16,1): error TS2349: This expression is not callable. -@@= skipped -11, +12 lines =@@ - Type 'typeof import("mod")' has no call signatures. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== mod.cts (0 errors) ==== - declare function fun(): void; - export default fun; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js index 678b8457245..1d6e31ec0af 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js @@ -38,33 +38,28 @@ self.def.default(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = fun; //// [b.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.def = exports.default = void 0; -const mod_cjs_1 = require("./mod.cjs"); -const mod_cjs_2 = require("./mod.cjs"); -const mod_cjs_3 = require("./mod.cjs"); -const self = require("./b.mjs"); -const mod_cjs_4 = require("./mod.cjs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mod_cjs_4.default; } }); -const mod_cjs_5 = require("./mod.cjs"); -Object.defineProperty(exports, "def", { enumerable: true, get: function () { return mod_cjs_5.default; } }); -mod_cjs_1.default === mod_cjs_2.default; -mod_cjs_2.default === mod_cjs_3.default; -mod_cjs_3.default === mod_cjs_3.default; -mod_cjs_3.default === self.default; +import a from "./mod.cjs"; +import { default as b } from "./mod.cjs"; +import c, { default as d } from "./mod.cjs"; +import * as self from "./b.mjs"; +export { default } from "./mod.cjs"; +export { default as def } from "./mod.cjs"; +a === b; +b === c; +c === d; +d === self.default; self.default === self.def; // should all fail -(0, mod_cjs_1.default)(); -(0, mod_cjs_2.default)(); -(0, mod_cjs_3.default)(); -(0, mod_cjs_3.default)(); +a(); +b(); +c(); +d(); self.default(); self.def(); // should all work -mod_cjs_1.default.default(); -mod_cjs_2.default.default(); -mod_cjs_3.default.default(); -mod_cjs_3.default.default(); +a.default(); +b.default(); +c.default(); +d.default(); self.default.default(); self.def.default(); diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js.diff deleted file mode 100644 index f9cea00cdcb..00000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js.diff +++ /dev/null @@ -1,54 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node20).js -+++ new.moduleNodeDefaultImports(module=node20).js -@@= skipped -37, +37 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = fun; - //// [b.mjs] --import a from "./mod.cjs"; --import { default as b } from "./mod.cjs"; --import c, { default as d } from "./mod.cjs"; --import * as self from "./b.mjs"; --export { default } from "./mod.cjs"; --export { default as def } from "./mod.cjs"; --a === b; --b === c; --c === d; --d === self.default; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.def = exports.default = void 0; -+const mod_cjs_1 = require("./mod.cjs"); -+const mod_cjs_2 = require("./mod.cjs"); -+const mod_cjs_3 = require("./mod.cjs"); -+const self = require("./b.mjs"); -+const mod_cjs_4 = require("./mod.cjs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mod_cjs_4.default; } }); -+const mod_cjs_5 = require("./mod.cjs"); -+Object.defineProperty(exports, "def", { enumerable: true, get: function () { return mod_cjs_5.default; } }); -+mod_cjs_1.default === mod_cjs_2.default; -+mod_cjs_2.default === mod_cjs_3.default; -+mod_cjs_3.default === mod_cjs_3.default; -+mod_cjs_3.default === self.default; - self.default === self.def; - // should all fail --a(); --b(); --c(); --d(); -+(0, mod_cjs_1.default)(); -+(0, mod_cjs_2.default)(); -+(0, mod_cjs_3.default)(); -+(0, mod_cjs_3.default)(); - self.default(); - self.def(); - // should all work --a.default(); --b.default(); --c.default(); --d.default(); -+mod_cjs_1.default.default(); -+mod_cjs_2.default.default(); -+mod_cjs_3.default.default(); -+mod_cjs_3.default.default(); - self.default.default(); - self.def.default(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js index 92b7e88696b..2d0c7b4607e 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js @@ -14,6 +14,39 @@ p.thing(); //// [index.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const p = require("pkg"); +const p = __importStar(require("pkg")); p.thing(); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js.diff deleted file mode 100644 index 36ffdc1a849..00000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.moduleResolutionWithModule(module=node20,moduleresolution=node16).js -+++ new.moduleResolutionWithModule(module=node20,moduleresolution=node16).js -@@= skipped -13, +13 lines =@@ - - //// [index.js] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); --const p = __importStar(require("pkg")); -+const p = require("pkg"); - p.thing(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js index 92b7e88696b..2d0c7b4607e 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js @@ -14,6 +14,39 @@ p.thing(); //// [index.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const p = require("pkg"); +const p = __importStar(require("pkg")); p.thing(); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js.diff deleted file mode 100644 index edef2d838dd..00000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js -+++ new.moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js -@@= skipped -13, +13 lines =@@ - - //// [index.js] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); --const p = __importStar(require("pkg")); -+const p = require("pkg"); - p.thing(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types b/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types index 5f36c4da7f7..043c9d9a346 100644 --- a/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types +++ b/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types @@ -14,10 +14,10 @@ declare function call(x: { x: (...args: A) => T }, ...ar >args : A const leak = call(wrap((x: T) => x), 1); ->leak : number ->call(wrap((x: T) => x), 1) : number +>leak : unknown +>call(wrap((x: T) => x), 1) : unknown >call : (x: { x: (...args: A) => T; }, ...args: A) => T ->wrap((x: T) => x) : { x: (x: A[0]) => A[0]; } +>wrap((x: T) => x) : { x: (x: unknown) => unknown; } >wrap : (x: X) => { x: X; } >(x: T) => x : (x: T) => T >x : T diff --git a/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types.diff b/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types.diff deleted file mode 100644 index 30ea05eea32..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nestedGenericSpreadInference.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nestedGenericSpreadInference.types -+++ new.nestedGenericSpreadInference.types -@@= skipped -13, +13 lines =@@ - >args : A - - const leak = call(wrap((x: T) => x), 1); -->leak : unknown -->call(wrap((x: T) => x), 1) : unknown -+>leak : number -+>call(wrap((x: T) => x), 1) : number - >call : (x: { x: (...args: A) => T; }, ...args: A) => T -->wrap((x: T) => x) : { x: (x: unknown) => unknown; } -+>wrap((x: T) => x) : { x: (x: A[0]) => A[0]; } - >wrap : (x: X) => { x: X; } - >(x: T) => x : (x: T) => T - >x : T \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types b/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types index c5c5964e66e..90ac3b1392e 100644 --- a/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types +++ b/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types @@ -9,6 +9,6 @@ import A from "./a"; >A : typeof A new A(); ->new A() : any +>new A() : A >A : typeof A diff --git a/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types.diff b/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types.diff new file mode 100644 index 00000000000..1698e60a8bd --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/newAbstractInstance2.types.diff @@ -0,0 +1,9 @@ +--- old.newAbstractInstance2.types ++++ new.newAbstractInstance2.types +@@= skipped -8, +8 lines =@@ + >A : typeof A + + new A(); +->new A() : any ++>new A() : A + >A : typeof A diff --git a/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types b/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types index f7b437d648a..4ee44ae946c 100644 --- a/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types +++ b/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types @@ -42,7 +42,7 @@ class CrashTrigger extends Mixin(Empty) { >trigger : () => void new Concrete(); ->new Concrete() : any +>new Concrete() : Concrete >Concrete : typeof Concrete } } diff --git a/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types.diff b/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types.diff index c2a58329695..e6805f89ece 100644 --- a/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types.diff +++ b/testdata/baselines/reference/submodule/compiler/noCrashOnMixin.types.diff @@ -24,4 +24,12 @@ +>Mixin : >(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Mixin.(Anonymous class); } & TBase >Empty : typeof Empty - public trigger() { \ No newline at end of file + public trigger() { + >trigger : () => void + + new Concrete(); +->new Concrete() : any ++>new Concrete() : Concrete + >Concrete : typeof Concrete + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt deleted file mode 100644 index 923dd9d79c7..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -src/foo.mts(6,4): error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. - - -==== src/a.cts (0 errors) ==== - export const a: number = 1; -==== src/foo.mts (1 errors) ==== - import d, {a} from './a.cjs'; - import * as ns from './a.cjs'; - export {d, a, ns}; - - d.a; - ns.default.a; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff deleted file mode 100644 index b8d91ba15ca..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault1.errors.txt -+++ new.nodeNextCjsNamespaceImportDefault1.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/foo.mts(6,4): error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. -+ -+ -+==== src/a.cts (0 errors) ==== -+ export const a: number = 1; -+==== src/foo.mts (1 errors) ==== -+ import d, {a} from './a.cjs'; -+ import * as ns from './a.cjs'; -+ export {d, a, ns}; -+ -+ d.a; -+ ns.default.a; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols index ce6486e9851..7c1ed8eba94 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols @@ -23,5 +23,9 @@ d.a; >a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; +>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) +>ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) +>default : Symbol(d.default) +>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff index 5624fa9aeea..1af235877e9 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff @@ -12,7 +12,9 @@ ns.default.a; ->ns.default.a : Symbol(d.a, Decl(a.cts, 0, 12)) -->ns.default : Symbol(d.default) ++>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) + >ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) -->default : Symbol(d.default) + >default : Symbol(d.default) ->a : Symbol(d.a, Decl(a.cts, 0, 12)) ++>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types index 187bdd6ce37..b10938a7425 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types @@ -11,12 +11,12 @@ import d, {a} from './a.cjs'; >a : number import * as ns from './a.cjs'; ->ns : typeof d +>ns : typeof ns export {d, a, ns}; >d : typeof d >a : number ->ns : typeof d +>ns : typeof ns d.a; >d.a : number @@ -24,9 +24,9 @@ d.a; >a : number ns.default.a; ->ns.default.a : any ->ns.default : any ->ns : typeof d ->default : any ->a : any +>ns.default.a : number +>ns.default : typeof d +>ns : typeof ns +>default : typeof d +>a : number diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff deleted file mode 100644 index 0de716579a5..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault1.types -+++ new.nodeNextCjsNamespaceImportDefault1.types -@@= skipped -10, +10 lines =@@ - >a : number - - import * as ns from './a.cjs'; -->ns : typeof ns -+>ns : typeof d - - export {d, a, ns}; - >d : typeof d - >a : number -->ns : typeof ns -+>ns : typeof d - - d.a; - >d.a : number -@@= skipped -13, +13 lines =@@ - >a : number - - ns.default.a; -->ns.default.a : number -->ns.default : typeof d -->ns : typeof ns -->default : typeof d -->a : number -+>ns.default.a : any -+>ns.default : any -+>ns : typeof d -+>default : any -+>a : any diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt deleted file mode 100644 index dbb54d4c12d..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -src/foo.mts(6,12): error TS2339: Property 'a' does not exist on type '"string"'. - - -==== src/a.cts (0 errors) ==== - export const a: number = 1; - export default 'string'; -==== src/foo.mts (1 errors) ==== - import d, {a} from './a.cjs'; - import * as ns from './a.cjs'; - export {d, a, ns}; - - d.a; - ns.default.a; - ~ -!!! error TS2339: Property 'a' does not exist on type '"string"'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff deleted file mode 100644 index d4b66f4f292..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault2.errors.txt -+++ new.nodeNextCjsNamespaceImportDefault2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/foo.mts(6,12): error TS2339: Property 'a' does not exist on type '"string"'. -+ -+ -+==== src/a.cts (0 errors) ==== -+ export const a: number = 1; -+ export default 'string'; -+==== src/foo.mts (1 errors) ==== -+ import d, {a} from './a.cjs'; -+ import * as ns from './a.cjs'; -+ export {d, a, ns}; -+ -+ d.a; -+ ns.default.a; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '"string"'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols index 247684eef22..d29ca9ced81 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols @@ -24,7 +24,9 @@ d.a; >a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; ->ns.default : Symbol(d.default, Decl(a.cts, 0, 27)) +>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) +>ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) ->default : Symbol(d.default, Decl(a.cts, 0, 27)) +>default : Symbol(d.default) +>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff index 0e016d4219d..36c1c8d6074 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff @@ -12,9 +12,9 @@ ns.default.a; ->ns.default.a : Symbol(d.a, Decl(a.cts, 0, 12)) -->ns.default : Symbol(d.default) -+>ns.default : Symbol(d.default, Decl(a.cts, 0, 27)) ++>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) + >ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) -->default : Symbol(d.default) + >default : Symbol(d.default) ->a : Symbol(d.a, Decl(a.cts, 0, 12)) -+>default : Symbol(d.default, Decl(a.cts, 0, 27)) ++>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types index eb3b767623e..7b70232fc87 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types @@ -12,12 +12,12 @@ import d, {a} from './a.cjs'; >a : number import * as ns from './a.cjs'; ->ns : typeof d +>ns : typeof ns export {d, a, ns}; >d : typeof d >a : number ->ns : typeof d +>ns : typeof ns d.a; >d.a : number @@ -25,9 +25,9 @@ d.a; >a : number ns.default.a; ->ns.default.a : any ->ns.default : "string" ->ns : typeof d ->default : "string" ->a : any +>ns.default.a : number +>ns.default : typeof d +>ns : typeof ns +>default : typeof d +>a : number diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff deleted file mode 100644 index 80a692a2c98..00000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault2.types -+++ new.nodeNextCjsNamespaceImportDefault2.types -@@= skipped -11, +11 lines =@@ - >a : number - - import * as ns from './a.cjs'; -->ns : typeof ns -+>ns : typeof d - - export {d, a, ns}; - >d : typeof d - >a : number -->ns : typeof ns -+>ns : typeof d - - d.a; - >d.a : number -@@= skipped -13, +13 lines =@@ - >a : number - - ns.default.a; -->ns.default.a : number -->ns.default : typeof d -->ns : typeof ns -->default : typeof d -->a : number -+>ns.default.a : any -+>ns.default : "string" -+>ns : typeof d -+>default : "string" -+>a : any diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt index fe344a04888..9062d299474 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== node_modules/pkg/index.d.ts (0 errors) ==== interface GlobalThing { a: number } ==== node_modules/pkg/package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt.diff deleted file mode 100644 index 7ec98999db8..00000000000 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt -+++ new.tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== node_modules/pkg/index.d.ts (0 errors) ==== - interface GlobalThing { a: number } - ==== node_modules/pkg/package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js index 89dd2c7541a..6d734ae2ed7 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js @@ -14,5 +14,7 @@ interface GlobalThing { a: number } const a: GlobalThing = { a: 0 }; //// [usage.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /// const a = { a: 0 }; diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff index ebd2efbfdec..18ceeaf53b9 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff @@ -1,10 +1,10 @@ --- old.tripleSlashTypesReferenceWithMissingExports(module=node20).js +++ new.tripleSlashTypesReferenceWithMissingExports(module=node20).js -@@= skipped -13, +13 lines =@@ - const a: GlobalThing = { a: 0 }; +@@= skipped -14, +14 lines =@@ //// [usage.js] --"use strict"; - /// --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; +-/// + Object.defineProperty(exports, "__esModule", { value: true }); ++/// const a = { a: 0 }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt index eb313ab5ef3..cc359bceb49 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. arbitraryModuleNamespaceIdentifiers_module.ts(20,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. arbitraryModuleNamespaceIdentifiers_module.ts(24,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. arbitraryModuleNamespaceIdentifiers_module.ts(29,7): error TS2322: Type '"expect error about otherType"' is not assignable to type '"otherType"'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== arbitraryModuleNamespaceIdentifiers_module.ts (3 errors) ==== const someValue = "someValue"; type someType = "someType"; diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt.diff deleted file mode 100644 index 2025d365888..00000000000 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt -+++ new.arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - arbitraryModuleNamespaceIdentifiers_module.ts(20,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. - arbitraryModuleNamespaceIdentifiers_module.ts(24,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. - arbitraryModuleNamespaceIdentifiers_module.ts(29,7): error TS2322: Type '"expect error about otherType"' is not assignable to type '"otherType"'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== arbitraryModuleNamespaceIdentifiers_module.ts (3 errors) ==== - const someValue = "someValue"; - type someType = "someType"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js index d01954f66b4..3c4b1a08c38 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js @@ -34,6 +34,39 @@ const importStarTestA: typeC.otherType = "expect error about otherType"; //// [arbitraryModuleNamespaceIdentifiers_module.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports[""] = exports[""] = exports[""] = void 0; const someValue = "someValue"; @@ -46,7 +79,7 @@ Object.defineProperty(exports, "", { enumerable: true, get: function () { ret const arbitraryModuleNamespaceIdentifiers_module_3 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") throw "should be someValue"; -exports[""] = require("./arbitraryModuleNamespaceIdentifiers_module"); +exports[""] = __importStar(require("./arbitraryModuleNamespaceIdentifiers_module")); const arbitraryModuleNamespaceIdentifiers_module_4 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") throw "should be someValue"; diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff index 731dc2b1b9c..6810491b06a 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff @@ -1,46 +1,6 @@ --- old.arbitraryModuleNamespaceIdentifiers_module(module=node20).js +++ new.arbitraryModuleNamespaceIdentifiers_module(module=node20).js -@@= skipped -33, +33 lines =@@ - - //// [arbitraryModuleNamespaceIdentifiers_module.js] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports[""] = exports[""] = exports[""] = void 0; - const someValue = "someValue"; -@@= skipped -40, +7 lines =@@ +@@= skipped -73, +73 lines =@@ const arbitraryModuleNamespaceIdentifiers_module_1 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_1[""] !== "someValue") throw "should be someValue"; @@ -48,10 +8,4 @@ +const arbitraryModuleNamespaceIdentifiers_module_2 = require("./arbitraryModuleNamespaceIdentifiers_module"); Object.defineProperty(exports, "", { enumerable: true, get: function () { return arbitraryModuleNamespaceIdentifiers_module_2[""]; } }); const arbitraryModuleNamespaceIdentifiers_module_3 = require("./arbitraryModuleNamespaceIdentifiers_module"); - if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") - throw "should be someValue"; --exports[""] = __importStar(require("./arbitraryModuleNamespaceIdentifiers_module")); -+exports[""] = require("./arbitraryModuleNamespaceIdentifiers_module"); - const arbitraryModuleNamespaceIdentifiers_module_4 = require("./arbitraryModuleNamespaceIdentifiers_module"); - if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") - throw "should be someValue"; \ No newline at end of file + if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js b/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js index 38bfb25afb3..e79804a05e1 100644 --- a/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js +++ b/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js @@ -47,6 +47,12 @@ assignmentToVoidZero2_1.j + assignmentToVoidZero2_1.k; //// [assignmentToVoidZero2.d.ts] export var j = 1; export var k = void 0; +declare namespace o { + var x: number; +} +declare namespace o { + var y: any; +} export {}; //// [importer.d.ts] export {}; diff --git a/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js.diff b/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js.diff index 828b31c77b0..a08ceb94949 100644 --- a/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/assignmentToVoidZero2.js.diff @@ -25,6 +25,12 @@ -export const j: 1; +export var j = 1; +export var k = void 0; ++declare namespace o { ++ var x: number; ++} ++declare namespace o { ++ var y: any; ++} +export {}; //// [importer.d.ts] export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json index 6fb3a0bc623..6ffdb55a57a 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json @@ -1,7 +1,7 @@ ======== Resolving module '../lib' from '/app/test.ts'. ======== Explicitly specified module resolution kind: 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -Loading module as file / folder, candidate module location '/lib', target file types: TypeScript, JavaScript, Declaration. +Loading module as file / folder, candidate module location '/lib', target file types: TypeScript, JavaScript, Declaration, JSON. File '/lib.ts' does not exist. File '/lib.tsx' does not exist. File '/lib.d.ts' does not exist. diff --git a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt index 1834ff8689a..010cc8f06a6 100644 --- a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.ts(1,22): error TS2876: This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "./foo.ts/index.ts". -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (1 errors) ==== import foo = require("./foo.ts"); // Error ~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt.diff deleted file mode 100644 index 78623d6186e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.cjsErrors(module=node20).errors.txt -+++ new.cjsErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.ts(1,22): error TS2876: This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "./foo.ts/index.ts". - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (1 errors) ==== - import foo = require("./foo.ts"); // Error - ~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types b/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types index 532bcf36d9b..6c7b6585861 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types @@ -32,7 +32,7 @@ new AA; >AA : typeof A new BB; ->new BB : any +>new BB : B >BB : typeof B new CC; diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types.diff new file mode 100644 index 00000000000..4d2b5166fc5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractConstructorAssignability.types.diff @@ -0,0 +1,11 @@ +--- old.classAbstractConstructorAssignability.types ++++ new.classAbstractConstructorAssignability.types +@@= skipped -31, +31 lines =@@ + >AA : typeof A + + new BB; +->new BB : any ++>new BB : B + >BB : typeof B + + new CC; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types b/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types index dd19cd586ae..9fe8312498f 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types @@ -24,7 +24,7 @@ function NewB(Factory: typeof B) { >B : typeof B return new B; ->new B : any +>new B : B >B : typeof B } diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types.diff new file mode 100644 index 00000000000..888da4de5d9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractFactoryFunction.types.diff @@ -0,0 +1,10 @@ +--- old.classAbstractFactoryFunction.types ++++ new.classAbstractFactoryFunction.types +@@= skipped -23, +23 lines =@@ + >B : typeof B + + return new B; +->new B : any ++>new B : B + >B : typeof B + } diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types b/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types index 8ad85451935..118f8288f9c 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types @@ -8,7 +8,7 @@ module M { >A : A new A; ->new A : any +>new A : A >A : typeof A } @@ -18,6 +18,6 @@ import myA = M.A; >A : myA new myA; ->new myA : any +>new myA : myA >myA : typeof myA diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types.diff new file mode 100644 index 00000000000..45c308c6c11 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractImportInstantiation.types.diff @@ -0,0 +1,18 @@ +--- old.classAbstractImportInstantiation.types ++++ new.classAbstractImportInstantiation.types +@@= skipped -7, +7 lines =@@ + >A : A + + new A; +->new A : any ++>new A : A + >A : typeof A + } + +@@= skipped -10, +10 lines =@@ + >A : myA + + new myA; +->new myA : any ++>new myA : myA + >myA : typeof myA diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types b/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types index df5b2fc9866..7cb2640f2fe 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types @@ -13,7 +13,7 @@ module M { } new M.A; ->new M.A : any +>new M.A : M.A >M.A : typeof M.A >M : typeof M >A : typeof M.A diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types.diff new file mode 100644 index 00000000000..29cb42eb4e7 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractInAModule.types.diff @@ -0,0 +1,11 @@ +--- old.classAbstractInAModule.types ++++ new.classAbstractInAModule.types +@@= skipped -12, +12 lines =@@ + } + + new M.A; +->new M.A : any ++>new M.A : M.A + >M.A : typeof M.A + >M : typeof M + >A : typeof M.A \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types index a578c7b6cd9..d679338a70a 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types @@ -17,11 +17,11 @@ abstract class C extends B {} >B : B new A; ->new A : any +>new A : A >A : typeof A new A(1); // should report 1 error ->new A(1) : any +>new A(1) : A >A : typeof A >1 : 1 @@ -30,7 +30,7 @@ new B; >B : typeof B new C; ->new C : any +>new C : C >C : typeof C var a : A; diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types.diff new file mode 100644 index 00000000000..fe0f43338b8 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations1.types.diff @@ -0,0 +1,25 @@ +--- old.classAbstractInstantiations1.types ++++ new.classAbstractInstantiations1.types +@@= skipped -16, +16 lines =@@ + >B : B + + new A; +->new A : any ++>new A : A + >A : typeof A + + new A(1); // should report 1 error +->new A(1) : any ++>new A(1) : A + >A : typeof A + >1 : 1 + +@@= skipped -13, +13 lines =@@ + >B : typeof B + + new C; +->new C : any ++>new C : C + >C : typeof C + + var a : A; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types index 31f717b8c7b..e7d2ee8c0d7 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types @@ -22,7 +22,7 @@ abstract class B { } new B; // error ->new B : any +>new B : B >B : typeof B var BB: typeof B = B; @@ -45,7 +45,7 @@ function constructB(Factory : typeof B) { >B : typeof B new Factory; // error -- Factory is of type typeof B. ->new Factory : any +>new Factory : B >Factory : typeof B } @@ -54,7 +54,7 @@ var BB = B; >B : typeof B new BB; // error -- BB is of type typeof B. ->new BB : any +>new BB : B >BB : typeof B var x : any = C; diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types.diff new file mode 100644 index 00000000000..d5752a762e1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractInstantiations2.types.diff @@ -0,0 +1,29 @@ +--- old.classAbstractInstantiations2.types ++++ new.classAbstractInstantiations2.types +@@= skipped -21, +21 lines =@@ + } + + new B; // error +->new B : any ++>new B : B + >B : typeof B + + var BB: typeof B = B; +@@= skipped -23, +23 lines =@@ + >B : typeof B + + new Factory; // error -- Factory is of type typeof B. +->new Factory : any ++>new Factory : B + >Factory : typeof B + } + +@@= skipped -9, +9 lines =@@ + >B : typeof B + + new BB; // error -- BB is of type typeof B. +->new BB : any ++>new BB : B + >BB : typeof B + + var x : any = C; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types b/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types index 7d89a346320..cbaa7bc8e93 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types @@ -53,23 +53,23 @@ declare abstract class DCC2 {} >DCC2 : DCC2 new CM; ->new CM : any +>new CM : CM >CM : typeof CM new MC; ->new MC : any +>new MC : MC >MC : typeof MC new CI; ->new CI : any +>new CI : CI >CI : typeof CI new IC; ->new IC : any +>new IC : IC >IC : typeof IC new CC1; ->new CC1 : any +>new CC1 : CC1 >CC1 : typeof CC1 new CC2; @@ -77,15 +77,15 @@ new CC2; >CC2 : typeof CC2 new DCI; ->new DCI : any +>new DCI : DCI >DCI : typeof DCI new DIC; ->new DIC : any +>new DIC : DIC >DIC : typeof DIC new DCC1; ->new DCC1 : any +>new DCC1 : DCC1 >DCC1 : typeof DCC1 new DCC2; diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types.diff new file mode 100644 index 00000000000..812941fc724 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractMergedDeclaration.types.diff @@ -0,0 +1,50 @@ +--- old.classAbstractMergedDeclaration.types ++++ new.classAbstractMergedDeclaration.types +@@= skipped -52, +52 lines =@@ + >DCC2 : DCC2 + + new CM; +->new CM : any ++>new CM : CM + >CM : typeof CM + + new MC; +->new MC : any ++>new MC : MC + >MC : typeof MC + + new CI; +->new CI : any ++>new CI : CI + >CI : typeof CI + + new IC; +->new IC : any ++>new IC : IC + >IC : typeof IC + + new CC1; +->new CC1 : any ++>new CC1 : CC1 + >CC1 : typeof CC1 + + new CC2; +@@= skipped -24, +24 lines =@@ + >CC2 : typeof CC2 + + new DCI; +->new DCI : any ++>new DCI : DCI + >DCI : typeof DCI + + new DIC; +->new DIC : any ++>new DIC : DIC + >DIC : typeof DIC + + new DCC1; +->new DCC1 : any ++>new DCC1 : DCC1 + >DCC1 : typeof DCC1 + + new DCC2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types b/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types index 965ca1834a5..ca29c2dd2ee 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types @@ -17,7 +17,7 @@ class C {} >C : C new A; ->new A : any +>new A : A >A : typeof A new B; diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types.diff new file mode 100644 index 00000000000..d44db4130c9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractSingleLineDecl.types.diff @@ -0,0 +1,11 @@ +--- old.classAbstractSingleLineDecl.types ++++ new.classAbstractSingleLineDecl.types +@@= skipped -16, +16 lines =@@ + >C : C + + new A; +->new A : any ++>new A : A + >A : typeof A + + new B; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types b/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types index 2a97647260f..3bbdc29a37e 100644 --- a/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types +++ b/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types @@ -39,7 +39,7 @@ a.foo(); a = new C; // error, cannot instantiate abstract class. >a = new C : any >a : B ->new C : any +>new C : C >C : typeof C a.foo(); diff --git a/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types.diff b/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types.diff new file mode 100644 index 00000000000..5f1dd6caf93 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classAbstractUsingAbstractMethod1.types.diff @@ -0,0 +1,11 @@ +--- old.classAbstractUsingAbstractMethod1.types ++++ new.classAbstractUsingAbstractMethod1.types +@@= skipped -38, +38 lines =@@ + a = new C; // error, cannot instantiate abstract class. + >a = new C : any + >a : B +->new C : any ++>new C : C + >C : typeof C + + a.foo(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js index dd5905dd43f..29b9f54bde4 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js @@ -98,7 +98,7 @@ declare class E { protected constructor(x: number); } declare var c: C; -declare var d: any; -declare var e: any; +declare var d: D; +declare var e: E; declare namespace Generic { } diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js.diff b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js.diff index cf734bf8944..7a766a0cf8f 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js.diff +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.js.diff @@ -39,4 +39,14 @@ + x; constructor(x) { this.x = x; - } \ No newline at end of file + } +@@= skipped -34, +37 lines =@@ + protected constructor(x: number); + } + declare var c: C; +-declare var d: any; +-declare var e: any; ++declare var d: D; ++declare var e: E; + declare namespace Generic { + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types index 099febd28b3..f013b8bf088 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types @@ -29,14 +29,14 @@ var c = new C(1); >1 : 1 var d = new D(1); // error ->d : any ->new D(1) : any +>d : D +>new D(1) : D >D : typeof D >1 : 1 var e = new E(1); // error ->e : any ->new E(1) : any +>e : E +>new E(1) : E >E : typeof E >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types.diff b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types.diff new file mode 100644 index 00000000000..8226efd522b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.types.diff @@ -0,0 +1,20 @@ +--- old.classConstructorAccessibility.types ++++ new.classConstructorAccessibility.types +@@= skipped -28, +28 lines =@@ + >1 : 1 + + var d = new D(1); // error +->d : any +->new D(1) : any ++>d : D ++>new D(1) : D + >D : typeof D + >1 : 1 + + var e = new E(1); // error +->e : any +->new E(1) : any ++>e : E ++>new E(1) : E + >E : typeof E + >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js index 92a848fe1d5..710cf73e66c 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js @@ -147,8 +147,8 @@ declare class DerivedC extends BaseC { static staticBaseInstance(): void; } declare var ba: BaseA; -declare var bb: any; -declare var bc: any; +declare var bb: BaseB; +declare var bc: BaseC; declare var da: DerivedA; declare var db: DerivedB; declare var dc: DerivedC; diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js.diff b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js.diff index 9ea50165ab4..d5d0d88e565 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.js.diff @@ -45,4 +45,15 @@ + x; constructor(x) { super(x); - this.x = x; \ No newline at end of file + this.x = x; +@@= skipped -55, +56 lines =@@ + static staticBaseInstance(): void; + } + declare var ba: BaseA; +-declare var bb: any; +-declare var bc: any; ++declare var bb: BaseB; ++declare var bc: BaseC; + declare var da: DerivedA; + declare var db: DerivedB; + declare var dc: DerivedC; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types index ebad2df2a5a..eb0d254a669 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types @@ -122,13 +122,13 @@ class DerivedC extends BaseC { // error createBaseInstance() { new BaseC(10); } // error >createBaseInstance : () => void ->new BaseC(10) : any +>new BaseC(10) : BaseC >BaseC : typeof BaseC >10 : 10 static staticBaseInstance() { new BaseC(11); } // error >staticBaseInstance : () => void ->new BaseC(11) : any +>new BaseC(11) : BaseC >BaseC : typeof BaseC >11 : 11 } @@ -140,14 +140,14 @@ var ba = new BaseA(1); >1 : 1 var bb = new BaseB(1); // error ->bb : any ->new BaseB(1) : any +>bb : BaseB +>new BaseB(1) : BaseB >BaseB : typeof BaseB >1 : 1 var bc = new BaseC(1); // error ->bc : any ->new BaseC(1) : any +>bc : BaseC +>new BaseC(1) : BaseC >BaseC : typeof BaseC >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types.diff b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types.diff new file mode 100644 index 00000000000..34e0c12ec2b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility2.types.diff @@ -0,0 +1,36 @@ +--- old.classConstructorAccessibility2.types ++++ new.classConstructorAccessibility2.types +@@= skipped -121, +121 lines =@@ + + createBaseInstance() { new BaseC(10); } // error + >createBaseInstance : () => void +->new BaseC(10) : any ++>new BaseC(10) : BaseC + >BaseC : typeof BaseC + >10 : 10 + + static staticBaseInstance() { new BaseC(11); } // error + >staticBaseInstance : () => void +->new BaseC(11) : any ++>new BaseC(11) : BaseC + >BaseC : typeof BaseC + >11 : 11 + } +@@= skipped -18, +18 lines =@@ + >1 : 1 + + var bb = new BaseB(1); // error +->bb : any +->new BaseB(1) : any ++>bb : BaseB ++>new BaseB(1) : BaseB + >BaseB : typeof BaseB + >1 : 1 + + var bc = new BaseC(1); // error +->bc : any +->new BaseC(1) : any ++>bc : BaseC ++>new BaseC(1) : BaseC + >BaseC : typeof BaseC + >1 : 1 diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types index 331da943210..22a6b2eec24 100644 --- a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types @@ -21,7 +21,7 @@ class Unrelated { static fake() { new Base() } // error >fake : () => void ->new Base() : any +>new Base() : Base >Base : typeof Base } diff --git a/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types.diff b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types.diff new file mode 100644 index 00000000000..c6030005d99 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility5.types.diff @@ -0,0 +1,10 @@ +--- old.classConstructorAccessibility5.types ++++ new.classConstructorAccessibility5.types +@@= skipped -20, +20 lines =@@ + + static fake() { new Base() } // error + >fake : () => void +->new Base() : any ++>new Base() : Base + >Base : typeof Base + } diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js index 7334c82bdec..39c2df78a4a 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js @@ -38,6 +38,13 @@ function f(k) { //// [mod1.d.ts] +declare namespace NS { + var K: { + new (): { + values(): /*elided*/ any; + }; + }; +} export var K = NS.K; export {}; //// [main.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js.diff b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js.diff index 7951efe1d64..7dcf48b3868 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSImportNestedClassTypeReference.js.diff @@ -22,8 +22,14 @@ -export var K: { - new (): { - values(): /*elided*/ any; -- }; ++declare namespace NS { ++ var K: { ++ new (): { ++ values(): /*elided*/ any; ++ }; + }; -}; ++} +export var K = NS.K; +export {}; //// [main.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json index b4010f23a53..1f4cee8b040 100644 --- a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json +++ b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json @@ -2,7 +2,7 @@ Explicitly specified module resolution kind: 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist. -Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +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. diff --git a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json index 52eb32d86e3..e1611836c93 100644 --- a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json @@ -2,7 +2,7 @@ Explicitly specified module resolution kind: 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist. -Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +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. diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt index c2d28e30293..754dde91093 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. main.ts(1,18): error TS2307: Cannot find module './file.js' or its corresponding type declarations. main.ts(2,18): error TS2307: Cannot find module './file.jsx' or its corresponding type declarations. main.ts(3,18): error TS2307: Cannot find module './file.ts' or its corresponding type declarations. @@ -7,13 +6,15 @@ main.ts(5,18): error TS2307: Cannot find module './file.mjs' or its correspondin main.ts(6,18): error TS2307: Cannot find module './file.cjs' or its corresponding type declarations. main.ts(7,18): error TS2307: Cannot find module './file.mts' or its corresponding type declarations. main.ts(8,18): error TS2307: Cannot find module './file.cts' or its corresponding type declarations. +main.ts(9,18): error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. +main.ts(10,19): error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. +main.ts(11,19): error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== package.json (0 errors) ==== {"type": "module"} -==== main.ts (9 errors) ==== +==== main.ts (12 errors) ==== import def1 from "./file.js"; ~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.js' or its corresponding type declarations. @@ -39,8 +40,14 @@ main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corre ~~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.cts' or its corresponding type declarations. import def9 from "./file.d.ts"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. import def10 from "./file.d.cts"; + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. import def11 from "./file.d.mts"; + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. import def12 from "./file.d.json.ts"; ~~~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt.diff deleted file mode 100644 index cf4ea45d49b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node20).errors.txt -+++ new.declarationFileForTsJsImport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - main.ts(1,18): error TS2307: Cannot find module './file.js' or its corresponding type declarations. - main.ts(2,18): error TS2307: Cannot find module './file.jsx' or its corresponding type declarations. - main.ts(3,18): error TS2307: Cannot find module './file.ts' or its corresponding type declarations. -@@= skipped -5, +6 lines =@@ - main.ts(6,18): error TS2307: Cannot find module './file.cjs' or its corresponding type declarations. - main.ts(7,18): error TS2307: Cannot find module './file.mts' or its corresponding type declarations. - main.ts(8,18): error TS2307: Cannot find module './file.cts' or its corresponding type declarations. --main.ts(9,18): error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. --main.ts(10,19): error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. --main.ts(11,19): error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. - main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== package.json (0 errors) ==== - {"type": "module"} --==== main.ts (12 errors) ==== -+==== main.ts (9 errors) ==== - import def1 from "./file.js"; - ~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.js' or its corresponding type declarations. -@@= skipped -34, +32 lines =@@ - ~~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.cts' or its corresponding type declarations. - import def9 from "./file.d.ts"; -- ~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. - import def10 from "./file.d.cts"; -- ~~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. - import def11 from "./file.d.mts"; -- ~~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. - import def12 from "./file.d.json.ts"; - ~~~~~~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js index 5779a33d137..aec21f826cd 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js @@ -53,5 +53,4 @@ declare var bad: "bad12"; export default bad; //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js.diff deleted file mode 100644 index 4b55a9c97af..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node20).js -+++ new.declarationFileForTsJsImport(module=node20).js -@@= skipped -52, +52 lines =@@ - export default bad; - - //// [main.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types index 807edbddf62..f1d5204ee93 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types @@ -26,13 +26,13 @@ import def8 from "./file.cts"; >def8 : any import def9 from "./file.d.ts"; ->def9 : "bad3" +>def9 : any import def10 from "./file.d.cts"; ->def10 : "bad8" +>def10 : any import def11 from "./file.d.mts"; ->def11 : "bad7" +>def11 : any import def12 from "./file.d.json.ts"; >def12 : any diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types.diff deleted file mode 100644 index 3557d407d67..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node20).types -+++ new.declarationFileForTsJsImport(module=node20).types -@@= skipped -25, +25 lines =@@ - >def8 : any - - import def9 from "./file.d.ts"; -->def9 : any -+>def9 : "bad3" - - import def10 from "./file.d.cts"; -->def10 : any -+>def10 : "bad8" - - import def11 from "./file.d.mts"; -->def11 : any -+>def11 : "bad7" - - import def12 from "./file.d.json.ts"; - >def12 : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt index 1a209608da7..04c3dfd21db 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== main.ts (1 errors) ==== import mod = require("./dir/native.node"); ~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt.diff deleted file mode 100644 index 393c0f3dc91..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== main.ts (1 errors) ==== - import mod = require("./dir/native.node"); - ~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js index 78bf96bca9b..0db936c68b8 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js @@ -12,7 +12,7 @@ mod.doNativeThing("good"); //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const mod = require("./dir/native.node"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +const mod = __require("./dir/native.node"); mod.doNativeThing("good"); diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js.diff deleted file mode 100644 index 7ce93acc7e9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js -@@= skipped -11, +11 lines =@@ - - - //// [main.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --const mod = __require("./dir/native.node"); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+const mod = require("./dir/native.node"); - mod.doNativeThing("good"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt deleted file mode 100644 index 3a719b8b37f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== main.ts (0 errors) ==== - import mod = require("./dir/native.node"); - mod.doNativeThing("good"); - -==== package.json (0 errors) ==== - {"type": "module"} -==== dir/package.json (0 errors) ==== - {"type": "commonjs"} -==== dir/native.d.node.ts (0 errors) ==== - export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt.diff deleted file mode 100644 index 7bfa0ba3ae6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== main.ts (0 errors) ==== -+ import mod = require("./dir/native.node"); -+ mod.doNativeThing("good"); -+ -+==== package.json (0 errors) ==== -+ {"type": "module"} -+==== dir/package.json (0 errors) ==== -+ {"type": "commonjs"} -+==== dir/native.d.node.ts (0 errors) ==== -+ export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js index 78bf96bca9b..0db936c68b8 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js @@ -12,7 +12,7 @@ mod.doNativeThing("good"); //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const mod = require("./dir/native.node"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +const mod = __require("./dir/native.node"); mod.doNativeThing("good"); diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js.diff deleted file mode 100644 index ef6b0c61746..00000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js -@@= skipped -11, +11 lines =@@ - - - //// [main.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --const mod = __require("./dir/native.node"); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+const mod = require("./dir/native.node"); - mod.doNativeThing("good"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt index f61aed64bcd..b16dc4624ac 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt @@ -1,36 +1,19 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /importer-cjs.cjs (1 errors) ==== +==== /importer-cjs.cjs (0 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); - ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (1 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); - ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. import Foo2 from "./exporter.mjs"; new Foo2(); import * as Foo3 from "./exporter.mjs"; new Foo3(); - ~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols index 2b49c038433..402ceeeb087 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols.diff deleted file mode 100644 index ce0bb9924b7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports1.symbols -+++ new.esmModuleExports1.symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types index 8818f3609f2..007d52ac90a 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types @@ -3,12 +3,12 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); >Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo === /importer-cts.cts === @@ -16,21 +16,21 @@ import Foo = require("./exporter.mjs"); >Foo : typeof Foo new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : typeof Foo new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : Foo +>Foo2 : typeof Foo import * as Foo3 from "./exporter.mjs"; >Foo3 : typeof Foo new Foo3(); ->new Foo3() : any +>new Foo3() : Foo >Foo3 : typeof Foo import { Oops } from "./exporter.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt index b1c323c94e2..ad250e27283 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt @@ -1,36 +1,37 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. +/importer-cts.cts(4,8): error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag /importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /importer-cjs.cjs (1 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (4 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import Foo2 from "./exporter.mjs"; + ~~~~ +!!! error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag new Foo2(); import * as Foo3 from "./exporter.mjs"; new Foo3(); ~~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols index 2652cf9cbb5..4bb8d4d0dfd 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols.diff deleted file mode 100644 index 226ecc2f1fd..00000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=false).symbols -+++ new.esmModuleExports2(esmoduleinterop=false).symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types index 56872a9d263..6db56832f25 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types @@ -2,36 +2,36 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); ->Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>Foo : "oops" +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" === /importer-cts.cts === import Foo = require("./exporter.mjs"); ->Foo : typeof Foo +>Foo : "oops" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : any new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : any +>Foo2 : any import * as Foo3 from "./exporter.mjs"; ->Foo3 : typeof Foo +>Foo3 : "oops" new Foo3(); >new Foo3() : any ->Foo3 : typeof Foo +>Foo3 : "oops" import { Oops } from "./exporter.mjs"; >Oops : any diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt index b1c323c94e2..a31f9bf4c20 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt @@ -1,36 +1,39 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. +/importer-cts.cts(5,5): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. /importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /importer-cjs.cjs (1 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (4 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import Foo2 from "./exporter.mjs"; new Foo2(); + ~~~~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. import * as Foo3 from "./exporter.mjs"; new Foo3(); ~~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols index 2652cf9cbb5..4bb8d4d0dfd 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols.diff deleted file mode 100644 index 04e49de5bfb..00000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=true).symbols -+++ new.esmModuleExports2(esmoduleinterop=true).symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types index 56872a9d263..3fcbf77e4cd 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types @@ -2,36 +2,36 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); ->Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>Foo : "oops" +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" === /importer-cts.cts === import Foo = require("./exporter.mjs"); ->Foo : typeof Foo +>Foo : "oops" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : "oops" new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : any +>Foo2 : "oops" import * as Foo3 from "./exporter.mjs"; ->Foo3 : typeof Foo +>Foo3 : "oops" new Foo3(); >new Foo3() : any ->Foo3 : typeof Foo +>Foo3 : "oops" import { Oops } from "./exporter.mjs"; >Oops : any diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt index 0d0eed7c815..c55cdee708b 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt @@ -1,36 +1,35 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. +/importer-cjs.cjs(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +/importer-cts.cts(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +/importer-cts.cts(5,5): error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. +/importer-cts.cts(8,5): error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /importer-cjs.cjs (1 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (4 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. import Foo2 from "./exporter.mjs"; new Foo2(); + ~~~~ +!!! error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo2' was exported here. import * as Foo3 from "./exporter.mjs"; new Foo3(); ~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo3' was exported here. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols index e2ee1705633..e23df06c878 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols.diff deleted file mode 100644 index bc4988cf0c6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports3.symbols -+++ new.esmModuleExports3.symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types index 5951c3d09b9..4f8612315e6 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types @@ -3,12 +3,12 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); >Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo === /importer-cts.cts === @@ -16,21 +16,21 @@ import Foo = require("./exporter.mjs"); >Foo : typeof Foo new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : typeof Foo new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : Foo +>Foo2 : typeof Foo import * as Foo3 from "./exporter.mjs"; >Foo3 : typeof Foo new Foo3(); ->new Foo3() : any +>new Foo3() : Foo >Foo3 : typeof Foo import { Oops } from "./exporter.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js b/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js index c438749f3f7..0565e4c96da 100644 --- a/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js +++ b/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js @@ -19,4 +19,8 @@ someFunc.someProp = 'yo'; //// [exportDefaultNamespace.d.ts] -export default function someFunc(): string; +declare function someFunc(): string; +export default someFunc; +declare namespace someFunc { + var someProp: string; +} diff --git a/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js.diff b/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js.diff index c5f3a3a1269..60f76909742 100644 --- a/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js.diff +++ b/testdata/baselines/reference/submodule/conformance/exportDefaultNamespace.js.diff @@ -1,12 +1,11 @@ --- old.exportDefaultNamespace.js +++ new.exportDefaultNamespace.js -@@= skipped -18, +18 lines =@@ - +@@= skipped -19, +19 lines =@@ //// [exportDefaultNamespace.d.ts] --declare function someFunc(): string; --declare namespace someFunc { -- var someProp: string; --} --export default someFunc; -+export default function someFunc(): string; \ No newline at end of file + declare function someFunc(): string; ++export default someFunc; + declare namespace someFunc { + var someProp: string; + } +-export default someFunc; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt index c917d3f6c1c..f2f160a4bd0 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. @@ -19,7 +18,6 @@ mod.mts(5,51): error TS2858: Import attribute values must be string literal expr mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== mod.mts (10 errors) ==== import * as thing1 from "./mod.mjs" with { field: 0 }; ~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt.diff deleted file mode 100644 index 84bd4c50e83..00000000000 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.importAttributes6(module=node20).errors.txt -+++ new.importAttributes6(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. -@@= skipped -17, +18 lines =@@ - mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== mod.mts (10 errors) ==== - import * as thing1 from "./mod.mjs" with { field: 0 }; - ~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js index e12f467618b..6d346c55c8e 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js @@ -10,5 +10,4 @@ import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; //// [mod.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js.diff deleted file mode 100644 index a8b3923a29b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.importAttributes6(module=node20).js -+++ new.importAttributes6(module=node20).js -@@= skipped -9, +9 lines =@@ - - - //// [mod.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js index 291c26285d9..c4da697a190 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js @@ -129,6 +129,9 @@ C2.staticProp = function (x, y) { //// [jsDeclarationsClassMethod.d.ts] declare function C1(): void; +declare namespace C1 { + var staticProp: (x: any, y: any) => any; +} declare class C2 { /** * A comment method1 @@ -138,3 +141,6 @@ declare class C2 { */ method1(x: number, y: number): number; } +declare namespace C2 { + var staticProp: (x: any, y: any) => any; +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff index 1520c1ddf2d..864b04d0c79 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassMethod.js.diff @@ -20,7 +20,7 @@ - */ - method(x: number, y: number): number; -} --declare namespace C1 { + declare namespace C1 { - /** - * A comment staticProp - * @param {number} x @@ -28,11 +28,11 @@ - * @returns {number} - */ - function staticProp(x: number, y: number): number; --} ++ var staticProp: (x: any, y: any) => any; + } declare class C2 { /** - * A comment method1 -@@= skipped -33, +8 lines =@@ +@@= skipped -33, +11 lines =@@ * @returns {number} */ method1(x: number, y: number): number; @@ -43,8 +43,8 @@ - * @returns {number} - */ - method2(x: number, y: number): number; --} --declare namespace C2 { + } + declare namespace C2 { - /** - * A comment staticProp - * @param {number} x @@ -52,4 +52,5 @@ - * @returns {number} - */ - function staticProp(x: number, y: number): number; ++ var staticProp: (x: any, y: any) => any; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js index 7b130e681b1..72c30e4c2a3 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js @@ -52,6 +52,9 @@ module.exports.Strings = Strings; //// [source.d.ts] +declare namespace Handler { + var statische: () => void; +} export = Handler; export var Strings = Strings; export type HandlerOptions = { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js.diff index 7b335ba61e7..17b3390c8fd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic.js.diff @@ -19,15 +19,16 @@ module.exports.Strings = Strings; /** * @typedef {Object} HandlerOptions -@@= skipped -11, +13 lines =@@ +@@= skipped -10, +12 lines =@@ + //// [source.d.ts] - export = Handler; +-export = Handler; -declare class Handler { - static get OPTIONS(): number; - process(): void; -} --declare namespace Handler { + declare namespace Handler { - export { statische, Strings, HandlerOptions }; -} -declare function statische(): void; @@ -40,6 +41,9 @@ - * Should be able to export a type alias at the same time. - */ - name: string; ++ var statische: () => void; ++} ++export = Handler; +export var Strings = Strings; +export type HandlerOptions = { + name: String; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js index 96bb98ab890..84f368712e0 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js @@ -22,6 +22,8 @@ declare class Base { } export declare class Foo extends Base { } -export {}; +export declare namespace Foo { + var foo: string; +} //// [Bar.d.ts] export {}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js.diff index f0e6cd53018..24118c93471 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassStatic2.js.diff @@ -11,8 +11,12 @@ -} declare class Base { static foo: string; -+} -+export declare class Foo extends Base { } - export {}; - //// [Bar.d.ts] \ No newline at end of file +-export {}; ++export declare class Foo extends Base { ++} ++export declare namespace Foo { ++ var foo: string; ++} + //// [Bar.d.ts] + export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js index 8038dc59938..479a6ab8220 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js @@ -158,6 +158,44 @@ export type State = { timer: Timer; hook: Hook; }; +/** + * Imports + * + * @typedef {import("./timer")} Timer + * @typedef {import("./hook")} Hook + * @typedef {import("./hook").HookHandler} HookHandler + */ +/** + * Input type definition + * + * @typedef {Object} Input + * @prop {Timer} timer + * @prop {Hook} hook + */ +/** + * State type definition + * + * @typedef {Object} State + * @prop {Timer} timer + * @prop {Hook} hook + */ +/** + * New `Context` + * + * @class + * @param {Input} input + */ +declare function Context(input: Input): any; +declare namespace Context { + var prototype: { + /** + * @param {Input} input + * @param {HookHandler=} handle + * @returns {State} + */ + construct(input: Input, handle?: any): State; + }; +} export = Context; //// [hook.d.ts] export type HookHandler = (arg: import("./context")) => void; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff index 6f918307d36..f4d945f5273 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionClassesCjsExportAssignment.js.diff @@ -46,6 +46,7 @@ - timeout: number; -} //// [context.d.ts] +-export = Context; +export type Timer = import("./timer"); +export type Hook = import("./hook"); +export type HookHandler = import("./hook").HookHandler; @@ -57,34 +58,13 @@ + timer: Timer; + hook: Hook; +}; - export = Context; --/** -- * Imports -- * -- * @typedef {import("./timer")} Timer -- * @typedef {import("./hook")} Hook -- * @typedef {import("./hook").HookHandler} HookHandler -- */ --/** -- * Input type definition -- * -- * @typedef {Object} Input -- * @prop {Timer} timer -- * @prop {Hook} hook -- */ --/** -- * State type definition -- * -- * @typedef {Object} State -- * @prop {Timer} timer -- * @prop {Hook} hook -- */ --/** -- * New `Context` -- * -- * @class -- * @param {Input} input -- */ + /** + * Imports + * +@@= skipped -45, +45 lines =@@ + * @class + * @param {Input} input + */ -declare function Context(input: Input): Context; -declare class Context { - /** @@ -123,9 +103,18 @@ - */ - construct(input: Input, handle?: HookHandler | undefined): State; -} --declare namespace Context { ++declare function Context(input: Input): any; + declare namespace Context { - export { Timer, Hook, HookHandler, Input, State }; --} ++ var prototype: { ++ /** ++ * @param {Input} input ++ * @param {HookHandler=} handle ++ * @returns {State} ++ */ ++ construct(input: Input, handle?: any): State; ++ }; + } -/** - * Imports - */ @@ -152,6 +141,7 @@ - timer: Timer; - hook: Hook; -}; ++export = Context; //// [hook.d.ts] +export type HookHandler = (arg: import("./context")) => void; export = Hook; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js index 4b6e7dcc704..f5a429881b1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js @@ -25,5 +25,22 @@ baz.normal = false; //// [source.d.ts] declare function foo(): void; +declare namespace foo { + var _a: boolean; + export { _a as null }; +} declare function bar(): void; +declare namespace bar { + var async: boolean; +} +declare namespace bar { + var normal: boolean; +} declare function baz(): void; +declare namespace baz { + var _b: boolean; + export { _b as class }; +} +declare namespace baz { + var normal: boolean; +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js.diff index d529325b103..ca0bf04d420 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordProp.js.diff @@ -1,22 +1,32 @@ --- old.jsDeclarationsFunctionKeywordProp.js +++ new.jsDeclarationsFunctionKeywordProp.js -@@= skipped -24, +24 lines =@@ - +@@= skipped -25, +25 lines =@@ //// [source.d.ts] declare function foo(): void; --declare namespace foo { + declare namespace foo { - let _null: boolean; - export { _null as null }; --} ++ var _a: boolean; ++ export { _a as null }; + } declare function bar(): void; --declare namespace bar { + declare namespace bar { - let async: boolean; - let normal: boolean; --} ++ var async: boolean; ++} ++declare namespace bar { ++ var normal: boolean; + } declare function baz(): void; --declare namespace baz { + declare namespace baz { - let _class: boolean; - export { _class as class }; - let normal_1: boolean; - export { normal_1 as normal }; --} \ No newline at end of file ++ var _b: boolean; ++ export { _b as class }; ++} ++declare namespace baz { ++ var normal: boolean; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js index b7bc4713a4f..b8eb1d30f9d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js @@ -170,3 +170,282 @@ foo.of = 1; //// [source.d.ts] declare function foo(): void; +declare namespace foo { + var x: number; +} +declare namespace foo { + var y: number; +} +declare namespace foo { + var _a: number; + export { _a as break }; +} +declare namespace foo { + var _b: number; + export { _b as case }; +} +declare namespace foo { + var _c: number; + export { _c as catch }; +} +declare namespace foo { + var _d: number; + export { _d as class }; +} +declare namespace foo { + var _e: number; + export { _e as const }; +} +declare namespace foo { + var _f: number; + export { _f as continue }; +} +declare namespace foo { + var _g: number; + export { _g as debugger }; +} +declare namespace foo { + var _h: number; + export { _h as default }; +} +declare namespace foo { + var _j: number; + export { _j as delete }; +} +declare namespace foo { + var _k: number; + export { _k as do }; +} +declare namespace foo { + var _l: number; + export { _l as else }; +} +declare namespace foo { + var _m: number; + export { _m as enum }; +} +declare namespace foo { + var _o: number; + export { _o as export }; +} +declare namespace foo { + var _p: number; + export { _p as extends }; +} +declare namespace foo { + var _q: number; + export { _q as false }; +} +declare namespace foo { + var _r: number; + export { _r as finally }; +} +declare namespace foo { + var _s: number; + export { _s as for }; +} +declare namespace foo { + var _t: number; + export { _t as function }; +} +declare namespace foo { + var _u: number; + export { _u as if }; +} +declare namespace foo { + var _v: number; + export { _v as import }; +} +declare namespace foo { + var _w: number; + export { _w as in }; +} +declare namespace foo { + var _x: number; + export { _x as instanceof }; +} +declare namespace foo { + var _y: number; + export { _y as new }; +} +declare namespace foo { + var _z: number; + export { _z as null }; +} +declare namespace foo { + var _0: number; + export { _0 as return }; +} +declare namespace foo { + var _1: number; + export { _1 as super }; +} +declare namespace foo { + var _2: number; + export { _2 as switch }; +} +declare namespace foo { + var _3: number; + export { _3 as this }; +} +declare namespace foo { + var _4: number; + export { _4 as throw }; +} +declare namespace foo { + var _5: number; + export { _5 as true }; +} +declare namespace foo { + var _6: number; + export { _6 as try }; +} +declare namespace foo { + var _7: number; + export { _7 as typeof }; +} +declare namespace foo { + var _8: number; + export { _8 as var }; +} +declare namespace foo { + var _9: number; + export { _9 as void }; +} +declare namespace foo { + var _10: number; + export { _10 as while }; +} +declare namespace foo { + var _11: number; + export { _11 as with }; +} +declare namespace foo { + var _12: number; + export { _12 as implements }; +} +declare namespace foo { + var _13: number; + export { _13 as interface }; +} +declare namespace foo { + var _14: number; + export { _14 as let }; +} +declare namespace foo { + var _15: number; + export { _15 as package }; +} +declare namespace foo { + var _16: number; + export { _16 as private }; +} +declare namespace foo { + var _17: number; + export { _17 as protected }; +} +declare namespace foo { + var _18: number; + export { _18 as public }; +} +declare namespace foo { + var _19: number; + export { _19 as static }; +} +declare namespace foo { + var _20: number; + export { _20 as yield }; +} +declare namespace foo { + var abstract: number; +} +declare namespace foo { + var as: number; +} +declare namespace foo { + var asserts: number; +} +declare namespace foo { + var any: number; +} +declare namespace foo { + var async: number; +} +declare namespace foo { + var await: number; +} +declare namespace foo { + var boolean: number; +} +declare namespace foo { + var constructor: number; +} +declare namespace foo { + var declare: number; +} +declare namespace foo { + var get: number; +} +declare namespace foo { + var infer: number; +} +declare namespace foo { + var is: number; +} +declare namespace foo { + var keyof: number; +} +declare namespace foo { + var module: number; +} +declare namespace foo { + var namespace: number; +} +declare namespace foo { + var never: number; +} +declare namespace foo { + var readonly: number; +} +declare namespace foo { + var require: number; +} +declare namespace foo { + var number: number; +} +declare namespace foo { + var object: number; +} +declare namespace foo { + var set: number; +} +declare namespace foo { + var string: number; +} +declare namespace foo { + var symbol: number; +} +declare namespace foo { + var type: number; +} +declare namespace foo { + var undefined: number; +} +declare namespace foo { + var unique: number; +} +declare namespace foo { + var unknown: number; +} +declare namespace foo { + var from: number; +} +declare namespace foo { + var global: number; +} +declare namespace foo { + var bigint: number; +} +declare namespace foo { + var of: number; +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js.diff index fa3f8693136..4dc3c418c2e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionKeywordPropExhaustive.js.diff @@ -1,10 +1,9 @@ --- old.jsDeclarationsFunctionKeywordPropExhaustive.js +++ new.jsDeclarationsFunctionKeywordPropExhaustive.js -@@= skipped -169, +169 lines =@@ - +@@= skipped -170, +170 lines =@@ //// [source.d.ts] declare function foo(): void; --declare namespace foo { + declare namespace foo { - export let x: number; - export let y: number; - let _break: number; @@ -128,4 +127,281 @@ - export let global: number; - export let bigint: number; - export let of: number; --} \ No newline at end of file ++ var x: number; ++} ++declare namespace foo { ++ var y: number; ++} ++declare namespace foo { ++ var _a: number; ++ export { _a as break }; ++} ++declare namespace foo { ++ var _b: number; ++ export { _b as case }; ++} ++declare namespace foo { ++ var _c: number; ++ export { _c as catch }; ++} ++declare namespace foo { ++ var _d: number; ++ export { _d as class }; ++} ++declare namespace foo { ++ var _e: number; ++ export { _e as const }; ++} ++declare namespace foo { ++ var _f: number; ++ export { _f as continue }; ++} ++declare namespace foo { ++ var _g: number; ++ export { _g as debugger }; ++} ++declare namespace foo { ++ var _h: number; ++ export { _h as default }; ++} ++declare namespace foo { ++ var _j: number; ++ export { _j as delete }; ++} ++declare namespace foo { ++ var _k: number; ++ export { _k as do }; ++} ++declare namespace foo { ++ var _l: number; ++ export { _l as else }; ++} ++declare namespace foo { ++ var _m: number; ++ export { _m as enum }; ++} ++declare namespace foo { ++ var _o: number; ++ export { _o as export }; ++} ++declare namespace foo { ++ var _p: number; ++ export { _p as extends }; ++} ++declare namespace foo { ++ var _q: number; ++ export { _q as false }; ++} ++declare namespace foo { ++ var _r: number; ++ export { _r as finally }; ++} ++declare namespace foo { ++ var _s: number; ++ export { _s as for }; ++} ++declare namespace foo { ++ var _t: number; ++ export { _t as function }; ++} ++declare namespace foo { ++ var _u: number; ++ export { _u as if }; ++} ++declare namespace foo { ++ var _v: number; ++ export { _v as import }; ++} ++declare namespace foo { ++ var _w: number; ++ export { _w as in }; ++} ++declare namespace foo { ++ var _x: number; ++ export { _x as instanceof }; ++} ++declare namespace foo { ++ var _y: number; ++ export { _y as new }; ++} ++declare namespace foo { ++ var _z: number; ++ export { _z as null }; ++} ++declare namespace foo { ++ var _0: number; ++ export { _0 as return }; ++} ++declare namespace foo { ++ var _1: number; ++ export { _1 as super }; ++} ++declare namespace foo { ++ var _2: number; ++ export { _2 as switch }; ++} ++declare namespace foo { ++ var _3: number; ++ export { _3 as this }; ++} ++declare namespace foo { ++ var _4: number; ++ export { _4 as throw }; ++} ++declare namespace foo { ++ var _5: number; ++ export { _5 as true }; ++} ++declare namespace foo { ++ var _6: number; ++ export { _6 as try }; ++} ++declare namespace foo { ++ var _7: number; ++ export { _7 as typeof }; ++} ++declare namespace foo { ++ var _8: number; ++ export { _8 as var }; ++} ++declare namespace foo { ++ var _9: number; ++ export { _9 as void }; ++} ++declare namespace foo { ++ var _10: number; ++ export { _10 as while }; ++} ++declare namespace foo { ++ var _11: number; ++ export { _11 as with }; ++} ++declare namespace foo { ++ var _12: number; ++ export { _12 as implements }; ++} ++declare namespace foo { ++ var _13: number; ++ export { _13 as interface }; ++} ++declare namespace foo { ++ var _14: number; ++ export { _14 as let }; ++} ++declare namespace foo { ++ var _15: number; ++ export { _15 as package }; ++} ++declare namespace foo { ++ var _16: number; ++ export { _16 as private }; ++} ++declare namespace foo { ++ var _17: number; ++ export { _17 as protected }; ++} ++declare namespace foo { ++ var _18: number; ++ export { _18 as public }; ++} ++declare namespace foo { ++ var _19: number; ++ export { _19 as static }; ++} ++declare namespace foo { ++ var _20: number; ++ export { _20 as yield }; ++} ++declare namespace foo { ++ var abstract: number; ++} ++declare namespace foo { ++ var as: number; ++} ++declare namespace foo { ++ var asserts: number; ++} ++declare namespace foo { ++ var any: number; ++} ++declare namespace foo { ++ var async: number; ++} ++declare namespace foo { ++ var await: number; ++} ++declare namespace foo { ++ var boolean: number; ++} ++declare namespace foo { ++ var constructor: number; ++} ++declare namespace foo { ++ var declare: number; ++} ++declare namespace foo { ++ var get: number; ++} ++declare namespace foo { ++ var infer: number; ++} ++declare namespace foo { ++ var is: number; ++} ++declare namespace foo { ++ var keyof: number; ++} ++declare namespace foo { ++ var module: number; ++} ++declare namespace foo { ++ var namespace: number; ++} ++declare namespace foo { ++ var never: number; ++} ++declare namespace foo { ++ var readonly: number; ++} ++declare namespace foo { ++ var require: number; ++} ++declare namespace foo { ++ var number: number; ++} ++declare namespace foo { ++ var object: number; ++} ++declare namespace foo { ++ var set: number; ++} ++declare namespace foo { ++ var string: number; ++} ++declare namespace foo { ++ var symbol: number; ++} ++declare namespace foo { ++ var type: number; ++} ++declare namespace foo { ++ var undefined: number; ++} ++declare namespace foo { ++ var unique: number; ++} ++declare namespace foo { ++ var unknown: number; ++} ++declare namespace foo { ++ var from: number; ++} ++declare namespace foo { ++ var global: number; ++} ++declare namespace foo { ++ var bigint: number; ++} ++declare namespace foo { ++ var of: number; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js index 48d14973857..8a89d1edb43 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js @@ -159,10 +159,26 @@ exports.origin = new source_1.Point2D(0, 0); * @param {number} len */ export declare function Vec(len: number): void; +export declare namespace Vec { + var prototype: { + /** + * @param {Vec} other + */ + dot(other: Vec): number; + magnitude(): number; + }; +} /** * @param {number} x * @param {number} y */ export declare function Point2D(x: number, y: number): any; +export declare namespace Point2D { + var prototype: { + __proto__: typeof Vec; + x: number; + y: number; + }; +} //// [referencer.d.ts] export declare const origin: any; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js.diff index f1c814c9f13..ed8d9f8f757 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionLikeClasses2.js.diff @@ -28,8 +28,16 @@ - */ - dot(other: Vec): number; - magnitude(): number; --} +export declare function Vec(len: number): void; ++export declare namespace Vec { ++ var prototype: { ++ /** ++ * @param {Vec} other ++ */ ++ dot(other: Vec): number; ++ magnitude(): number; ++ }; + } /** * @param {number} x * @param {number} y @@ -52,8 +60,14 @@ - set y(y: number); - get y(): number; - __proto__: typeof Vec; --} +export declare function Point2D(x: number, y: number): any; ++export declare namespace Point2D { ++ var prototype: { ++ __proto__: typeof Vec; ++ x: number; ++ y: number; ++ }; + } //// [referencer.d.ts] -export const origin: Point2D; -import { Point2D } from "./source"; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js index 25aba9ecba1..e3f53cb2290 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js @@ -34,6 +34,13 @@ MyClass.staticProperty = 123; //// [source.d.ts] export = MyClass; +declare function MyClass(): void; +declare namespace MyClass { + var staticMethod: () => void; +} +declare namespace MyClass { + var staticProperty: number; +} export type DoneCB = (failures: number) ; /** * Callback to be invoked when test execution is complete. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff index a39243d2a79..c52be93a6e2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionPrototypeStatic.js.diff @@ -10,11 +10,10 @@ module.exports = MyClass; function MyClass() { } MyClass.staticMethod = function () { }; -@@= skipped -15, +18 lines =@@ - +@@= skipped -16, +19 lines =@@ //// [source.d.ts] export = MyClass; --declare function MyClass(): void; + declare function MyClass(): void; -declare class MyClass { - method(): void; -} @@ -23,6 +22,12 @@ -} -declare function staticMethod(): void; -declare var staticProperty: number; ++declare namespace MyClass { ++ var staticMethod: () => void; ++} ++declare namespace MyClass { ++ var staticProperty: number; ++} +export type DoneCB = (failures: number) ; /** * Callback to be invoked when test execution is complete. diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js index d76ffef284b..8a62f4e062c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js @@ -16,17 +16,12 @@ module.exports = foo; //// [index.d.ts] +declare function foo(): void; +declare namespace foo { + var foo: typeof import("."); +} +declare namespace foo { + var _a: typeof import("."); + export { _a as default }; +} export = foo; - - -//// [DtsFileErrors] - - -out/index.d.ts(1,10): error TS2304: Cannot find name 'foo'. - - -==== out/index.d.ts (1 errors) ==== - export = foo; - ~~~ -!!! error TS2304: Cannot find name 'foo'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js.diff index b57b340c632..9b567ef4486 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctionWithDefaultAssignedMember.js.diff @@ -9,22 +9,16 @@ //// [index.d.ts] - export = foo; --declare function foo(): void; --declare namespace foo { +-export = foo; + declare function foo(): void; + declare namespace foo { - export { foo }; - export { foo as default }; -} -+ -+ -+//// [DtsFileErrors] -+ -+ -+out/index.d.ts(1,10): error TS2304: Cannot find name 'foo'. -+ -+ -+==== out/index.d.ts (1 errors) ==== -+ export = foo; -+ ~~~ -+!!! error TS2304: Cannot find name 'foo'. -+ \ No newline at end of file ++ var foo: typeof import("."); ++} ++declare namespace foo { ++ var _a: typeof import("."); ++ export { _a as default }; ++} ++export = foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js index 7a1612bab4d..8aa44cbc275 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js @@ -123,7 +123,15 @@ function j() { } //// [index.d.ts] export declare function a(): void; export declare function b(): void; +export declare namespace b { + var cat: string; +} export declare function c(): void; +export declare namespace c { + var Cls: { + new (): {}; + }; +} /** * @param {number} a * @param {number} b @@ -142,6 +150,9 @@ export declare function e(a: T, b: U): T & U; * @param {T} a */ export declare function f(a: T): T; +export declare namespace f { + var self: typeof f; +} /** * @param {{x: string}} a * @param {{y: typeof b}} b diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js.diff index 75088fe6e6e..8e2b016ad73 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsFunctions.js.diff @@ -25,14 +25,20 @@ -export function b(): void; -export namespace b { - let cat: string; --} ++export declare function a(): void; ++export declare function b(): void; ++export declare namespace b { ++ var cat: string; + } -export function c(): void; -export namespace c { - export { Cls }; --} -+export declare function a(): void; -+export declare function b(): void; +export declare function c(): void; ++export declare namespace c { ++ var Cls: { ++ new (): {}; ++ }; + } /** * @param {number} a * @param {number} b @@ -59,8 +65,10 @@ -export function i(): void; -export function j(): void; -declare class Cls { --} +export declare function f(a: T): T; ++export declare namespace f { ++ var self: typeof f; + } /** * @param {{x: string}} a * @param {{y: typeof b}} b @@ -77,7 +85,7 @@ /** * @param {{x: string}} a * @param {{y: typeof b}} b -@@= skipped -50, +38 lines =@@ +@@= skipped -50, +49 lines =@@ declare function hh(a: { x: string; }, b: { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js index 6be074102e7..f707949cf48 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js @@ -62,6 +62,13 @@ export {}; //// [base.d.ts] +declare class Base { + constructor(); +} +declare function BaseFactory(): Base; +declare namespace BaseFactory { + var Base: typeof Base; +} export = BaseFactory; //// [file.d.ts] export type BaseFactory = import('./base'); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js.diff index f2dae38cd59..13850b4946a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit1.js.diff @@ -16,13 +16,19 @@ //// [base.d.ts] - export = BaseFactory; --declare function BaseFactory(): Base; --declare namespace BaseFactory { +-export = BaseFactory; ++declare class Base { ++ constructor(); ++} + declare function BaseFactory(): Base; + declare namespace BaseFactory { - export { Base }; -} -declare class Base { -} ++ var Base: typeof Base; ++} ++export = BaseFactory; //// [file.d.ts] -type couldntThinkOfAny = { - (): {}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js index 3c6498cabfb..25a713c08c6 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js @@ -50,6 +50,13 @@ export {}; //// [base.d.ts] +declare class Base { + constructor(); +} +declare function BaseFactory(): Base; +declare namespace BaseFactory { + var Base: typeof Base; +} export = BaseFactory; //// [file.d.ts] export type BaseFactory = typeof import('./base'); diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js.diff index 4e00b4f79be..9f430cfe7ab 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsParameterTagReusesInputNodeInEmit2.js.diff @@ -16,13 +16,19 @@ //// [base.d.ts] - export = BaseFactory; --declare function BaseFactory(): Base; --declare namespace BaseFactory { +-export = BaseFactory; ++declare class Base { ++ constructor(); ++} + declare function BaseFactory(): Base; + declare namespace BaseFactory { - export { Base }; -} -declare class Base { -} ++ var Base: typeof Base; ++} ++export = BaseFactory; //// [file.d.ts] -/** @typedef {typeof import('./base')} BaseFactory */ -/** diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js index 8f6c583f8a6..41c2f8c81bb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js @@ -186,47 +186,57 @@ exports.default = Tree; //// [jsDeclarationsReactComponents1.d.ts] /// import PropTypes from "prop-types"; -declare const TabbedShowLayout: { - ({}: {}): JSX.Element; - propTypes: { +declare function TabbedShowLayout({}: {}): JSX.Element; +declare namespace TabbedShowLayout { + var propTypes: { version: PropTypes.Requireable; }; - defaultProps: { +} +declare namespace TabbedShowLayout { + var defaultProps: { tabs: undefined; }; -}; +} export default TabbedShowLayout; //// [jsDeclarationsReactComponents2.d.ts] import React from "react"; -/** - * @type {React.SFC} - */ -declare const TabbedShowLayout: React.SFC; +declare function TabbedShowLayout(): JSX.Element; +declare namespace TabbedShowLayout { + var defaultProps: Partial<{}> | undefined; +} export default TabbedShowLayout; //// [jsDeclarationsReactComponents3.d.ts] -/** - * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} - */ -declare const TabbedShowLayout: { - defaultProps: { +declare function TabbedShowLayout(): JSX.Element; +declare namespace TabbedShowLayout { + var defaultProps: { tabs: string; }; -} & ((props?: { - elem: string; -}) => JSX.Element); +} export default TabbedShowLayout; //// [jsDeclarationsReactComponents4.d.ts] -declare const TabbedShowLayout: { - (prop: { - className: string; - }): JSX.Element; - defaultProps: { +declare function TabbedShowLayout(/** @type {{className: string}}*/ prop: { + className: string; +}): JSX.Element; +declare namespace TabbedShowLayout { + var defaultProps: { tabs: string; }; -}; +} export default TabbedShowLayout; //// [jsDeclarationsReactComponents5.d.ts] +import PropTypes from 'prop-types'; declare function Tree({ allowDropOnRoot }: { allowDropOnRoot: any; }): JSX.Element; +declare namespace Tree { + var propTypes: { + classes: PropTypes.Requireable; + }; +} +declare namespace Tree { + var defaultProps: { + classes: {}; + parentSource: string; + }; +} export default Tree; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js.diff index 0422126dd6c..4e509eca1cf 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReactComponents.js.diff @@ -64,15 +64,17 @@ - } -} import PropTypes from "prop-types"; -+declare const TabbedShowLayout: { -+ ({}: {}): JSX.Element; -+ propTypes: { ++declare function TabbedShowLayout({}: {}): JSX.Element; ++declare namespace TabbedShowLayout { ++ var propTypes: { + version: PropTypes.Requireable; + }; -+ defaultProps: { ++} ++declare namespace TabbedShowLayout { ++ var defaultProps: { + tabs: undefined; + }; -+}; ++} +export default TabbedShowLayout; //// [jsDeclarationsReactComponents2.d.ts] -export default TabbedShowLayout; @@ -81,45 +83,50 @@ - */ -declare const TabbedShowLayout: React.SFC; import React from "react"; -+/** -+ * @type {React.SFC} -+ */ -+declare const TabbedShowLayout: React.SFC; ++declare function TabbedShowLayout(): JSX.Element; ++declare namespace TabbedShowLayout { ++ var defaultProps: Partial<{}> | undefined; ++} +export default TabbedShowLayout; //// [jsDeclarationsReactComponents3.d.ts] -export default TabbedShowLayout; - /** - * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} - */ -@@= skipped -30, +29 lines =@@ - } & ((props?: { - elem: string; - }) => JSX.Element); +-/** +- * @type {{defaultProps: {tabs: string}} & ((props?: {elem: string}) => JSX.Element)} +- */ +-declare const TabbedShowLayout: { +- defaultProps: { ++declare function TabbedShowLayout(): JSX.Element; ++declare namespace TabbedShowLayout { ++ var defaultProps: { + tabs: string; + }; +-} & ((props?: { +- elem: string; +-}) => JSX.Element); ++} +export default TabbedShowLayout; //// [jsDeclarationsReactComponents4.d.ts] -+declare const TabbedShowLayout: { -+ (prop: { -+ className: string; -+ }): JSX.Element; -+ defaultProps: { -+ tabs: string; -+ }; -+}; - export default TabbedShowLayout; +-export default TabbedShowLayout; -declare function TabbedShowLayout(prop: { -- className: string; --}): JSX.Element; --declare namespace TabbedShowLayout { ++declare function TabbedShowLayout(/** @type {{className: string}}*/ prop: { + className: string; + }): JSX.Element; + declare namespace TabbedShowLayout { - namespace defaultProps { - let tabs: string; - } --} ++ var defaultProps: { ++ tabs: string; ++ }; + } ++export default TabbedShowLayout; //// [jsDeclarationsReactComponents5.d.ts] -export default Tree; ++import PropTypes from 'prop-types'; declare function Tree({ allowDropOnRoot }: { allowDropOnRoot: any; }): JSX.Element; --declare namespace Tree { + declare namespace Tree { - namespace propTypes { - let classes: PropTypes.Requireable; - } @@ -130,4 +137,14 @@ - } -} -import PropTypes from 'prop-types'; ++ var propTypes: { ++ classes: PropTypes.Requireable; ++ }; ++} ++declare namespace Tree { ++ var defaultProps: { ++ classes: {}; ++ parentSource: string; ++ }; ++} +export default Tree; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js index 83f4b967b41..3d7bf0d2a6c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js @@ -83,6 +83,13 @@ declare var Ns: { /** @implements {A} */ C5: any; }; +declare namespace Ns { + var C1: { + new (): { + method(): number; + }; + }; +} /** @implements {A} */ declare var C2: { new (): { @@ -106,3 +113,6 @@ declare class CC { }; } declare var C5: any; +declare namespace Ns { + var C5: any; +} diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js.diff b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js.diff index 97a55138f3e..7119367ce65 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.js.diff @@ -4,23 +4,24 @@ /** @implements {A} */ declare class B3 implements A { } --declare namespace Ns { -- export { C1 }; -- export let C5: { +declare var Ns: { + /** @implements {A} */ + C1: { - new (): { - method(): number; - }; - }; --} ++ new (): { ++ method(): number; ++ }; ++ }; + /** @implements {A} */ + C5: any; +}; - /** @implements {A} */ - declare var C2: { - new (): { + declare namespace Ns { +- export { C1 }; +- export let C5: { ++ var C1: { + new (): { + method(): number; + }; +@@= skipped -14, +23 lines =@@ method(): number; }; }; @@ -38,7 +39,7 @@ declare class CC { /** @implements {A} */ C4: { -@@= skipped -26, +33 lines =@@ +@@= skipped -12, +17 lines =@@ }; } declare var C5: any; @@ -47,4 +48,6 @@ -} -declare class C3 implements A { - method(): number; --} \ No newline at end of file ++declare namespace Ns { ++ var C5: any; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js index 06f320fa23d..3b4e816e48e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js @@ -18,5 +18,4 @@ function foo() { return ""; } //// [bar.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js.diff deleted file mode 100644 index e729492b37e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.moduleResolutionWithoutExtension3(module=node20).js -+++ new.moduleResolutionWithoutExtension3(module=node20).js -@@= skipped -17, +17 lines =@@ - return ""; - } - //// [bar.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js index 698f97a9cf6..9fe42ebd8fb 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js @@ -18,5 +18,4 @@ function foo() { return ""; } //// [bar.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js.diff deleted file mode 100644 index 5314e4fd273..00000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.moduleResolutionWithoutExtension4(module=node20).js -+++ new.moduleResolutionWithoutExtension4(module=node20).js -@@= skipped -17, +17 lines =@@ - return ""; - } - //// [bar.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt index dfb944408bb..4454c8d1b0f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt @@ -1,11 +1,9 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. index.cjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.js(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.mjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.js (1 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js index b7f552a39e5..1498e98d796 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +const self = __importStar(require("package")); self; diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js.diff deleted file mode 100644 index 3c3d7286976..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeAllowJsPackageSelfName(module=node20).js -+++ new.nodeAllowJsPackageSelfName(module=node20).js -@@= skipped -20, +20 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const self = __importStar(require("package")); -+const self = require("package"); - self; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types index bcf4d980224..c7114915539 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types.diff deleted file mode 100644 index ee176e39532..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModules1(module=node16).types -+++ new.nodeModules1(module=node16).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types index bcf4d980224..c7114915539 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff deleted file mode 100644 index 2d868cb3bdd..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModules1(module=node18).types -+++ new.nodeModules1(module=node18).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt index 48acd287e6f..52d56aff661 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt @@ -1,42 +1,60 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.cts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.ts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.ts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.ts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.ts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = 1; @@ -73,7 +91,7 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // cjs format file const x = 1; export {x}; -==== index.mts (11 errors) ==== +==== index.mts (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -88,16 +106,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -148,38 +188,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; @@ -260,42 +300,42 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; -==== index.ts (11 errors) ==== +==== index.ts (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -310,16 +350,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -370,38 +432,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt.diff deleted file mode 100644 index 8ccc1ca488f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt.diff +++ /dev/null @@ -1,377 +0,0 @@ ---- old.nodeModules1(module=node20).errors.txt -+++ new.nodeModules1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.cts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.cts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.ts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.ts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.ts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.ts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.cts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== subfolder/index.ts (0 errors) ==== - // cjs format file - const x = 1; -@@= skipped -90, +72 lines =@@ - // cjs format file - const x = 1; - export {x}; --==== index.mts (22 errors) ==== -+==== index.mts (11 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -15, +15 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -82, +60 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - // esm format file - const x = 1; -@@= skipped -112, +112 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // cjs format file - const x = 1; - export {x}; --==== index.ts (22 errors) ==== -+==== index.ts (11 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -50, +50 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -82, +60 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // esm format file - const x = 1; - export {x}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js index c4d68e41d70..bfebc4d12e8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js @@ -335,12 +335,9 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -356,26 +353,17 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -385,33 +373,66 @@ const x = 1; exports.x = x; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; // ESM-format imports below should issue errors -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +const m1 = __importStar(require("./index.js")); +const m2 = __importStar(require("./index.mjs")); +const m3 = __importStar(require("./index.cjs")); +const m4 = __importStar(require("./subfolder/index.js")); +const m5 = __importStar(require("./subfolder/index.mjs")); +const m6 = __importStar(require("./subfolder/index.cjs")); +const m7 = __importStar(require("./subfolder2/index.js")); +const m8 = __importStar(require("./subfolder2/index.mjs")); +const m9 = __importStar(require("./subfolder2/index.cjs")); +const m10 = __importStar(require("./subfolder2/another/index.js")); +const m11 = __importStar(require("./subfolder2/another/index.mjs")); +const m12 = __importStar(require("./subfolder2/another/index.cjs")); // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +const m13 = __importStar(require("./")); +const m14 = __importStar(require("./index")); +const m15 = __importStar(require("./subfolder")); +const m16 = __importStar(require("./subfolder/")); +const m17 = __importStar(require("./subfolder/index")); +const m18 = __importStar(require("./subfolder2")); +const m19 = __importStar(require("./subfolder2/")); +const m20 = __importStar(require("./subfolder2/index")); +const m21 = __importStar(require("./subfolder2/another")); +const m22 = __importStar(require("./subfolder2/another/")); +const m23 = __importStar(require("./subfolder2/another/index")); void m1; void m2; void m3; @@ -474,33 +495,32 @@ const _m45 = import("./subfolder2/another/index"); const x = 1; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -525,17 +545,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -561,35 +581,34 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -614,17 +633,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -650,7 +669,7 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js.diff deleted file mode 100644 index 4a5b449127d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js.diff +++ /dev/null @@ -1,368 +0,0 @@ ---- old.nodeModules1(module=node20).js -+++ new.nodeModules1(module=node20).js -@@= skipped -334, +334 lines =@@ - const x = 1; - exports.x = x; - //// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --// esm format file --const x = 1; --export { x }; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.cjs] --"use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; - // ESM-format imports below should issue errors --const m1 = __importStar(require("./index.js")); --const m2 = __importStar(require("./index.mjs")); --const m3 = __importStar(require("./index.cjs")); --const m4 = __importStar(require("./subfolder/index.js")); --const m5 = __importStar(require("./subfolder/index.mjs")); --const m6 = __importStar(require("./subfolder/index.cjs")); --const m7 = __importStar(require("./subfolder2/index.js")); --const m8 = __importStar(require("./subfolder2/index.mjs")); --const m9 = __importStar(require("./subfolder2/index.cjs")); --const m10 = __importStar(require("./subfolder2/another/index.js")); --const m11 = __importStar(require("./subfolder2/another/index.mjs")); --const m12 = __importStar(require("./subfolder2/another/index.cjs")); -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) --const m13 = __importStar(require("./")); --const m14 = __importStar(require("./index")); --const m15 = __importStar(require("./subfolder")); --const m16 = __importStar(require("./subfolder/")); --const m17 = __importStar(require("./subfolder/index")); --const m18 = __importStar(require("./subfolder2")); --const m19 = __importStar(require("./subfolder2/")); --const m20 = __importStar(require("./subfolder2/index")); --const m21 = __importStar(require("./subfolder2/another")); --const m22 = __importStar(require("./subfolder2/another/")); --const m23 = __importStar(require("./subfolder2/another/index")); -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -160, +139 lines =@@ - const x = 1; - exports.x = x; - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -50, +51 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -+exports.x = x; - //// [index.mjs] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should all fail - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -52, +53 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -+exports.x = x; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols index bee155c52dd..cf80f6db97d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols @@ -282,47 +282,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.mts, 73, 5)) ->"./" : Symbol(m1, Decl(index.ts, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.mts, 74, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.mts, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.mts, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.mts, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.mts, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.mts, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.mts, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.mts, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.mts, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.mts, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // esm format file const x = 1; @@ -542,47 +531,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.cts, 74, 5)) ->"./" : Symbol(m1, Decl(index.ts, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.cts, 75, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.cts, 76, 5)) ->"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.cts, 77, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.cts, 78, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.cts, 79, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.cts, 80, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.cts, 81, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.cts, 82, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.cts, 83, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.cts, 84, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // cjs format file const x = 1; @@ -801,47 +779,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.ts, 73, 5)) ->"./" : Symbol(m1, Decl(index.ts, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.ts, 74, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.ts, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.ts, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.ts, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.ts, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.ts, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.ts, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.ts, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.ts, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.ts, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols.diff deleted file mode 100644 index 42ffcaf5c8b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols.diff +++ /dev/null @@ -1,146 +0,0 @@ ---- old.nodeModules1(module=node20).symbols -+++ new.nodeModules1(module=node20).symbols -@@= skipped -281, +281 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.mts, 73, 5)) -+>"./" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.mts, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.mts, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.mts, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.mts, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.mts, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.mts, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.mts, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.mts, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.mts, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.mts, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) - - // esm format file - const x = 1; -@@= skipped -249, +260 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.cts, 74, 5)) -+>"./" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.cts, 75, 5)) -+>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.cts, 76, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.cts, 77, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.cts, 78, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.cts, 79, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.cts, 80, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.cts, 81, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.cts, 82, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.cts, 83, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.cts, 84, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) - - // cjs format file - const x = 1; -@@= skipped -248, +259 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.ts, 73, 5)) -+>"./" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.ts, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.ts, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.ts, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.ts, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.ts, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.ts, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.ts, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.ts, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.ts, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.ts, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) - - // esm format file - const x = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types index d8606912f36..c7114915539 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types @@ -120,37 +120,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -202,47 +202,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -324,58 +324,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file @@ -630,58 +630,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // cjs format file @@ -731,37 +731,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -813,47 +813,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -935,58 +935,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types.diff deleted file mode 100644 index d92021de777..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types.diff +++ /dev/null @@ -1,587 +0,0 @@ ---- old.nodeModules1(module=node20).types -+++ new.nodeModules1(module=node20).types -@@= skipped -119, +119 lines =@@ - - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file -@@= skipped -306, +306 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // cjs format file -@@= skipped -101, +101 lines =@@ - - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types index bcf4d980224..c7114915539 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types.diff deleted file mode 100644 index 517e3fdbd66..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModules1(module=nodenext).types -+++ new.nodeModules1(module=nodenext).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types index dcb59ef72ac..c05889cd7fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types index dcb59ef72ac..c05889cd7fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt index 68c5252af9d..ddbe7ecee4c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt @@ -1,5 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -11,17 +9,28 @@ index.cjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript fil index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -33,17 +42,28 @@ index.js(57,1): error TS8002: 'import ... =' can only be used in TypeScript file index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -55,21 +75,19 @@ index.mjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript fil index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== subfolder/index.js (0 errors) ==== // cjs format file const x = 1; @@ -106,7 +124,7 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // esm format file const x = 1; export {x}; -==== index.js (22 errors) ==== +==== index.js (33 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -121,16 +139,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -203,38 +243,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; @@ -336,42 +376,42 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; -==== index.mjs (22 errors) ==== +==== index.mjs (33 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -386,16 +426,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -468,38 +530,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js index 351cfe80f41..c06a9072942 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js @@ -335,12 +335,9 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -356,19 +353,13 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -377,41 +368,71 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; // ESM-format imports below should issue errors -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +const m1 = __importStar(require("./index.js")); +const m2 = __importStar(require("./index.mjs")); +const m3 = __importStar(require("./index.cjs")); +const m4 = __importStar(require("./subfolder/index.js")); +const m5 = __importStar(require("./subfolder/index.mjs")); +const m6 = __importStar(require("./subfolder/index.cjs")); +const m7 = __importStar(require("./subfolder2/index.js")); +const m8 = __importStar(require("./subfolder2/index.mjs")); +const m9 = __importStar(require("./subfolder2/index.cjs")); +const m10 = __importStar(require("./subfolder2/another/index.js")); +const m11 = __importStar(require("./subfolder2/another/index.mjs")); +const m12 = __importStar(require("./subfolder2/another/index.cjs")); // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +const m13 = __importStar(require("./")); +const m14 = __importStar(require("./index")); +const m15 = __importStar(require("./subfolder")); +const m16 = __importStar(require("./subfolder/")); +const m17 = __importStar(require("./subfolder/index")); +const m18 = __importStar(require("./subfolder2")); +const m19 = __importStar(require("./subfolder2/")); +const m20 = __importStar(require("./subfolder2/index")); +const m21 = __importStar(require("./subfolder2/another")); +const m22 = __importStar(require("./subfolder2/another/")); +const m23 = __importStar(require("./subfolder2/another/index")); void m1; void m2; void m3; @@ -474,33 +495,32 @@ const _m45 = import("./subfolder2/another/index"); const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -525,17 +545,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -561,35 +581,34 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -614,17 +633,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -650,7 +669,7 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff index fd6d67be589..920136ea0da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff @@ -1,370 +1,9 @@ --- old.nodeModulesAllowJs1(module=node20).js +++ new.nodeModulesAllowJs1(module=node20).js -@@= skipped -334, +334 lines =@@ - const x = 1; - exports.x = x; - //// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --// esm format file --const x = 1; --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.cjs] --"use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; - // ESM-format imports below should issue errors --const m1 = __importStar(require("./index.js")); --const m2 = __importStar(require("./index.mjs")); --const m3 = __importStar(require("./index.cjs")); --const m4 = __importStar(require("./subfolder/index.js")); --const m5 = __importStar(require("./subfolder/index.mjs")); --const m6 = __importStar(require("./subfolder/index.cjs")); --const m7 = __importStar(require("./subfolder2/index.js")); --const m8 = __importStar(require("./subfolder2/index.mjs")); --const m9 = __importStar(require("./subfolder2/index.cjs")); --const m10 = __importStar(require("./subfolder2/another/index.js")); --const m11 = __importStar(require("./subfolder2/another/index.mjs")); --const m12 = __importStar(require("./subfolder2/another/index.cjs")); -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) --const m13 = __importStar(require("./")); --const m14 = __importStar(require("./index")); --const m15 = __importStar(require("./subfolder")); --const m16 = __importStar(require("./subfolder/")); --const m17 = __importStar(require("./subfolder/index")); --const m18 = __importStar(require("./subfolder2")); --const m19 = __importStar(require("./subfolder2/")); --const m20 = __importStar(require("./subfolder2/index")); --const m21 = __importStar(require("./subfolder2/another")); --const m22 = __importStar(require("./subfolder2/another/")); --const m23 = __importStar(require("./subfolder2/another/index")); -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -160, +139 lines =@@ - const x = 1; - exports.x = x; - //// [index.mjs] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should all fail - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -50, +51 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -+exports.x = x; - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -52, +53 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -- -- --//// [index.d.ts] +@@= skipped -672, +672 lines =@@ + + + //// [index.d.ts] -export const x: 1; -//// [index.d.cts] -export const x: 1; @@ -388,10 +27,6 @@ -export const x: 1; -//// [index.d.ts] -export const x: 1; -+exports.x = x; -+ -+ -+//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.cts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols index ec8ec42c86b..1d24c14a43e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols @@ -282,47 +282,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.js, 73, 5)) ->"./" : Symbol(m1, Decl(index.js, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.js, 74, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.js, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.js, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.js, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.js, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.js, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.js, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.js, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.js, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.js, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // esm format file const x = 1; @@ -542,47 +531,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.cjs, 74, 5)) ->"./" : Symbol(m1, Decl(index.js, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.cjs, 75, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.cjs, 76, 5)) ->"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.cjs, 77, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.cjs, 78, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.cjs, 79, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.cjs, 80, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.cjs, 81, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.cjs, 82, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.cjs, 83, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.cjs, 84, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // cjs format file const x = 1; @@ -801,47 +779,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.mjs, 73, 5)) ->"./" : Symbol(m1, Decl(index.js, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.mjs, 74, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.mjs, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.mjs, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.mjs, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.mjs, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.mjs, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.mjs, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.mjs, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.mjs, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.mjs, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols.diff deleted file mode 100644 index 4be9a18056c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols.diff +++ /dev/null @@ -1,146 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node20).symbols -+++ new.nodeModulesAllowJs1(module=node20).symbols -@@= skipped -281, +281 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.js, 73, 5)) -+>"./" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.js, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.js, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.js, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.js, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.js, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.js, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.js, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.js, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.js, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.js, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) - - // esm format file - const x = 1; -@@= skipped -249, +260 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.cjs, 74, 5)) -+>"./" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.cjs, 75, 5)) -+>"./index" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.cjs, 76, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.cjs, 77, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.cjs, 78, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.cjs, 79, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.cjs, 80, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.cjs, 81, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.cjs, 82, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.cjs, 83, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.cjs, 84, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) - - // cjs format file - const x = 1; -@@= skipped -248, +259 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.mjs, 73, 5)) -+>"./" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.mjs, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.mjs, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.mjs, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.mjs, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.mjs, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.mjs, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.mjs, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.mjs, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.mjs, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.mjs, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) - - // esm format file - const x = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types index 3ffd6777e88..c05889cd7fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types @@ -120,37 +120,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -202,47 +202,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -324,58 +324,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file @@ -630,58 +630,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // cjs format file @@ -731,37 +731,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -813,47 +813,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -935,58 +935,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types index dcb59ef72ac..c05889cd7fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt index 07180fab53e..2341cc6d8af 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== foo.cjs (0 errors) ==== exports.foo = "foo" ==== bar.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt index 0e7496180a4..3aa26eb8bd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js index 2f99e51c4c8..e8c327cbb89 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff deleted file mode 100644 index 6fd54f278da..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols index 48ff9d90339..aa9ad6d6bdf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff deleted file mode 100644 index b8ce6b6cc30..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types index 296335f7dc3..2b6e971e79f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index 0e7496180a4..3aa26eb8bd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js index 2f99e51c4c8..e8c327cbb89 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff deleted file mode 100644 index 67f41a0a185..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols index 48ff9d90339..aa9ad6d6bdf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff deleted file mode 100644 index ef0e58c515a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types index 296335f7dc3..2b6e971e79f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt deleted file mode 100644 index c34e5bec84b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,193 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.cjs(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.js(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.js(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.js(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (7 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -==== index.mjs (4 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cjs (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js index 4fb8ca4f248..e8c327cbb89 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,65 +129,94 @@ export const cjsSource = true; } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -cjs; -mjs; -type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +const cjsi = __importStar(require("inner/a")); +const mjsi = __importStar(require("inner/b")); +const typei = __importStar(require("inner")); +const ts = __importStar(require("inner/types")); cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff deleted file mode 100644 index 36075a475cc..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --const cjsi = __importStar(require("inner/a")); --const mjsi = __importStar(require("inner/b")); --const typei = __importStar(require("inner")); --const ts = __importStar(require("inner/types")); -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols index 4a556ae9e33..aa9ad6d6bdf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols @@ -33,16 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -77,22 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -127,105 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff deleted file mode 100644 index 2c113387820..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).symbols -@@= skipped -32, +32 lines =@@ - >ts : Symbol(ts, Decl(index.js, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.js, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.js, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.mjs === - // esm format file -@@= skipped -52, +44 lines =@@ - >ts : Symbol(ts, Decl(index.mjs, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.mjs, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.mjs, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.cjs === - // cjs format file -@@= skipped -57, +55 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - mjsi.cjsSource; -->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) -->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -29, +25 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types index 36b23e0799e..2b6e971e79f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types @@ -3,135 +3,135 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof cjsi import * as ts from "inner/types"; >ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any +>cjsi.mjsSource : true >cjsi : typeof cjsi ->mjsSource : any +>mjsSource : true mjsi.mjsSource; ->mjsi.mjsSource : any ->mjsi : any ->mjsSource : any +>mjsi.mjsSource : true +>mjsi : typeof cjsi +>mjsSource : true typei.mjsSource; ->typei.mjsSource : any ->typei : any ->mjsSource : any +>typei.mjsSource : true +>typei : typeof cjsi +>mjsSource : true ts.mjsSource; ->ts.mjsSource : any +>ts.mjsSource : true >ts : typeof cjsi ->mjsSource : any +>mjsSource : true === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; ->cjsi : any +>cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : typeof mjsi +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : typeof mjsi +>typei : typeof cjsi import * as ts from "inner/types"; ->ts : typeof mjsi +>ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any ->cjsi : any ->mjsSource : any +>cjsi.mjsSource : true +>cjsi : typeof cjsi +>mjsSource : true mjsi.mjsSource; >mjsi.mjsSource : true ->mjsi : typeof mjsi +>mjsi : typeof cjsi >mjsSource : true typei.mjsSource; >typei.mjsSource : true ->typei : typeof mjsi +>typei : typeof cjsi >mjsSource : true ts.mjsSource; >ts.mjsSource : true ->ts : typeof mjsi +>ts : typeof cjsi >mjsSource : true === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof typei import * as ts from "inner/types"; >ts : typeof cjsi @@ -142,14 +142,14 @@ cjsi.cjsSource; >cjsSource : true mjsi.cjsSource; ->mjsi.cjsSource : any ->mjsi : any ->cjsSource : any +>mjsi.cjsSource : true +>mjsi : typeof cjsi +>cjsSource : true typei.implicitCjsSource; ->typei.implicitCjsSource : any ->typei : any ->implicitCjsSource : any +>typei.implicitCjsSource : true +>typei : typeof typei +>implicitCjsSource : true ts.cjsSource; >ts.cjsSource : true @@ -158,14 +158,20 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -174,58 +180,62 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; ->cjs : any +>cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : typeof mjs +>mjs : typeof cjs import * as type from "inner"; ->type : typeof mjs +>type : typeof cjs import * as ts from "inner/types"; ->ts : typeof mjs +>ts : typeof cjs export { cjs }; ->cjs : any +>cjs : typeof cjs export { mjs }; ->mjs : typeof mjs +>mjs : typeof cjs export { type }; ->type : typeof mjs +>type : typeof cjs export { ts }; ->ts : typeof mjs +>ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -234,15 +244,11 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 0e7496180a4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,153 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js index 2f99e51c4c8..e8c327cbb89 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff deleted file mode 100644 index 321270cbcb6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols index 48ff9d90339..aa9ad6d6bdf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 8dc875ae80c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types index 296335f7dc3..2b6e971e79f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt deleted file mode 100644 index eda4bffb811..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.js (1 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== index.js (1 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js index 14d22d1b08a..b5d9166a684 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js @@ -32,11 +32,8 @@ async function main() { const { readFile } = await import("fs"); } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; // esm format file -async function main() { +export async function main() { const { readFile } = await import("fs"); } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff index 50ad6b28d08..f9b96a66fd8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff @@ -1,17 +1,6 @@ --- old.nodeModulesAllowJsDynamicImport(module=node20).js +++ new.nodeModulesAllowJsDynamicImport(module=node20).js -@@= skipped -31, +31 lines =@@ - const { readFile } = await import("fs"); - } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.main = main; - // esm format file --export async function main() { -+async function main() { - const { readFile } = await import("fs"); - } +@@= skipped -38, +38 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt index a4ebc19ca3d..f3b79060297 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt @@ -1,9 +1,9 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (1 errors) ==== // cjs format file const a = {}; @@ -14,17 +14,21 @@ subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript // cjs format file const a = {}; module.exports = a; -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== // esm format file const a = {}; export = a; ~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + ~~~~~~~~~~~ !!! error TS8003: 'export =' can only be used in TypeScript files. -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; + ~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js index 71318b47c95..dd51eb1722b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js @@ -34,20 +34,19 @@ module.exports = a; const a = {}; module.exports = a; //// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file const a = {}; export = a; module.exports = a; //// [index.js] -"use strict"; // esm format file const a = {}; -module.exports = a; +export {}; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -require("fs"); +import "fs"; const a = {}; export = a; module.exports = a; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff index a26cea7c558..aa2779e63b3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff @@ -1,53 +1,36 @@ --- old.nodeModulesAllowJsExportAssignment(module=node20).js +++ new.nodeModulesAllowJsExportAssignment(module=node20).js -@@= skipped -33, +33 lines =@@ - const a = {}; +@@= skipped -34, +34 lines =@@ module.exports = a; //// [file.js] --"use strict"; + "use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file const a = {}; +export = a; module.exports = a; //// [index.js] -+"use strict"; // esm format file - const a = {}; --export {}; -+module.exports = a; - //// [file.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); +@@= skipped -11, +13 lines =@@ // esm format file -+require("fs"); -+const a = {}; -+export = a; -+module.exports = a; -+ -+ -+//// [index.d.ts] -+declare const a: {}; -+export = a; -+//// [file.d.ts] -+export = a; -+//// [index.d.ts] -+declare const a: {}; -+export = a; -+//// [file.d.ts] import "fs"; --const a = {}; --module.exports = a; -- -- --//// [index.d.ts] --export = a; --declare const a: {}; --//// [file.d.ts] + const a = {}; ++export = a; + module.exports = a; + + + //// [index.d.ts] -export = a; + declare const a: {}; ++export = a; + //// [file.d.ts] + export = a; -declare const a: {}; --//// [index.d.ts] + //// [index.d.ts] -export = a; --declare const a: {}; --//// [file.d.ts] + declare const a: {}; ++export = a; + //// [file.d.ts] -export {}; ++import "fs"; +export = a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt deleted file mode 100644 index 338d873651c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== foo.cjs (0 errors) ==== - // this file is a module despite having no imports -==== bar.js (0 errors) ==== - // however this file is _not_ a module \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt index 110deab4ebe..6bdf1d41c61 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt @@ -1,13 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (3 errors) ==== // cjs format file function require() {} @@ -21,18 +16,12 @@ subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is res ~~~~~~~~~~ !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file function require() {} - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. const exports = {}; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} export const __esModule = false; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js index 48393d9b010..4048da5b4f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js @@ -39,18 +39,13 @@ class Object { exports.Object = Object; exports.__esModule = false; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Object = exports.exports = exports.__esModule = void 0; -exports.require = require; // esm format file function require() { } const exports = {}; -exports.exports = exports; class Object { } -exports.Object = Object; -exports.__esModule = false; +export const __esModule = false; +export { require, exports, Object }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff index c3b8617dd40..d87de028199 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff @@ -1,50 +1,27 @@ --- old.nodeModulesAllowJsGeneratedNameCollisions(module=node20).js +++ new.nodeModulesAllowJsGeneratedNameCollisions(module=node20).js -@@= skipped -38, +38 lines =@@ - exports.Object = Object; - exports.__esModule = false; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Object = exports.exports = exports.__esModule = void 0; -+exports.require = require; - // esm format file - function require() { } - const exports = {}; -+exports.exports = exports; - class Object { - } --export const __esModule = false; --export { require, exports, Object }; -- -- --//// [index.d.ts] --export const __esModule: false; --export function require(): void; --export const exports: {}; --export class Object { --} --//// [index.d.ts] +@@= skipped -48, +48 lines =@@ + + + //// [index.d.ts] -export const __esModule: false; -export function require(): void; -export const exports: {}; -export class Object { --} -+exports.Object = Object; -+exports.__esModule = false; -+ -+ -+//// [index.d.ts] +declare function require(): void; +declare const exports: {}; +declare class Object { -+} + } +export declare const __esModule = false; +export { require, exports, Object }; -+//// [index.d.ts] + //// [index.d.ts] +-export const __esModule: false; +-export function require(): void; +-export const exports: {}; +-export class Object { +declare function require(): void; +declare const exports: {}; +declare class Object { -+} + } +export declare const __esModule = false; +export { require, exports, Object }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt index 70f57dd9dd9..476c47f703e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. file.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. file.js(6,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -7,7 +6,6 @@ subfolder/index.js(2,1): error TS8002: 'import ... =' can only be used in TypeSc subfolder/index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (2 errors) ==== // cjs format file import fs = require("fs"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js index 2cef9a1e633..80990ff3ca0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js @@ -38,21 +38,23 @@ const fs = require("fs"); fs.readFile; exports.fs2 = require("fs"); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const fs = require("fs"); +const fs = __require("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require("fs"); +export { fs2 }; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire_1 } from "module"; +const __require_1 = _createRequire_1(import.meta.url); // esm format file const __require = null; const _createRequire = null; -const fs = require("fs"); +const fs = __require_1("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require_1("fs"); +export { fs2 }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff index d11a8a68e59..3d7bc7aa7ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff @@ -1,45 +1,13 @@ --- old.nodeModulesAllowJsImportAssignment(module=node20).js +++ new.nodeModulesAllowJsImportAssignment(module=node20).js -@@= skipped -37, +37 lines =@@ - fs.readFile; - exports.fs2 = require("fs"); - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const fs = __require("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require("fs"); --export { fs2 }; -+exports.fs2 = require("fs"); - //// [file.js] --import { createRequire as _createRequire_1 } from "module"; --const __require_1 = _createRequire_1(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file - const __require = null; - const _createRequire = null; --const fs = __require_1("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require_1("fs"); --export { fs2 }; -- -- --//// [index.d.ts] +@@= skipped -57, +57 lines =@@ + + + //// [index.d.ts] -import fs2 = require("fs"); --//// [index.d.ts] --import fs2 = require("fs"); -+exports.fs2 = require("fs"); -+ -+ -+//// [index.d.ts] +export import fs2 = require("fs"); -+//// [index.d.ts] + //// [index.d.ts] +-import fs2 = require("fs"); +export import fs2 = require("fs"); //// [file.d.ts] -import fs2 = require("fs"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt deleted file mode 100644 index d36e8ad8d96..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.js (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== index.js (0 errors) ==== - // esm format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js index 1210148c3a7..a30d220227f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js @@ -32,18 +32,17 @@ declare module "tslib" { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); // cjs format file -const fs_1 = require("fs"); +const fs_1 = tslib_1.__importDefault(require("fs")); fs_1.default.readFile; -const fs = require("fs"); +const fs = tslib_1.__importStar(require("fs")); fs.readFile; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const fs_1 = require("fs"); -fs_1.default.readFile; -const fs = require("fs"); +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; fs.readFile; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js.diff deleted file mode 100644 index 34e2f3dcfa4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesAllowJsImportHelpersCollisions1(module=node20).js -+++ new.nodeModulesAllowJsImportHelpersCollisions1(module=node20).js -@@= skipped -31, +31 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --const tslib_1 = require("tslib"); - // cjs format file --const fs_1 = tslib_1.__importDefault(require("fs")); -+const fs_1 = require("fs"); - fs_1.default.readFile; --const fs = tslib_1.__importStar(require("fs")); -+const fs = require("fs"); - fs.readFile; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import { default as _fs } from "fs"; --_fs.readFile; --import * as fs from "fs"; -+const fs_1 = require("fs"); -+fs_1.default.readFile; -+const fs = require("fs"); - fs.readFile; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt deleted file mode 100644 index 7566f534948..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; - export * as fs from "fs"; -==== index.js (0 errors) ==== - // esm format file - export * from "fs"; - export * as fs from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js index 3a13cffb4b4..1960ba0103e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js @@ -32,15 +32,11 @@ exports.fs = void 0; const tslib_1 = require("tslib"); // cjs format file tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +exports.fs = tslib_1.__importStar(require("fs")); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; -const tslib_1 = require("tslib"); // esm format file -tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +export * from "fs"; +export * as fs from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js.diff deleted file mode 100644 index 3ab585aecb4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.nodeModulesAllowJsImportHelpersCollisions2(module=node20).js -+++ new.nodeModulesAllowJsImportHelpersCollisions2(module=node20).js -@@= skipped -31, +31 lines =@@ - const tslib_1 = require("tslib"); - // cjs format file - tslib_1.__exportStar(require("fs"), exports); --exports.fs = tslib_1.__importStar(require("fs")); -+exports.fs = require("fs"); - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.fs = void 0; -+const tslib_1 = require("tslib"); - // esm format file --export * from "fs"; --export * as fs from "fs"; -+tslib_1.__exportStar(require("fs"), exports); -+exports.fs = require("fs"); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt deleted file mode 100644 index 2f2cf782916..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.js (0 errors) ==== - // cjs format file - export {default} from "fs"; - export {default as foo} from "fs"; - export {bar as baz} from "fs"; -==== index.js (0 errors) ==== - // esm format file - export {default} from "fs"; - export {default as foo} from "fs"; - export {bar as baz} from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js index 5d80e9cb9e6..9401cb9084e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js @@ -31,24 +31,19 @@ declare module "tslib" { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.baz = exports.foo = exports.default = void 0; +const tslib_1 = require("tslib"); // cjs format file const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); const fs_2 = require("fs"); -Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); +Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); const fs_3 = require("fs"); Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.baz = exports.foo = exports.default = void 0; // esm format file -const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); -const fs_2 = require("fs"); -Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); -const fs_3 = require("fs"); -Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff index 93012a949a9..7bbeef01b87 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff @@ -5,45 +5,29 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.baz = exports.foo = exports.default = void 0; -var tslib_1 = require("tslib"); ++const tslib_1 = require("tslib"); // cjs format file -var fs_1 = require("fs"); --Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); --var fs_2 = require("fs"); --Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); --var fs_3 = require("fs"); +const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); + Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); +-var fs_2 = require("fs"); +const fs_2 = require("fs"); -+Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); + Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); +-var fs_3 = require("fs"); +const fs_3 = require("fs"); Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.baz = exports.foo = exports.default = void 0; // esm format file --export { default } from "fs"; --export { default as foo } from "fs"; --export { bar as baz } from "fs"; -- -- --//// [index.d.ts] --export { default, default as foo, bar as baz } from "fs"; --//// [index.d.ts] +@@= skipped -16, +16 lines =@@ + + + //// [index.d.ts] -export { default, default as foo, bar as baz } from "fs"; -+const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); -+const fs_2 = require("fs"); -+Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); -+const fs_3 = require("fs"); -+Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); -+ -+ -+//// [index.d.ts] +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; -+//// [index.d.ts] + //// [index.d.ts] +-export { default, default as foo, bar as baz } from "fs"; +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt index aa9d4d5c493..28110ed339d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (1 errors) ==== // cjs format file const x = import.meta.url; ~~~~~~~~~~~ !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; -==== index.js (1 errors) ==== +==== index.js (0 errors) ==== // esm format file const x = import.meta.url; - ~~~~~~~~~~~ -!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js index 71c30147518..6ac9f8052fc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js @@ -27,12 +27,9 @@ exports.x = void 0; const x = import.meta.url; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = import.meta.url; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff index 6efd1a32e5d..ddf2a8d7508 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff @@ -1,27 +1,13 @@ --- old.nodeModulesAllowJsImportMeta(module=node20).js +++ new.nodeModulesAllowJsImportMeta(module=node20).js -@@= skipped -26, +26 lines =@@ - const x = import.meta.url; - exports.x = x; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = import.meta.url; --export { x }; -- -- --//// [index.d.ts] +@@= skipped -32, +32 lines =@@ + + + //// [index.d.ts] -export const x: string; --//// [index.d.ts] --export const x: string; -+exports.x = x; -+ -+ -+//// [index.d.ts] +declare const x: string; +export { x }; -+//// [index.d.ts] + //// [index.d.ts] +-export const x: string; +declare const x: string; +export { x }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt index 0543bf37ed3..da41d18ca9c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cjs (4 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js index 817ed979731..6f61b6de6a0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff deleted file mode 100644 index 4b82b99738d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).js -+++ new.nodeModulesAllowJsPackageExports(module=node16).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols index 241c74412b5..ac3958d2edf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff deleted file mode 100644 index 953631b6c5c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node16).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types index 794aab48718..815ad110482 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt index 0543bf37ed3..da41d18ca9c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cjs (4 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js index 817ed979731..6f61b6de6a0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff deleted file mode 100644 index 8db327a4a4f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).js -+++ new.nodeModulesAllowJsPackageExports(module=node18).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols index 241c74412b5..ac3958d2edf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff deleted file mode 100644 index 8a8dc5b706c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node18).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types index 794aab48718..815ad110482 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt deleted file mode 100644 index fc1ec8d1339..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,120 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js index 05f5e0949ee..6f61b6de6a0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,61 +95,91 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); + +//// [index.mjs] // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +// cjs format file +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); cjsi; mjsi; typei; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff deleted file mode 100644 index 7a800e6da33..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).js -+++ new.nodeModulesAllowJsPackageExports(module=node20).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); --cjs; --mjs; --type; --const cjsi = __importStar(require("inner/cjs")); --const mjsi = __importStar(require("inner/mjs")); --const typei = __importStar(require("inner")); --cjsi; --mjsi; --typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols index 241c74412b5..ac3958d2edf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff deleted file mode 100644 index 8ccc6b87fb9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node20).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types index 794aab48718..815ad110482 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 4297bbb071c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,118 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js index 817ed979731..6f61b6de6a0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff deleted file mode 100644 index 66c28515a1d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).js -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols index 241c74412b5..ac3958d2edf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index f24b75dfb11..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types index 794aab48718..815ad110482 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt index 0de5e50bb05..6aecf9a590e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. index.cjs(2,22): error TS2307: Cannot find module '#cjs' or its corresponding type declarations. index.cjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding type declarations. @@ -11,7 +10,6 @@ index.mjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding ty index.mjs(4,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.js (3 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js index 4e8df6368cc..ca3aa0ac43b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js @@ -38,32 +38,61 @@ type; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +const cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff index 160d14c23b7..c70bc301f97 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff @@ -5,71 +5,20 @@ } +//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); ++import * as cjs from "#cjs"; ++import * as mjs from "#mjs"; ++import * as type from "#type"; +cjs; +mjs; +type; //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); // esm format file --import * as cjs from "#cjs"; --import * as mjs from "#mjs"; --import * as type from "#type"; -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); + import * as cjs from "#cjs"; +@@= skipped -51, +59 lines =@@ cjs; mjs; type; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const cjs = __importStar(require("#cjs")); --const mjs = __importStar(require("#mjs")); --const type = __importStar(require("#type")); --cjs; --mjs; --type; -//// [index.js] -// esm format file -import * as cjs from "#cjs"; @@ -80,12 +29,6 @@ -type; - - -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); -+cjs; -+mjs; -+type; + + +//// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt index 6804fa20404..95ba0345cb0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js index 0c82c6e77b0..5bab0a82caa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols index 8aaf670265f..802e24e7978 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff deleted file mode 100644 index ecb7c5f0f8a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types index 632a6d99013..b5c99b67eb5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt index 6804fa20404..95ba0345cb0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js index 0c82c6e77b0..5bab0a82caa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols index 8aaf670265f..802e24e7978 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff deleted file mode 100644 index 43114922cc0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types index 632a6d99013..b5c99b67eb5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt deleted file mode 100644 index c6178671eac..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.mjs (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.cjs (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*": "./*.cjs", - "./mjs/*": "./*.mjs", - "./js/*": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js index 473118b4ba5..5bab0a82caa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +const cjsi = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(require("inner/js/index")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff deleted file mode 100644 index 4b39a11291b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).js -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index")); --const mjsi = __importStar(require("inner/mjs/index")); --const typei = __importStar(require("inner/js/index")); -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols index 8aaf670265f..802e24e7978 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff deleted file mode 100644 index 6ab2d9d14c1..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types index 632a6d99013..b5c99b67eb5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js index 0c82c6e77b0..5bab0a82caa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols index 8aaf670265f..802e24e7978 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff deleted file mode 100644 index 70d7f7ba93f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types index 632a6d99013..b5c99b67eb5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt index a2b6a322bb6..44e51033d1c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cjs(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cjs(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cjs(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. @@ -19,7 +18,6 @@ node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'i node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.js (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js index 6e380318eb8..3ba5fbbce04 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js @@ -69,32 +69,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +const cjsi = __importStar(require("inner/cjs/exclude/index")); +const mjsi = __importStar(require("inner/mjs/exclude/index")); +const typei = __importStar(require("inner/js/exclude/index")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js.diff deleted file mode 100644 index 852ea3328d2..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js -+++ new.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js -@@= skipped -68, +68 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/exclude/index")); --const mjsi = __importStar(require("inner/mjs/exclude/index")); --const typei = __importStar(require("inner/js/exclude/index")); -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt index 64814c9a08f..43b333f9021 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js index 5c434e98472..19140a3fe5d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols index b6cc0273705..182fd209dac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff deleted file mode 100644 index d1325929838..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types index 2530671b34c..4c7b763f3a1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt index 64814c9a08f..43b333f9021 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js index 5c434e98472..19140a3fe5d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols index b6cc0273705..182fd209dac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff deleted file mode 100644 index 11bbac7a712..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types index 2530671b34c..4c7b763f3a1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt deleted file mode 100644 index 523c9c90a7c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.mjs (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.cjs (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*.cjs": "./*.cjs", - "./mjs/*.mjs": "./*.mjs", - "./js/*.js": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js index b2f2aabab49..19140a3fe5d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +const cjsi = __importStar(require("inner/cjs/index.cjs")); +const mjsi = __importStar(require("inner/mjs/index.mjs")); +const typei = __importStar(require("inner/js/index.js")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff deleted file mode 100644 index b42fac06473..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index.cjs")); --const mjsi = __importStar(require("inner/mjs/index.mjs")); --const typei = __importStar(require("inner/js/index.js")); -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols index b6cc0273705..182fd209dac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff deleted file mode 100644 index e9f329450ae..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types index 2530671b34c..4c7b763f3a1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js index 5c434e98472..19140a3fe5d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols index b6cc0273705..182fd209dac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff deleted file mode 100644 index 00aaf409ca6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types index 2530671b34c..4c7b763f3a1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt index 0d45e82ff4d..2a46b9875db 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt @@ -1,20 +1,10 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. subfolder/index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -subfolder/index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.js (5 errors) ==== +==== subfolder/index.js (2 errors) ==== // cjs format file import {h} from "../index.js"; import mod = require("../index.js"); @@ -25,17 +15,11 @@ subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires th ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. export async function f() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. h(); } -==== index.js (5 errors) ==== +==== index.js (2 errors) ==== // esm format file import {h as _h} from "./index.js"; import mod = require("./index.js"); @@ -46,14 +30,8 @@ subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires th ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. export async function h() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. f(); } ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js index df11fc187e4..3ea58197862 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js @@ -34,18 +34,17 @@ export async function h() { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.h = h; +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const index_js_1 = require("./index.js"); -const mod = require("./index.js"); -const index_js_2 = require("./subfolder/index.js"); -const mod2 = require("./subfolder/index.js"); -async function h() { +import { h as _h } from "./index.js"; +const mod = __require("./index.js"); +import { f } from "./subfolder/index.js"; +const mod2 = __require("./subfolder/index.js"); +export async function h() { const mod3 = await import("./index.js"); const mod4 = await import("./subfolder/index.js"); - (0, index_js_2.f)(); + f(); } //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff index 63ea0f0f3ce..3f6a4571dd8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff @@ -1,33 +1,6 @@ --- old.nodeModulesAllowJsSynchronousCallErrors(module=node20).js +++ new.nodeModulesAllowJsSynchronousCallErrors(module=node20).js -@@= skipped -33, +33 lines =@@ - } - - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.h = h; - // esm format file --import { h as _h } from "./index.js"; --const mod = __require("./index.js"); --import { f } from "./subfolder/index.js"; --const mod2 = __require("./subfolder/index.js"); --export async function h() { -+const index_js_1 = require("./index.js"); -+const mod = require("./index.js"); -+const index_js_2 = require("./subfolder/index.js"); -+const mod2 = require("./subfolder/index.js"); -+async function h() { - const mod3 = await import("./index.js"); - const mod4 = await import("./subfolder/index.js"); -- f(); -+ (0, index_js_2.f)(); - } - //// [index.js] - "use strict"; -@@= skipped -29, +30 lines =@@ +@@= skipped -62, +62 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types index 1e19c8b8f21..a28566d8d4d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types @@ -19,9 +19,9 @@ export async function f() { >f : () => Promise const mod3 = await import ("../index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("../index.js") : { h(): Promise; default: typeof mod; } ->import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("../index.js") : typeof mod +>import ("../index.js") : Promise >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); @@ -53,9 +53,9 @@ export async function h() { >h : () => Promise const mod3 = await import ("./index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("./index.js") : { h(): Promise; default: typeof mod; } ->import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("./index.js") : typeof mod +>import ("./index.js") : Promise >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt index 08f9461c8f7..78c93edaa06 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt @@ -1,29 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (2 errors) ==== // cjs format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -==== index.js (2 errors) ==== +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.js (0 errors) ==== // esm format file const x = await 1; - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} - ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js index 318f9cb82c5..69fdcac5a24 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js @@ -30,12 +30,9 @@ const x = await 1; exports.x = x; for await (const y of []) { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = await 1; -exports.x = x; +export { x }; for await (const y of []) { } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff index c3fe3a2d4f6..1be5ac7bb42 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff @@ -1,17 +1,6 @@ --- old.nodeModulesAllowJsTopLevelAwait(module=node20).js +++ new.nodeModulesAllowJsTopLevelAwait(module=node20).js -@@= skipped -29, +29 lines =@@ - exports.x = x; - for await (const y of []) { } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = await 1; --export { x }; -+exports.x = x; - for await (const y of []) { } +@@= skipped -36, +36 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt index 96d43847322..68c11a8bbb5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt @@ -1,9 +1,7 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /1.cjs (0 errors) ==== module.exports = {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js index 0432572e6cf..41870a452e5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js @@ -42,8 +42,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); ; //// [5.cjs] "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const _2_cjs_1 = require("./2.cjs"); // ok -const _3_cjs_1 = require("./3.cjs"); // error +const _2_cjs_1 = __importDefault(require("./2.cjs")); // ok +const _3_cjs_1 = __importDefault(require("./3.cjs")); // error _2_cjs_1.default.foo; _3_cjs_1.default.foo; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff index f0c05cd3b8b..115c779170c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff @@ -19,18 +19,4 @@ +export var foo = {}; exports.foo = {}; //// [4.cjs] - "use strict"; -@@= skipped -15, +20 lines =@@ - ; - //// [5.cjs] - "use strict"; --var __importDefault = (this && this.__importDefault) || function (mod) { -- return (mod && mod.__esModule) ? mod : { "default": mod }; --}; - Object.defineProperty(exports, "__esModule", { value: true }); --const _2_cjs_1 = __importDefault(require("./2.cjs")); // ok --const _3_cjs_1 = __importDefault(require("./3.cjs")); // error -+const _2_cjs_1 = require("./2.cjs"); // ok -+const _3_cjs_1 = require("./3.cjs"); // error - _2_cjs_1.default.foo; - _3_cjs_1.default.foo; \ No newline at end of file + "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt deleted file mode 100644 index 34d9cf4c02a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export const a = 1; -==== index.ts (1 errors) ==== - // esm format file - import mod from "./subfolder/index.js"; - ~~~ -!!! error TS1192: Module '"subfolder/index"' has no default export. - mod; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt.diff deleted file mode 100644 index 169fe70c0ad..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ export const a = 1; -+==== index.ts (1 errors) ==== -+ // esm format file -+ import mod from "./subfolder/index.js"; -+ ~~~ -+!!! error TS1192: Module '"subfolder/index"' has no default export. -+ mod; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js index b7660393839..f0c9198a513 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js @@ -25,11 +25,9 @@ exports.a = void 0; // cjs format file exports.a = 1; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const index_js_1 = require("./subfolder/index.js"); -index_js_1.default; +import mod from "./subfolder/index.js"; +mod; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js.diff deleted file mode 100644 index b3137ea4f30..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js -@@= skipped -24, +24 lines =@@ - // cjs format file - exports.a = 1; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import mod from "./subfolder/index.js"; --mod; -+const index_js_1 = require("./subfolder/index.js"); -+index_js_1.default; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types index ff082de1b8c..906754ee99f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types @@ -9,8 +9,8 @@ export const a = 1; === index.ts === // esm format file import mod from "./subfolder/index.js"; ->mod : any +>mod : typeof mod mod; ->mod : any +>mod : typeof mod diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types.diff deleted file mode 100644 index f4d5164ed06..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types -@@= skipped -8, +8 lines =@@ - === index.ts === - // esm format file - import mod from "./subfolder/index.js"; -->mod : typeof mod -+>mod : any - - mod; -->mod : typeof mod -+>mod : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt index 35c27166e72..7400a788e27 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index db9b2c18e8c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (2 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js index 87d5cda21ca..7653fb782c5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff deleted file mode 100644 index 5a8f5c9077c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).js -+++ new.nodeModulesConditionalPackageExports(module=node16).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols index e574ed5f77e..fed90e232d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff deleted file mode 100644 index db7e92d3d8e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).symbols -+++ new.nodeModulesConditionalPackageExports(module=node16).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types index 548c7f4fc2b..2cc0823cd4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff deleted file mode 100644 index b5d4494171b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).types -+++ new.nodeModulesConditionalPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt index 35c27166e72..7400a788e27 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 9f08cb4b480..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (2 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js index 87d5cda21ca..7653fb782c5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff deleted file mode 100644 index 88c09cb208a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).js -+++ new.nodeModulesConditionalPackageExports(module=node18).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols index e574ed5f77e..fed90e232d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff deleted file mode 100644 index 069b3123aef..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).symbols -+++ new.nodeModulesConditionalPackageExports(module=node18).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types index 548c7f4fc2b..2cc0823cd4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff deleted file mode 100644 index 5d552d69c53..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).types -+++ new.nodeModulesConditionalPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt deleted file mode 100644 index 25d206bde9c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,193 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.cts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.ts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.ts(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.ts(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (7 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -==== index.mts (4 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cts (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index f694e2de34e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,192 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.cts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.ts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.ts(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.ts(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (0 errors) ==== -+==== index.ts (7 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+ import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+==== index.mts (4 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; -@@= skipped -67, +124 lines =@@ - ==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -10, +10 lines =@@ - export { type }; - export { ts }; - export const mjsSource = true; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js index 791b1d07d97..7653fb782c5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,65 +129,94 @@ export const cjsSource = true; } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -cjs; -mjs; -type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +const cjsi = __importStar(require("inner/a")); +const mjsi = __importStar(require("inner/b")); +const typei = __importStar(require("inner")); +const ts = __importStar(require("inner/types")); cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff deleted file mode 100644 index 86fc03121d0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).js -+++ new.nodeModulesConditionalPackageExports(module=node20).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --const cjsi = __importStar(require("inner/a")); --const mjsi = __importStar(require("inner/b")); --const typei = __importStar(require("inner")); --const ts = __importStar(require("inner/types")); -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols index 193a06aa9c4..fed90e232d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols @@ -33,16 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -77,22 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -127,105 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff deleted file mode 100644 index 3cd5f6d53d0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).symbols -+++ new.nodeModulesConditionalPackageExports(module=node20).symbols -@@= skipped -32, +32 lines =@@ - >ts : Symbol(ts, Decl(index.ts, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.ts, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.ts, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.mts === - // esm format file -@@= skipped -52, +44 lines =@@ - >ts : Symbol(ts, Decl(index.mts, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.mts, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.mts, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.cts === - // cjs format file -@@= skipped -57, +55 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - mjsi.cjsSource; -->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) -->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -29, +25 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types index 174f42a6531..2cc0823cd4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types @@ -3,135 +3,135 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof cjsi import * as ts from "inner/types"; >ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any +>cjsi.mjsSource : true >cjsi : typeof cjsi ->mjsSource : any +>mjsSource : true mjsi.mjsSource; ->mjsi.mjsSource : any ->mjsi : any ->mjsSource : any +>mjsi.mjsSource : true +>mjsi : typeof cjsi +>mjsSource : true typei.mjsSource; ->typei.mjsSource : any ->typei : any ->mjsSource : any +>typei.mjsSource : true +>typei : typeof cjsi +>mjsSource : true ts.mjsSource; ->ts.mjsSource : any +>ts.mjsSource : true >ts : typeof cjsi ->mjsSource : any +>mjsSource : true === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; ->cjsi : any +>cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : typeof mjsi +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : typeof mjsi +>typei : typeof cjsi import * as ts from "inner/types"; ->ts : typeof mjsi +>ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any ->cjsi : any ->mjsSource : any +>cjsi.mjsSource : true +>cjsi : typeof cjsi +>mjsSource : true mjsi.mjsSource; >mjsi.mjsSource : true ->mjsi : typeof mjsi +>mjsi : typeof cjsi >mjsSource : true typei.mjsSource; >typei.mjsSource : true ->typei : typeof mjsi +>typei : typeof cjsi >mjsSource : true ts.mjsSource; >ts.mjsSource : true ->ts : typeof mjsi +>ts : typeof cjsi >mjsSource : true === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof typei import * as ts from "inner/types"; >ts : typeof cjsi @@ -142,14 +142,14 @@ cjsi.cjsSource; >cjsSource : true mjsi.cjsSource; ->mjsi.cjsSource : any ->mjsi : any ->cjsSource : any +>mjsi.cjsSource : true +>mjsi : typeof cjsi +>cjsSource : true typei.implicitCjsSource; ->typei.implicitCjsSource : any ->typei : any ->implicitCjsSource : any +>typei.implicitCjsSource : true +>typei : typeof typei +>implicitCjsSource : true ts.cjsSource; >ts.cjsSource : true @@ -158,14 +158,20 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -174,58 +180,62 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; ->cjs : any +>cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : typeof mjs +>mjs : typeof cjs import * as type from "inner"; ->type : typeof mjs +>type : typeof cjs import * as ts from "inner/types"; ->ts : typeof mjs +>ts : typeof cjs export { cjs }; ->cjs : any +>cjs : typeof cjs export { mjs }; ->mjs : typeof mjs +>mjs : typeof cjs export { type }; ->type : typeof mjs +>type : typeof cjs export { ts }; ->ts : typeof mjs +>ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -234,15 +244,11 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff deleted file mode 100644 index 87fe4ad1ae8..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff +++ /dev/null @@ -1,264 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).types -+++ new.nodeModulesConditionalPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -+>cjsi.mjsSource : any - >cjsi : typeof cjsi -->mjsSource : true -+>mjsSource : any - - mjsi.mjsSource; -->mjsi.mjsSource : true -->mjsi : typeof cjsi -->mjsSource : true -+>mjsi.mjsSource : any -+>mjsi : any -+>mjsSource : any - - typei.mjsSource; -->typei.mjsSource : true -->typei : typeof cjsi -->mjsSource : true -+>typei.mjsSource : any -+>typei : any -+>mjsSource : any - - ts.mjsSource; -->ts.mjsSource : true -+>ts.mjsSource : any - >ts : typeof cjsi -->mjsSource : true -+>mjsSource : any - - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; -->cjsi : typeof cjsi -+>cjsi : any - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : typeof mjsi - - import * as ts from "inner/types"; -->ts : typeof cjsi -+>ts : typeof mjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -->cjsi : typeof cjsi -->mjsSource : true -+>cjsi.mjsSource : any -+>cjsi : any -+>mjsSource : any - - mjsi.mjsSource; - >mjsi.mjsSource : true -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - >mjsSource : true - - typei.mjsSource; - >typei.mjsSource : true -->typei : typeof cjsi -+>typei : typeof mjsi - >mjsSource : true - - ts.mjsSource; - >ts.mjsSource : true -->ts : typeof cjsi -+>ts : typeof mjsi - >mjsSource : true - - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -139, +139 lines =@@ - >cjsSource : true - - mjsi.cjsSource; -->mjsi.cjsSource : true -->mjsi : typeof cjsi -->cjsSource : true -+>mjsi.cjsSource : any -+>mjsi : any -+>cjsSource : any - - typei.implicitCjsSource; -->typei.implicitCjsSource : true -->typei : typeof cjsi.type -->implicitCjsSource : true -+>typei.implicitCjsSource : any -+>typei : any -+>implicitCjsSource : any - - ts.cjsSource; - >ts.cjsSource : true -@@= skipped -17, +17 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "inner"; -->type : typeof mjs.type -+>type : any - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : any - - export { type }; -->type : typeof mjs.type -+>type : any - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -63, +63 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof cjs -+>mjs : any - - import * as type from "inner"; -->type : typeof cjs.type -+>type : any - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs -+>mjs : any - - export { type }; -->type : typeof cjs.type -+>type : any - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 35c27166e72..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,153 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index e5d6ca3d03d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -51, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js index 87d5cda21ca..7653fb782c5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff deleted file mode 100644 index f1050b11573..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).js -+++ new.nodeModulesConditionalPackageExports(module=nodenext).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols index e574ed5f77e..fed90e232d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index cd9c20a1842..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).symbols -+++ new.nodeModulesConditionalPackageExports(module=nodenext).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types index 548c7f4fc2b..2cc0823cd4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff deleted file mode 100644 index 0fc79c354b9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).types -+++ new.nodeModulesConditionalPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt deleted file mode 100644 index a76044882d1..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,165 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -other.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(4,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(5,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (0 errors) ==== - // esm format file - export {}; -==== index.mts (0 errors) ==== - // esm format file - export {}; -==== index.cts (0 errors) ==== - // cjs format file - export {}; -==== other.ts (8 errors) ==== - // esm format file - export const a = await import("package/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = await import("package/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = await import("package"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = await import("inner"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.ts (4 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = await import("inner/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.mts (8 errors) ==== - // esm format file - export const a = await import("package/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = await import("package/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = await import("package"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = await import("inner"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.mts (4 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = await import("inner/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.cts (4 errors) ==== - // cjs format file, no TLA - export const a = import("package/cjs"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = import("package/mjs"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = import("package"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = import("inner"); - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.cts (2 errors) ==== - // cjs format file, no TLA - export const d = import("inner/cjs"); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = import("inner/mjs"); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const cjsMain = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const esm = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const cjsNonmain = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index 1162237fc7d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,169 +0,0 @@ ---- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt -+++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+other.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(4,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(5,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ export {}; -+==== index.mts (0 errors) ==== -+ // esm format file -+ export {}; -+==== index.cts (0 errors) ==== -+ // cjs format file -+ export {}; -+==== other.ts (8 errors) ==== -+ // esm format file -+ export const a = await import("package/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = await import("package/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = await import("package"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = await import("inner"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.ts (4 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = await import("inner/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.mts (8 errors) ==== -+ // esm format file -+ export const a = await import("package/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = await import("package/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = await import("package"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = await import("inner"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.mts (4 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = await import("inner/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.cts (4 errors) ==== -+ // cjs format file, no TLA -+ export const a = import("package/cjs"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = import("package/mjs"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = import("package"); -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = import("inner"); -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.cts (2 errors) ==== -+ // cjs format file, no TLA -+ export const d = import("inner/cjs"); -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = import("inner/mjs"); -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== node_modules/inner/index.d.ts (0 errors) ==== -+ // cjs format file -+ export const cjsMain = true; -+==== node_modules/inner/index.d.mts (0 errors) ==== -+ // esm format file -+ export const esm = true; -+==== node_modules/inner/index.d.cts (0 errors) ==== -+ // cjs format file -+ export const cjsNonmain = true; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": { -+ "./cjs": "./index.cjs", -+ "./mjs": "./index.mjs", -+ ".": "./index.js" -+ } -+ } -+==== node_modules/inner/package.json (0 errors) ==== -+ { -+ "name": "inner", -+ "private": true, -+ "exports": { -+ "./cjs": "./index.cjs", -+ "./mjs": "./index.mjs", -+ ".": "./index.js" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js index 247ae90c0c1..2f6a5a512fc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js @@ -71,46 +71,32 @@ export const cjsNonmain = true; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //// [other.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.c = exports.b = exports.a = void 0; // esm format file -exports.a = await import("package/cjs"); -exports.b = await import("package/mjs"); -exports.c = await import("package"); -exports.f = await import("inner"); +export const a = await import("package/cjs"); +export const b = await import("package/mjs"); +export const c = await import("package"); +export const f = await import("inner"); //// [other2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.e = exports.d = void 0; // esm format file -exports.d = await import("inner/cjs"); -exports.e = await import("inner/mjs"); +export const d = await import("inner/cjs"); +export const e = await import("inner/mjs"); //// [other.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.c = exports.b = exports.a = void 0; // esm format file -exports.a = await import("package/cjs"); -exports.b = await import("package/mjs"); -exports.c = await import("package"); -exports.f = await import("inner"); +export const a = await import("package/cjs"); +export const b = await import("package/mjs"); +export const c = await import("package"); +export const f = await import("inner"); //// [other2.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.e = exports.d = void 0; // esm format file -exports.d = await import("inner/cjs"); -exports.e = await import("inner/mjs"); +export const d = await import("inner/cjs"); +export const e = await import("inner/mjs"); //// [other.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -137,12 +123,10 @@ export {}; export {}; //// [other.d.ts] export declare const a: { - default: typeof import("./index.cts"); -}; -export declare const b: typeof import("./index.mts"); -export declare const c: { - default: typeof import("."); + default: typeof import("package/cjs"); }; +export declare const b: typeof import("package/mjs"); +export declare const c: typeof import("package"); export declare const f: { cjsMain: true; default: typeof import("inner"); @@ -158,9 +142,7 @@ export declare const a: { default: typeof import("package/cjs"); }; export declare const b: typeof import("package/mjs"); -export declare const c: { - default: typeof import("package"); -}; +export declare const c: typeof import("package"); export declare const f: { cjsMain: true; default: typeof import("inner"); @@ -175,10 +157,8 @@ export declare const e: typeof import("inner/mjs"); export declare const a: Promise<{ default: typeof import("./index.cts"); }>; -export declare const b: Promise; -export declare const c: Promise<{ - default: typeof import("."); -}>; +export declare const b: Promise; +export declare const c: Promise; export declare const f: Promise<{ cjsMain: true; default: typeof import("inner"); @@ -188,4 +168,4 @@ export declare const d: Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }>; -export declare const e: Promise; +export declare const e: Promise; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff index d1b723343b7..35b85506214 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff @@ -1,114 +1,11 @@ --- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js +++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js -@@= skipped -70, +70 lines =@@ - } - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [index.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [index.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - //// [other.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.c = exports.b = exports.a = void 0; - // esm format file --export const a = await import("package/cjs"); --export const b = await import("package/mjs"); --export const c = await import("package"); --export const f = await import("inner"); -+exports.a = await import("package/cjs"); -+exports.b = await import("package/mjs"); -+exports.c = await import("package"); -+exports.f = await import("inner"); - //// [other2.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.e = exports.d = void 0; - // esm format file --export const d = await import("inner/cjs"); --export const e = await import("inner/mjs"); -+exports.d = await import("inner/cjs"); -+exports.e = await import("inner/mjs"); - //// [other.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.c = exports.b = exports.a = void 0; - // esm format file --export const a = await import("package/cjs"); --export const b = await import("package/mjs"); --export const c = await import("package"); --export const f = await import("inner"); -+exports.a = await import("package/cjs"); -+exports.b = await import("package/mjs"); -+exports.c = await import("package"); -+exports.f = await import("inner"); - //// [other2.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.e = exports.d = void 0; - // esm format file --export const d = await import("inner/cjs"); --export const e = await import("inner/mjs"); -+exports.d = await import("inner/cjs"); -+exports.e = await import("inner/mjs"); - //// [other.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -52, +66 lines =@@ - export {}; - //// [other.d.ts] - export declare const a: { -- default: typeof import("package/cjs"); --}; --export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); -+ default: typeof import("./index.cts"); -+}; -+export declare const b: typeof import("./index.mts"); -+export declare const c: { -+ default: typeof import("."); -+}; - export declare const f: { - cjsMain: true; - default: typeof import("inner"); -@@= skipped -19, +21 lines =@@ - default: typeof import("package/cjs"); - }; - export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); -+export declare const c: { -+ default: typeof import("package"); -+}; - export declare const f: { - cjsMain: true; - default: typeof import("inner"); -@@= skipped -13, +15 lines =@@ +@@= skipped -154, +154 lines =@@ export declare const e: typeof import("inner/mjs"); //// [other.d.cts] export declare const a: Promise<{ - default: typeof import("./index.cjs"); --}>; --export declare const b: Promise; --export declare const c: Promise; + default: typeof import("./index.cts"); -+}>; -+export declare const b: Promise; -+export declare const c: Promise<{ -+ default: typeof import("."); -+}>; - export declare const f: Promise<{ - cjsMain: true; - default: typeof import("inner"); -@@= skipped -13, +15 lines =@@ - cjsNonmain: true; - default: typeof import("inner/cjs"); }>; --export declare const e: Promise; -+export declare const e: Promise; \ No newline at end of file + export declare const b: Promise; + export declare const c: Promise; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types index fe65a70478f..9f4bf477f61 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types @@ -27,9 +27,9 @@ export const b = await import("package/mjs"); >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : { default: typeof import("index"); } ->await import("package") : { default: typeof import("index"); } ->import("package") : Promise<{ default: typeof import("index"); }> +>c : typeof import("index") +>await import("package") : typeof import("index") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); @@ -67,9 +67,9 @@ export const b = await import("package/mjs"); >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : { default: typeof import("index"); } ->await import("package") : { default: typeof import("index"); } ->import("package") : Promise<{ default: typeof import("index"); }> +>c : typeof import("index") +>await import("package") : typeof import("index") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); @@ -100,13 +100,13 @@ export const a = import("package/cjs"); >"package/cjs" : "package/cjs" export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise +>b : Promise +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise<{ default: typeof import("index"); }> ->import("package") : Promise<{ default: typeof import("index"); }> +>c : Promise +>import("package") : Promise >"package" : "package" export const f = import("inner"); @@ -122,8 +122,8 @@ export const d = import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise +>e : Promise +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types.diff deleted file mode 100644 index b6cb0edebdc..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types -+++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types -@@= skipped -26, +26 lines =@@ - >"package/mjs" : "package/mjs" - - export const c = await import("package"); -->c : typeof import("index") -->await import("package") : typeof import("index") -->import("package") : Promise -+>c : { default: typeof import("index"); } -+>await import("package") : { default: typeof import("index"); } -+>import("package") : Promise<{ default: typeof import("index"); }> - >"package" : "package" - - export const f = await import("inner"); -@@= skipped -40, +40 lines =@@ - >"package/mjs" : "package/mjs" - - export const c = await import("package"); -->c : typeof import("index") -->await import("package") : typeof import("index") -->import("package") : Promise -+>c : { default: typeof import("index"); } -+>await import("package") : { default: typeof import("index"); } -+>import("package") : Promise<{ default: typeof import("index"); }> - >"package" : "package" - - export const f = await import("inner"); -@@= skipped -33, +33 lines =@@ - >"package/cjs" : "package/cjs" - - export const b = import("package/mjs"); -->b : Promise -->import("package/mjs") : Promise -+>b : Promise -+>import("package/mjs") : Promise - >"package/mjs" : "package/mjs" - - export const c = import("package"); -->c : Promise -->import("package") : Promise -+>c : Promise<{ default: typeof import("index"); }> -+>import("package") : Promise<{ default: typeof import("index"); }> - >"package" : "package" - - export const f = import("inner"); -@@= skipped -22, +22 lines =@@ - >"inner/cjs" : "inner/cjs" - - export const e = import("inner/mjs"); -->e : Promise -->import("inner/mjs") : Promise -+>e : Promise -+>import("inner/mjs") : Promise - >"inner/mjs" : "inner/mjs" - - === node_modules/inner/index.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt index 42e0135c94f..0dbba02dffb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. @@ -14,7 +13,6 @@ node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.ts (3 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff index 2d3c51a9082..7ea35d1c064 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff @@ -1,7 +1,6 @@ --- old.nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt +++ new.nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. +index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. @@ -17,7 +16,6 @@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (0 errors) ==== - // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js index 9c18403d162..cec3b8c991b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js @@ -92,53 +92,80 @@ export const cjsNonmain = true; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -exports.a = cjs; -exports.b = mjs; -exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); -exports.d = cjsi; -exports.e = mjsi; -exports.f = typei; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -exports.a = cjs; -exports.b = mjs; -exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); -exports.d = cjsi; -exports.e = mjsi; -exports.f = typei; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); exports.a = cjs; exports.b = mjs; exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); exports.d = cjsi; exports.e = mjsi; exports.f = typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff index f6515719329..31cf9c15453 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff @@ -5,104 +5,23 @@ } +//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; +// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+exports.a = cjs; -+exports.b = mjs; -+exports.c = type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+exports.d = cjsi; -+exports.e = mjsi; -+exports.f = typei; ++import * as cjs from "package/cjs"; ++import * as mjs from "package/mjs"; ++import * as type from "package"; ++export const a = cjs; ++export const b = mjs; ++export const c = type; ++import * as cjsi from "inner/cjs"; ++import * as mjsi from "inner/mjs"; ++import * as typei from "inner"; ++export const d = cjsi; ++export const e = mjsi; ++export const f = typei; //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --export const a = cjs; --export const b = mjs; --export const c = type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --export const d = cjsi; --export const e = mjsi; --export const f = typei; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+exports.a = cjs; -+exports.b = mjs; -+exports.c = type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+exports.d = cjsi; -+exports.e = mjsi; -+exports.f = typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - exports.a = cjs; - exports.b = mjs; - exports.c = type; --const cjsi = __importStar(require("inner/cjs")); --const mjsi = __importStar(require("inner/mjs")); --const typei = __importStar(require("inner")); -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); + import * as cjs from "package/cjs"; +@@= skipped -64, +78 lines =@@ exports.d = cjsi; exports.e = mjsi; exports.f = typei; @@ -144,7 +63,7 @@ import * as cjsi from "inner/cjs"; import * as mjsi from "inner/mjs"; import * as typei from "inner"; -@@= skipped -94, +74 lines =@@ +@@= skipped -30, +23 lines =@@ export declare const e: typeof mjsi; export declare const f: typeof typei; //// [index.d.cts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt deleted file mode 100644 index a655ed99d10..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.ts (1 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== index.ts (1 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt.diff deleted file mode 100644 index de9ac74c578..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.nodeModulesDynamicImport(module=node20).errors.txt -+++ new.nodeModulesDynamicImport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.ts (1 errors) ==== -+ // cjs format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== index.ts (1 errors) ==== -+ // esm format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js index bf08c0a12b4..378a054d251 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js @@ -32,11 +32,8 @@ async function main() { const { readFile } = await import("fs"); } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; // esm format file -async function main() { +export async function main() { const { readFile } = await import("fs"); } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js.diff deleted file mode 100644 index 0fd4de873a0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesDynamicImport(module=node20).js -+++ new.nodeModulesDynamicImport(module=node20).js -@@= skipped -31, +31 lines =@@ - const { readFile } = await import("fs"); - } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.main = main; - // esm format file --export async function main() { -+async function main() { - const { readFile } = await import("fs"); - } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt index e50b0b09b17..edb49c7a61f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt @@ -1,15 +1,16 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const a = {}; export = a; -==== index.ts (0 errors) ==== +==== index.ts (1 errors) ==== // esm format file const a = {}; export = a; + ~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt.diff deleted file mode 100644 index feb3f5a4d02..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesExportAssignments(module=node20).errors.txt -+++ new.nodeModulesExportAssignments(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.ts (0 errors) ==== - // cjs format file - const a = {}; - export = a; --==== index.ts (1 errors) ==== -+==== index.ts (0 errors) ==== - // esm format file - const a = {}; - export = a; -- ~~~~~~~~~~~ --!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js index 9154d21a05c..2d09438ae7c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js @@ -25,10 +25,9 @@ export = a; const a = {}; module.exports = a; //// [index.js] -"use strict"; // esm format file const a = {}; -module.exports = a; +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js.diff deleted file mode 100644 index 2859fc5f474..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportAssignments(module=node20).js -+++ new.nodeModulesExportAssignments(module=node20).js -@@= skipped -24, +24 lines =@@ - const a = {}; - module.exports = a; - //// [index.js] -+"use strict"; - // esm format file - const a = {}; --export {}; -+module.exports = a; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt index 55591636a6e..7e86097227b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt @@ -1,25 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt.diff deleted file mode 100644 index 19f1eede66e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt -+++ new.nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. --index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -- -- --==== index.ts (2 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner")).x(); - ~ --!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js index f558b624bef..8ce6f039f9e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js @@ -27,10 +27,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff index 6e9c90d11c9..bd91f3c3b9d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff @@ -1,14 +1,9 @@ --- old.nodeModulesExportsBlocksSpecifierResolution(module=node20).js +++ new.nodeModulesExportsBlocksSpecifierResolution(module=node20).js -@@= skipped -26, +26 lines =@@ - } +@@= skipped -27, +27 lines =@@ //// [index.js] --export const a = (await import("inner")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner")).x(); + export const a = (await import("inner")).x(); + + +//// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt index 37a1b1be0a3..8300f6aaaaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';` /main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. @@ -9,7 +8,6 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci /main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/exports-and-types-versions/package.json (0 errors) ==== { "name": "exports-and-types-versions", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff index 40655da946a..70c6cfa3d3f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff @@ -4,18 +4,16 @@ -error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? - The file is in the program because: - Root file specified for compilation -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';` /main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +7 lines =@@ /main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. -!!! error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/exports-and-types-versions/package.json (0 errors) ==== { "name": "exports-and-types-versions", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js index f7796d030e1..396ca2dfc4b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js @@ -67,5 +67,4 @@ import {} from "just-types-versions/foo"; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //// [main.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js.diff deleted file mode 100644 index 2cf01b48ca2..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.nodeModulesExportsBlocksTypesVersions(module=node20).js -+++ new.nodeModulesExportsBlocksTypesVersions(module=node20).js -@@= skipped -66, +66 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - //// [main.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json index f9de318d95d..3de2816effd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json @@ -1,6 +1,6 @@ ======== Resolving module 'exports-and-types-versions/foo' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist. Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -21,8 +21,8 @@ File '/node_modules/exports-and-types-versions/dist/foo.js' exists - use it as a Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'. ======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/nope' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -34,8 +34,8 @@ File '/node_modules/exports-and-types-versions/package.json' exists according to Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/nope' was not resolved. ======== ======== Resolving module 'exports-and-types-versions/yep' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -50,8 +50,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -66,8 +66,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -85,8 +85,8 @@ Exiting conditional exports. Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ======== ======== Resolving module 'just-types-versions/foo' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'just-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -99,8 +99,8 @@ File '/node_modules/just-types-versions/types/foo.d.ts' exists - use it as a nam Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'. ======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ======== ======== Resolving module 'exports-and-types-versions/foo' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -132,8 +132,8 @@ File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it a Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -145,8 +145,8 @@ File '/node_modules/exports-and-types-versions/package.json' exists according to Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/nope' was not resolved. ======== ======== Resolving module 'exports-and-types-versions/yep' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -161,8 +161,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -177,8 +177,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -196,8 +196,8 @@ Exiting conditional exports. Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ======== ======== Resolving module 'just-types-versions/foo' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'just-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt index f95a2a053a1..1ab8b6bb276 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /main.mts(1,16): error TS2307: Cannot find module 'double-asterisk/a/*/b/*/c/*' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/double-asterisk/package.json (0 errors) ==== { "name": "double-asterisk", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt.diff deleted file mode 100644 index 78261c12e58..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesExportsDoubleAsterisk(module=node20).errors.txt -+++ new.nodeModulesExportsDoubleAsterisk(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /main.mts(1,16): error TS2307: Cannot find module 'double-asterisk/a/*/b/*/c/*' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /node_modules/double-asterisk/package.json (0 errors) ==== - { - "name": "double-asterisk", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt index 989de809986..358a0e61437 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt @@ -1,25 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. import {a as a2} from "package"; ==== node_modules/inner/index.ts (0 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt.diff deleted file mode 100644 index a223b1162eb..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesExportsSourceTs(module=node20).errors.txt -+++ new.nodeModulesExportsSourceTs(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. --index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -- -- --==== index.ts (2 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner")).x(); - ~ --!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - import {a as a2} from "package"; - ==== node_modules/inner/index.ts (0 errors) ==== - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js index b36131ba71d..be568de76df 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js @@ -28,22 +28,12 @@ export const x: () => Thing = null as any; } //// [other.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -exports.x = null; +export const x = null; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file -const other_js_1 = require("./other.js"); -Object.defineProperty(exports, "x", { enumerable: true, get: function () { return other_js_1.x; } }); +export { x } from "./other.js"; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [other.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff index 27231a616c5..89f464f85d4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff @@ -1,32 +1,6 @@ --- old.nodeModulesExportsSourceTs(module=node20).js +++ new.nodeModulesExportsSourceTs(module=node20).js -@@= skipped -27, +27 lines =@@ - } - - //// [other.js] --export const x = null; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+exports.x = null; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file --export { x } from "./other.js"; -+const other_js_1 = require("./other.js"); -+Object.defineProperty(exports, "x", { enumerable: true, get: function () { return other_js_1.x; } }); - //// [index.js] --export const a = (await import("inner")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner")).x(); - - - //// [other.d.ts] -@@= skipped -14, +24 lines =@@ +@@= skipped -41, +41 lines =@@ export declare const x: () => Thing; //// [index.d.ts] export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt index 3b23bb27fcc..08ce05322d3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt @@ -1,22 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -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', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other.js"; // should fail ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt.diff deleted file mode 100644 index 7f4d73b8f40..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt -+++ new.nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -- -- --==== index.ts (1 errors) ==== -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (3 errors) ==== - // esm format file - import { Thing } from "inner/other.js"; // should fail - ~~~~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. - export const a = (await import("inner")).x(); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js index 0b91e6e8c23..5db58ae2f7b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js @@ -34,10 +34,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js.diff deleted file mode 100644 index 3aee866d9b1..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationConditions(module=node20).js -+++ new.nodeModulesExportsSpecifierGenerationConditions(module=node20).js -@@= skipped -33, +33 lines =@@ - } - - //// [index.js] --export const a = (await import("inner")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner")).x(); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt index 776f5c3154d..f7015dbf604 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt @@ -1,22 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -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', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt.diff deleted file mode 100644 index 78dc8025422..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt -+++ new.nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -- -- --==== index.ts (1 errors) ==== -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (3 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner/index.js")).x(); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js index a29dc3b42fb..c0d6b006b33 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js @@ -29,10 +29,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner/index.js")).x(); +export const a = (await import("inner/index.js")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js.diff deleted file mode 100644 index 1ef50899e4d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationDirectory(module=node20).js -+++ new.nodeModulesExportsSpecifierGenerationDirectory(module=node20).js -@@= skipped -28, +28 lines =@@ - } - - //// [index.js] --export const a = (await import("inner/index.js")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner/index.js")).x(); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt index deab9a91022..002881ca1c0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt @@ -1,22 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -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', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt.diff deleted file mode 100644 index c16b95b3046..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt -+++ new.nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -- -- --==== index.ts (1 errors) ==== -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (3 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner/index.js")).x(); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js index 691f9516da8..dcdd62bed69 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js @@ -29,10 +29,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner/index.js")).x(); +export const a = (await import("inner/index.js")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js.diff deleted file mode 100644 index 54179a71724..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationPattern(module=node20).js -+++ new.nodeModulesExportsSpecifierGenerationPattern(module=node20).js -@@= skipped -28, +28 lines =@@ - } - - //// [index.js] --export const a = (await import("inner/index.js")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner/index.js")).x(); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt index 5b6a3a9e32b..2a2784ec238 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. subfolder/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. @@ -9,7 +8,6 @@ subfolder2/index.cts(2,12): error TS7060: This syntax is reserved in files with subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = () => (void 0); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff index 6ce3bfd7b6c..6f0f8373bda 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff @@ -1,7 +1,6 @@ --- old.nodeModulesForbidenSyntax(module=node20).errors.txt +++ new.nodeModulesForbidenSyntax(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. -index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. @@ -26,11 +25,8 @@ subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. -subfolder2/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -subfolder2/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -- -- -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = () => (void 0); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js index 43e30cd2d23..4cca6af5a58 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js @@ -81,12 +81,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -102,26 +99,17 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -130,12 +118,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -144,12 +129,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js.diff deleted file mode 100644 index cb12c8b5de8..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js.diff +++ /dev/null @@ -1,129 +0,0 @@ ---- old.nodeModulesForbidenSyntax(module=node20).js -+++ new.nodeModulesForbidenSyntax(module=node20).js -@@= skipped -80, +80 lines =@@ - const x = () => (void 0); - exports.x = x; - //// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.js] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.js] --// esm format file --const x = () => (void 0); --export { x }; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt index 348ada08aa9..cba5d90874c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt @@ -1,13 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (3 errors) ==== // cjs format file function require() {} @@ -21,18 +16,12 @@ subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is res ~~~~~~~~~~ !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file function require() {} - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. const exports = {}; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} export const __esModule = false; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff index cf0adc9518b..4e05f3c0b9f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff @@ -1,10 +1,6 @@ --- old.nodeModulesGeneratedNameCollisions(module=node20).errors.txt +++ new.nodeModulesGeneratedNameCollisions(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. @@ -12,12 +8,11 @@ -==== subfolder/index.ts (4 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== subfolder/index.ts (3 errors) ==== // cjs format file function require() {} ~~~~~~~ -@@= skipped -12, +16 lines =@@ +@@= skipped -12, +11 lines =@@ ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} @@ -25,21 +20,4 @@ -!!! error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. export const __esModule = false; ~~~~~~~~~~ - !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; --==== index.ts (0 errors) ==== -+==== index.ts (3 errors) ==== - // esm format file - function require() {} -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - const exports = {}; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - class Object {} - export const __esModule = false; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; - ==== package.json (0 errors) ==== - { \ No newline at end of file + !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js index d399ccc45b2..3b196cd32c9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js @@ -39,18 +39,13 @@ class Object { exports.Object = Object; exports.__esModule = false; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Object = exports.exports = exports.__esModule = void 0; -exports.require = require; // esm format file function require() { } const exports = {}; -exports.exports = exports; class Object { } -exports.Object = Object; -exports.__esModule = false; +export const __esModule = false; +export { require, exports, Object }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js.diff deleted file mode 100644 index 44d4c338269..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesGeneratedNameCollisions(module=node20).js -+++ new.nodeModulesGeneratedNameCollisions(module=node20).js -@@= skipped -38, +38 lines =@@ - exports.Object = Object; - exports.__esModule = false; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Object = exports.exports = exports.__esModule = void 0; -+exports.require = require; - // esm format file - function require() { } - const exports = {}; -+exports.exports = exports; - class Object { - } --export const __esModule = false; --export { require, exports, Object }; -+exports.Object = Object; -+exports.__esModule = false; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt index 52276b78eb7..f4002d5a5ae 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt @@ -1,24 +1,17 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -==== otherc.cts (3 errors) ==== +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +==== otherc.cts (2 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff index f576df6162e..3feaff9e321 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff @@ -1,36 +1,23 @@ --- old.nodeModulesImportAssertions(module=node20).errors.txt +++ new.nodeModulesImportAssertions(module=node20).errors.txt @@= skipped -0, +0 lines =@@ --index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. + + ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --==== otherc.cts (1 errors) ==== + ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+==== otherc.cts (3 errors) ==== + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +-==== otherc.cts (1 errors) ==== ++==== otherc.cts (2 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js index e8d43f0ad3e..091166d523c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js @@ -13,8 +13,7 @@ const json2 = import("./package.json", { assert: { type: "json" } }); // should } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js.diff deleted file mode 100644 index 663a9948984..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportAssertions(module=node20).js -+++ new.nodeModulesImportAssertions(module=node20).js -@@= skipped -12, +12 lines =@@ - } - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [otherc.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt deleted file mode 100644 index f5dc3bcd4a2..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== index.ts (0 errors) ==== - // esm format file - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== file.ts (0 errors) ==== - // esm format file - const __require = null; - const _createRequire = null; - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt.diff deleted file mode 100644 index ec7114c370d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.nodeModulesImportAssignments(module=node20).errors.txt -+++ new.nodeModulesImportAssignments(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ import fs = require("fs"); -+ fs.readFile; -+ export import fs2 = require("fs"); -+==== index.ts (0 errors) ==== -+ // esm format file -+ import fs = require("fs"); -+ fs.readFile; -+ export import fs2 = require("fs"); -+==== file.ts (0 errors) ==== -+ // esm format file -+ const __require = null; -+ const _createRequire = null; -+ import fs = require("fs"); -+ fs.readFile; -+ export import fs2 = require("fs"); -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js index 4a8f44fd00b..c73ff1177a5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js @@ -38,21 +38,23 @@ const fs = require("fs"); fs.readFile; exports.fs2 = require("fs"); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const fs = require("fs"); +const fs = __require("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require("fs"); +export { fs2 }; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire_1 } from "module"; +const __require_1 = _createRequire_1(import.meta.url); // esm format file const __require = null; const _createRequire = null; -const fs = require("fs"); +const fs = __require_1("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require_1("fs"); +export { fs2 }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js.diff deleted file mode 100644 index 487c7a16f5f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.nodeModulesImportAssignments(module=node20).js -+++ new.nodeModulesImportAssignments(module=node20).js -@@= skipped -37, +37 lines =@@ - fs.readFile; - exports.fs2 = require("fs"); - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const fs = __require("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require("fs"); --export { fs2 }; -+exports.fs2 = require("fs"); - //// [file.js] --import { createRequire as _createRequire_1 } from "module"; --const __require_1 = _createRequire_1(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file - const __require = null; - const _createRequire = null; --const fs = __require_1("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require_1("fs"); --export { fs2 }; -+exports.fs2 = require("fs"); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt index d88e87af1ed..1e6ecc34609 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt @@ -1,24 +1,14 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -==== otherc.cts (3 errors) ==== +==== otherc.cts (2 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff index 044a03b8249..d5642015631 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff @@ -1,31 +1,18 @@ --- old.nodeModulesImportAttributes(module=node20).errors.txt +++ new.nodeModulesImportAttributes(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -- -- --==== index.ts (0 errors) ==== -+otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (1 errors) ==== + + + ==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; -==== otherc.cts (1 errors) ==== -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+==== otherc.cts (3 errors) ==== ++==== otherc.cts (2 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js index 9653caaf245..fb3984fd32c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js @@ -14,8 +14,7 @@ const json2 = import("./package.json", { with: { type: "json" } }); // should be //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js.diff deleted file mode 100644 index 5fff2feb8fa..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportAttributes(module=node20).js -+++ new.nodeModulesImportAttributes(module=node20).js -@@= skipped -13, +13 lines =@@ - - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [otherc.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt index 632d06d35e8..bf4698ad28e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt.diff deleted file mode 100644 index e0b5269a031..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - /index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt index addbdc7542e..5c93150f88f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; @@ -12,13 +10,13 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt.diff deleted file mode 100644 index 80d903d8bd4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. --/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; -@@= skipped -9, +11 lines =@@ - export interface LocalInterface extends RequireInterface, ImportInterface {} - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; -- ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; -+ ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js index 69c5d82a550..afe399f85b0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js @@ -33,8 +33,7 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js.diff deleted file mode 100644 index 9b61873921b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js -@@= skipped -32, +32 lines =@@ - - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols index ad56b2736e0..d76777ff60b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols @@ -13,10 +13,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols.diff deleted file mode 100644 index 546fdea9992..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols -@@= skipped -12, +12 lines =@@ - >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - >Req : Symbol(Req, Decl(index.ts, 5, 8)) - - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) - >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) - - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt index 88079dbecba..c45ca1322b3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. @@ -6,7 +5,6 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci /index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt.diff deleted file mode 100644 index 9c5c7ae7ba7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -@@= skipped -4, +5 lines =@@ - /index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (5 errors) ==== - // incorrect mode - import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt deleted file mode 100644 index bd5d0b5c58b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt.diff deleted file mode 100644 index 83893a3db33..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ export type LocalInterface = -+ & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface -+ & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; -+ -+ export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); -+ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export interface ImportInterface {} -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js index 9fbb7e7ce63..cca2ca8a852 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js @@ -33,4 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff index 7d0d22ec4b0..cd6f54231ba 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff @@ -5,6 +5,5 @@ //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +export declare const a: import("pkg").RequireInterface; -+export declare const b: any; \ No newline at end of file + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt index 858b72088ec..1075b870f1a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt @@ -1,8 +1,5 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -10,7 +7,6 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(3,51): error TS1128: Declaration or statement expected. /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -43,8 +39,10 @@ error TS2468: Cannot find global value 'Promise'. /other3.ts(3,55): error TS1005: ';' expected. /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. + Types of property 'with' are incompatible. + Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. + Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(6,48): error TS1005: '{' expected. @@ -60,7 +58,6 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(6,31): error TS1128: Declaration or statement expected. /other4.ts(6,32): error TS1128: Declaration or statement expected. /other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. /other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -81,8 +78,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -98,7 +93,7 @@ error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (3 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -109,10 +104,8 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing with: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface @@ -132,8 +125,6 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ @@ -201,7 +192,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -==== /other3.ts (17 errors) ==== +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface @@ -219,10 +210,11 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. +!!! error TS2322: Types of property 'with' are incompatible. +!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. +!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. @@ -247,7 +239,7 @@ error TS2468: Cannot find global value 'Promise'. ~ !!! error TS1005: ',' expected. -==== /other4.ts (19 errors) ==== +==== /other4.ts (18 errors) ==== // Indirected attribute objecty-thing - not allowed type Attribute1 = { with: {"resolution-mode": "require"} }; type Attribute2 = { with: {"resolution-mode": "import"} }; @@ -270,8 +262,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. !!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. & import("pkg", Attribute2).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~ !!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt.diff deleted file mode 100644 index da3d725881e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,121 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other.ts(3,22): error TS1005: 'with' expected. - /other.ts(3,39): error TS1005: ';' expected. -@@= skipped -6, +9 lines =@@ - /other.ts(3,51): error TS1128: Declaration or statement expected. - /other.ts(3,52): error TS1128: Declaration or statement expected. - /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -+/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -32, +33 lines =@@ - /other3.ts(3,55): error TS1005: ';' expected. - /other3.ts(3,56): error TS1128: Declaration or statement expected. - /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. --/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. -- Types of property 'with' are incompatible. -- Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. -- Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other3.ts(6,48): error TS1005: '{' expected. -@@= skipped -19, +17 lines =@@ - /other4.ts(6,31): error TS1128: Declaration or statement expected. - /other4.ts(6,32): error TS1128: Declaration or statement expected. - /other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -+/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. - /other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -20, +21 lines =@@ - /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -15, +17 lines =@@ - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} - --==== /index.ts (2 errors) ==== -+==== /index.ts (3 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -11, +11 lines =@@ - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - --==== /other.ts (27 errors) ==== -+==== /other.ts (28 errors) ==== - // missing with: - export type LocalInterface = - & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -21, +23 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", {"resolution-mode": "import"}).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~ - !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ -@@= skipped -67, +69 lines =@@ - ~~~~~~~~~~~~~~~ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - --==== /other3.ts (16 errors) ==== -+==== /other3.ts (17 errors) ==== - // Array instead of object-y thing - export type LocalInterface = - & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface -@@= skipped -18, +18 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. --!!! error TS2322: Types of property 'with' are incompatible. --!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. --!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ - !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - -@@= skipped -29, +28 lines =@@ - ~ - !!! error TS1005: ',' expected. - --==== /other4.ts (18 errors) ==== -+==== /other4.ts (19 errors) ==== - // Indirected attribute objecty-thing - not allowed - type Attribute1 = { with: {"resolution-mode": "require"} }; - type Attribute2 = { with: {"resolution-mode": "import"} }; -@@= skipped -23, +23 lines =@@ - !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. - !!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. - & import("pkg", Attribute2).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~ - !!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. - !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js index 3ec56874ba5..63b333fded1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js @@ -128,7 +128,7 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff index 61fe56d44a3..03248211ea9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff @@ -5,9 +5,8 @@ //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +export declare const a: import("pkg").RequireInterface; -+export declare const b: any; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); -export declare const a: import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt deleted file mode 100644 index 4e7150fb301..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== index.ts (0 errors) ==== - // esm format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff index 8e855c24c07..b24e7cf8c7c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff @@ -6,19 +6,35 @@ - - -==== subfolder/index.ts (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; +- // cjs format file +- import {default as _fs} from "fs"; - ~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - _fs.readFile; - import * as fs from "fs"; +- _fs.readFile; +- import * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - fs.readFile; - ==== index.ts (0 errors) ==== - // esm format file \ No newline at end of file +- fs.readFile; +-==== index.ts (0 errors) ==== +- // esm format file +- import {default as _fs} from "fs"; +- _fs.readFile; +- import * as fs from "fs"; +- fs.readFile; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js index aab681b9dbd..4712d65a099 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js @@ -32,18 +32,17 @@ declare module "tslib" { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); // cjs format file -const fs_1 = require("fs"); +const fs_1 = tslib_1.__importDefault(require("fs")); fs_1.default.readFile; -const fs = require("fs"); +const fs = tslib_1.__importStar(require("fs")); fs.readFile; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const fs_1 = require("fs"); -fs_1.default.readFile; -const fs = require("fs"); +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; fs.readFile; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js.diff deleted file mode 100644 index 41daad37805..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesImportHelpersCollisions(module=node20).js -+++ new.nodeModulesImportHelpersCollisions(module=node20).js -@@= skipped -31, +31 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --const tslib_1 = require("tslib"); - // cjs format file --const fs_1 = tslib_1.__importDefault(require("fs")); -+const fs_1 = require("fs"); - fs_1.default.readFile; --const fs = tslib_1.__importStar(require("fs")); -+const fs = require("fs"); - fs.readFile; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import { default as _fs } from "fs"; --_fs.readFile; --import * as fs from "fs"; -+const fs_1 = require("fs"); -+fs_1.default.readFile; -+const fs = require("fs"); - fs.readFile; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt deleted file mode 100644 index 528640dfca5..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; - export * as fs from "fs"; -==== index.ts (0 errors) ==== - // esm format file - export * from "fs"; - export * as fs from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff index 98a280a836a..a270e18c187 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff @@ -6,18 +6,31 @@ - - -==== subfolder/index.ts (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; +- // cjs format file +- export * from "fs"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - export * as fs from "fs"; +- export * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - ==== index.ts (0 errors) ==== - // esm format file - export * from "fs"; \ No newline at end of file +-==== index.ts (0 errors) ==== +- // esm format file +- export * from "fs"; +- export * as fs from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js index 261ce2d4e5c..c058d00e216 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js @@ -32,15 +32,11 @@ exports.fs = void 0; const tslib_1 = require("tslib"); // cjs format file tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +exports.fs = tslib_1.__importStar(require("fs")); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; -const tslib_1 = require("tslib"); // esm format file -tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +export * from "fs"; +export * as fs from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js.diff deleted file mode 100644 index a7ab464c9df..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.nodeModulesImportHelpersCollisions2(module=node20).js -+++ new.nodeModulesImportHelpersCollisions2(module=node20).js -@@= skipped -31, +31 lines =@@ - const tslib_1 = require("tslib"); - // cjs format file - tslib_1.__exportStar(require("fs"), exports); --exports.fs = tslib_1.__importStar(require("fs")); -+exports.fs = require("fs"); - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.fs = void 0; -+const tslib_1 = require("tslib"); - // esm format file --export * from "fs"; --export * as fs from "fs"; -+tslib_1.__exportStar(require("fs"), exports); -+exports.fs = require("fs"); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt deleted file mode 100644 index 0554ea2a847..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export {default} from "fs"; -==== index.ts (0 errors) ==== - // esm format file - export {default} from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff index 33922b346e8..de662bf1842 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff @@ -5,15 +5,27 @@ - - -==== subfolder/index.ts (1 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - export {default} from "fs"; +- // cjs format file +- export {default} from "fs"; - ~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - ==== index.ts (0 errors) ==== - // esm format file - export {default} from "fs"; \ No newline at end of file +-==== index.ts (0 errors) ==== +- // esm format file +- export {default} from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js index 95fcaaf972b..f0c393ef767 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js @@ -27,16 +27,13 @@ declare module "tslib" { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; +const tslib_1 = require("tslib"); // cjs format file const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; // esm format file -const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +export { default } from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff index b140abfd971..e4ae6774d81 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff @@ -5,19 +5,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var tslib_1 = require("tslib"); ++const tslib_1 = require("tslib"); // cjs format file -var fs_1 = require("fs"); --Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); +const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); + Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.default = void 0; - // esm format file --export { default } from "fs"; -+const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); - - - //// [index.d.ts] \ No newline at end of file + // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt index fc1e3584786..dc4849ff509 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (1 errors) ==== // cjs format file const x = import.meta.url; ~~~~~~~~~~~ !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== // esm format file const x = import.meta.url; - ~~~~~~~~~~~ -!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt.diff deleted file mode 100644 index 977ab6e7c57..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesImportMeta(module=node20).errors.txt -+++ new.nodeModulesImportMeta(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.ts (1 errors) ==== - // cjs format file - const x = import.meta.url; - ~~~~~~~~~~~ - !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; --==== index.ts (0 errors) ==== -+==== index.ts (1 errors) ==== - // esm format file - const x = import.meta.url; -+ ~~~~~~~~~~~ -+!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; - ==== package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js index a42ca0aa55d..aa962a90bd3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js @@ -27,12 +27,9 @@ exports.x = void 0; const x = import.meta.url; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = import.meta.url; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js.diff deleted file mode 100644 index 49987bc374c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesImportMeta(module=node20).js -+++ new.nodeModulesImportMeta(module=node20).js -@@= skipped -26, +26 lines =@@ - const x = import.meta.url; - exports.x = x; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = import.meta.url; --export { x }; -+exports.x = x; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt index 138464954cc..b81d5cf9c74 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; @@ -13,12 +11,12 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff index 08f7f04a961..08655babfe1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff @@ -1,35 +1,17 @@ --- old.nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt +++ new.nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -@@= skipped -9, +11 lines =@@ +@@= skipped -9, +9 lines =@@ export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt index e9b0ad85546..4d278fd27cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; @@ -12,13 +10,13 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff index 9268ebaf28f..5cc2b7a0cbb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff @@ -1,38 +1,15 @@ --- old.nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt +++ new.nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -@@= skipped -9, +11 lines =@@ - export interface LocalInterface extends RequireInterface, ImportInterface {} - +@@= skipped -11, +11 lines =@@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -- ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + ~~~~~~~~~~~~~~~~ + !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js index 7495778bd6f..fad19d466a6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js @@ -33,8 +33,7 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js.diff deleted file mode 100644 index bf70dd1922b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node20).js -+++ new.nodeModulesImportModeDeclarationEmit2(module=node20).js -@@= skipped -32, +32 lines =@@ - - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols index 21ec7573e91..8d280aee6ff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols @@ -13,10 +13,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols.diff deleted file mode 100644 index a3ae55dd433..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node20).symbols -+++ new.nodeModulesImportModeDeclarationEmit2(module=node20).symbols -@@= skipped -12, +12 lines =@@ - >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) - - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - >Req : Symbol(Req, Decl(index.ts, 5, 8)) - - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) - >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) - - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt index 1c6cd18d799..3615fe44ff1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt @@ -1,17 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only @@ -19,11 +17,11 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff index 338a065a9aa..4dd761a4bef 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff @@ -1,43 +1,25 @@ --- old.nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt +++ new.nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +@@= skipped -7, +7 lines =@@ ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. - // not type-only +@@= skipped -8, +8 lines =@@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - export interface LocalInterface extends RequireInterface, ImportInterface {} - \ No newline at end of file + export interface LocalInterface extends RequireInterface, ImportInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt deleted file mode 100644 index d176b3aa9a2..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as type from "#type"; - type; -==== index.mts (0 errors) ==== - // esm format file - import * as type from "#type"; - type; -==== index.cts (0 errors) ==== - // esm format file - import * as type from "#type"; - type; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.cjs", - "imports": { - "#type": "package" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt.diff deleted file mode 100644 index b4d424595c9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesImportResolutionIntoExport(module=node20).errors.txt -+++ new.nodeModulesImportResolutionIntoExport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as type from "#type"; -+ type; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as type from "#type"; -+ type; -+==== index.cts (0 errors) ==== -+ // esm format file -+ import * as type from "#type"; -+ type; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.cjs", -+ "imports": { -+ "#type": "package" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js index 1a56ef1572d..a60b20a63d2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js @@ -25,21 +25,50 @@ type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +const type = __importStar(require("#type")); type; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js.diff deleted file mode 100644 index dfe7aff0343..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.nodeModulesImportResolutionIntoExport(module=node20).js -+++ new.nodeModulesImportResolutionIntoExport(module=node20).js -@@= skipped -24, +24 lines =@@ - - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const type = __importStar(require("#type")); -+const type = require("#type"); - type; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt index 5e909768fbb..01d8a2fd083 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. index.mts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. index.ts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (1 errors) ==== // esm format file import * as type from "#type"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt.diff deleted file mode 100644 index 095146d6a27..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportResolutionNoCycle(module=node20).errors.txt -+++ new.nodeModulesImportResolutionNoCycle(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.cts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. - index.mts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. - index.ts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (1 errors) ==== - // esm format file - import * as type from "#type"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js index 4d9239ee439..fa6401e1a49 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js @@ -24,22 +24,51 @@ type; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +const type = __importStar(require("#type")); type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js.diff deleted file mode 100644 index fb7688b906e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesImportResolutionNoCycle(module=node20).js -+++ new.nodeModulesImportResolutionNoCycle(module=node20).js -@@= skipped -23, +23 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const type = __importStar(require("#type")); -+const type = require("#type"); - type; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt deleted file mode 100644 index 6dcd7d2b075..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff deleted file mode 100644 index 5090854ce70..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ export type LocalInterface = -+ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface -+ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; -+ -+ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); -+ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export interface ImportInterface {} -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js index 26d582ef142..6c0a3531fac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js @@ -33,4 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js.diff deleted file mode 100644 index e10cb6750ac..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node20).js -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node20).js -@@= skipped -32, +32 lines =@@ - //// [index.d.ts] - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt index 6bd5fde7a41..632a556e139 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt @@ -1,8 +1,5 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -10,7 +7,6 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(3,51): error TS1128: Declaration or statement expected. /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -43,8 +39,10 @@ error TS2468: Cannot find global value 'Promise'. /other3.ts(3,55): error TS1005: ';' expected. /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. + Types of property 'with' are incompatible. + Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. + Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(6,48): error TS1005: '{' expected. @@ -60,7 +58,6 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(6,29): error TS1128: Declaration or statement expected. /other4.ts(6,30): error TS1128: Declaration or statement expected. /other4.ts(6,31): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. /other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -81,8 +78,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -96,7 +91,7 @@ error TS2468: Cannot find global value 'Promise'. export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (3 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -107,9 +102,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface @@ -129,8 +122,6 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ @@ -196,7 +187,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -==== /other3.ts (17 errors) ==== +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface @@ -214,10 +205,11 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. +!!! error TS2322: Types of property 'with' are incompatible. +!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. +!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. @@ -241,7 +233,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. ~ !!! error TS1005: ',' expected. -==== /other4.ts (19 errors) ==== +==== /other4.ts (18 errors) ==== // Indirected assertion objecty-thing - not allowed type Asserts1 = { assert: {"resolution-mode": "require"} }; type Asserts2 = { assert: {"resolution-mode": "import"} }; @@ -264,8 +256,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. !!! related TS2728 /other4.ts:9:58: 'RequireInterface' is declared here. & import("pkg", Asserts2).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~ !!! error TS2448: Block-scoped variable 'Asserts2' used before its declaration. !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff deleted file mode 100644 index 7cdb0b84c9f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other.ts(3,22): error TS1005: 'with' expected. - /other.ts(3,39): error TS1005: ';' expected. -@@= skipped -6, +9 lines =@@ - /other.ts(3,51): error TS1128: Declaration or statement expected. - /other.ts(3,52): error TS1128: Declaration or statement expected. - /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -+/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -32, +33 lines =@@ - /other3.ts(3,55): error TS1005: ';' expected. - /other3.ts(3,56): error TS1128: Declaration or statement expected. - /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. --/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. -- Types of property 'with' are incompatible. -- Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. -- Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other3.ts(6,48): error TS1005: '{' expected. -@@= skipped -19, +17 lines =@@ - /other4.ts(6,29): error TS1128: Declaration or statement expected. - /other4.ts(6,30): error TS1128: Declaration or statement expected. - /other4.ts(6,31): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -+/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other4.ts(7,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. - /other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -20, +21 lines =@@ - /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -13, +15 lines =@@ - export interface ImportInterface {} - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} --==== /index.ts (2 errors) ==== -+==== /index.ts (3 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -11, +11 lines =@@ - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); --==== /other.ts (27 errors) ==== -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+==== /other.ts (28 errors) ==== - // missing assert: - export type LocalInterface = - & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -20, +22 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", {"resolution-mode": "import"}).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~ - !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ -@@= skipped -65, +67 lines =@@ - !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. - ~~~~~~~~~~~~~~~ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. --==== /other3.ts (16 errors) ==== -+==== /other3.ts (17 errors) ==== - // Array instead of object-y thing - export type LocalInterface = - & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface -@@= skipped -18, +18 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. --!!! error TS2322: Types of property 'with' are incompatible. --!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. --!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ - !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - -@@= skipped -28, +27 lines =@@ - !!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. - ~ - !!! error TS1005: ',' expected. --==== /other4.ts (18 errors) ==== -+==== /other4.ts (19 errors) ==== - // Indirected assertion objecty-thing - not allowed - type Asserts1 = { assert: {"resolution-mode": "require"} }; - type Asserts2 = { assert: {"resolution-mode": "import"} }; -@@= skipped -23, +23 lines =@@ - !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. - !!! related TS2728 /other4.ts:9:58: 'RequireInterface' is declared here. - & import("pkg", Asserts2).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~ - !!! error TS2448: Block-scoped variable 'Asserts2' used before its declaration. - !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js index 6b491cb1bd6..061f57d2e62 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js @@ -122,7 +122,7 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff index c7446b4bbad..82d0678794e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff @@ -1,11 +1,7 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js -@@= skipped -121, +121 lines =@@ - //// [index.d.ts] - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const b: any; +@@= skipped -124, +124 lines =@@ + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); -export declare const a: import("pkg", { with: {} }); @@ -15,7 +11,7 @@ //// [other2.d.ts] export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -@@= skipped -17, +17 lines =@@ +@@= skipped -14, +14 lines =@@ export declare const b: any; //// [other4.d.ts] export type LocalInterface = import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt index 0ab4871a8a4..d828b1b8da6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. /main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'. @@ -9,7 +8,6 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/not.json/package.json (0 errors) ==== { "name": "not.json", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt.diff deleted file mode 100644 index 1841f1f7bf7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesJson(module=node20).errors.txt -+++ new.nodeModulesJson(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. - /main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'. -@@= skipped -7, +8 lines =@@ - /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /node_modules/not.json/package.json (0 errors) ==== - { - "name": "not.json", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt index c3a3b37e59d..4c1ba7fccee 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index 416acbdd607..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).errors.txt -+++ new.nodeModulesPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js index 53f53dc3c1a..1b38f77f6df 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff deleted file mode 100644 index 8d29012f514..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).js -+++ new.nodeModulesPackageExports(module=node16).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols index 378496d0a4b..991d0d05c6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff deleted file mode 100644 index 4801bd4be07..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).symbols -+++ new.nodeModulesPackageExports(module=node16).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types index 67faa06aa67..4dca52efaf9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff deleted file mode 100644 index edf00e2a308..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).types -+++ new.nodeModulesPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt index c3a3b37e59d..4c1ba7fccee 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index b95e8cb4213..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).errors.txt -+++ new.nodeModulesPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js index 53f53dc3c1a..1b38f77f6df 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff deleted file mode 100644 index 20989c5ae2e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).js -+++ new.nodeModulesPackageExports(module=node18).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols index 378496d0a4b..991d0d05c6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff deleted file mode 100644 index 4cd29da0407..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).symbols -+++ new.nodeModulesPackageExports(module=node18).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types index 67faa06aa67..4dca52efaf9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff deleted file mode 100644 index 7d89191a717..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).types -+++ new.nodeModulesPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt deleted file mode 100644 index cd2e8c262c0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,120 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index b5302f6b7e6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).errors.txt -+++ new.nodeModulesPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +72 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js index 0c6d3339216..1b38f77f6df 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,61 +95,91 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); + +//// [index.mjs] // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +// cjs format file +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); cjsi; mjsi; typei; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff deleted file mode 100644 index 17c70b0fff7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).js -+++ new.nodeModulesPackageExports(module=node20).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); --cjs; --mjs; --type; --const cjsi = __importStar(require("inner/cjs")); --const mjsi = __importStar(require("inner/mjs")); --const typei = __importStar(require("inner")); --cjsi; --mjsi; --typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols index 378496d0a4b..991d0d05c6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff deleted file mode 100644 index 4e9e7bab24c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).symbols -+++ new.nodeModulesPackageExports(module=node20).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types index 67faa06aa67..4dca52efaf9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff deleted file mode 100644 index db1a4599452..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).types -+++ new.nodeModulesPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 965adec9a2c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,118 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 959f1e72018..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +70 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js index 53f53dc3c1a..1b38f77f6df 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff deleted file mode 100644 index e6df4ccb71f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).js -+++ new.nodeModulesPackageExports(module=nodenext).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols index 378496d0a4b..991d0d05c6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 3f3cb3b59e4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).symbols -+++ new.nodeModulesPackageExports(module=nodenext).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types index 67faa06aa67..4dca52efaf9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff deleted file mode 100644 index 9730a78e768..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).types -+++ new.nodeModulesPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt deleted file mode 100644 index c3e59bf4251..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; - import * as type from "#type"; - cjs; - mjs; - type; -==== index.mts (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; - import * as type from "#type"; - cjs; - mjs; - type; -==== index.cts (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; - import * as type from "#type"; - cjs; - mjs; - type; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.js", - "imports": { - "#cjs": "./index.cjs", - "#mjs": "./index.mjs", - "#type": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt.diff deleted file mode 100644 index 553179169b9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.nodeModulesPackageImports(module=node20).errors.txt -+++ new.nodeModulesPackageImports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== index.cts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js", -+ "imports": { -+ "#cjs": "./index.cjs", -+ "#mjs": "./index.mjs", -+ "#type": "./index.js" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js index 0144a3d9cd1..c25d1005e93 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js @@ -38,32 +38,61 @@ type; } //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +const cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); cjs; mjs; type; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js.diff deleted file mode 100644 index ab50dbec171..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesPackageImports(module=node20).js -+++ new.nodeModulesPackageImports(module=node20).js -@@= skipped -37, +37 lines =@@ - } - - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "#cjs"; --import * as mjs from "#mjs"; --import * as type from "#type"; -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); - cjs; - mjs; - type; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const cjs = __importStar(require("#cjs")); --const mjs = __importStar(require("#mjs")); --const type = __importStar(require("#type")); -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); - cjs; - mjs; - type; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "#cjs"; --import * as mjs from "#mjs"; --import * as type from "#type"; -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); - cjs; - mjs; - type; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json index 2cf0830bae8..55a35f71bd9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json @@ -1,70 +1,70 @@ ======== Resolving module '#cjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. Found 'package.json' at '/.src/package.json'. Using 'imports' subpath '#cjs' with target './index.cjs'. File name '/.src/index.cjs' has a '.cjs' extension - stripping it. File '/.src/index.cts' exists - use it as a name resolution result. ======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ======== ======== Resolving module '#mjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#mjs' with target './index.mjs'. File name '/.src/index.mjs' has a '.mjs' extension - stripping it. File '/.src/index.mts' exists - use it as a name resolution result. ======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ======== ======== Resolving module '#type' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#type' with target './index.js'. File name '/.src/index.js' has a '.js' extension - stripping it. File '/.src/index.ts' exists - use it as a name resolution result. ======== Module name '#type' was successfully resolved to '/.src/index.ts'. ======== ======== Resolving module '#cjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#cjs' with target './index.cjs'. File name '/.src/index.cjs' has a '.cjs' extension - stripping it. File '/.src/index.cts' exists - use it as a name resolution result. ======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ======== ======== Resolving module '#mjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#mjs' with target './index.mjs'. File name '/.src/index.mjs' has a '.mjs' extension - stripping it. File '/.src/index.mts' exists - use it as a name resolution result. ======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ======== ======== Resolving module '#type' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#type' with target './index.js'. File name '/.src/index.js' has a '.js' extension - stripping it. File '/.src/index.ts' exists - use it as a name resolution result. ======== Module name '#type' was successfully resolved to '/.src/index.ts'. ======== ======== Resolving module '#cjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#cjs' with target './index.cjs'. File name '/.src/index.cjs' has a '.cjs' extension - stripping it. File '/.src/index.cts' exists - use it as a name resolution result. ======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ======== ======== Resolving module '#mjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#mjs' with target './index.mjs'. File name '/.src/index.mjs' has a '.mjs' extension - stripping it. File '/.src/index.mts' exists - use it as a name resolution result. ======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ======== ======== Resolving module '#type' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#type' with target './index.js'. File name '/.src/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt index 8805dce4dcf..edded798749 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff deleted file mode 100644 index 33b0fbc52c6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js index 16d7442eb7f..fd642683ab4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols index 495d39b65aa..80efcda8a2d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff deleted file mode 100644 index e61594f40dc..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).symbols -+++ new.nodeModulesPackagePatternExports(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types index 953c741c907..1162099dc3e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff deleted file mode 100644 index a1c7499804f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).types -+++ new.nodeModulesPackagePatternExports(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt index 8805dce4dcf..edded798749 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff deleted file mode 100644 index dc743a6e3ba..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js index 16d7442eb7f..fd642683ab4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols index 495d39b65aa..80efcda8a2d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff deleted file mode 100644 index b1fdabb2e77..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).symbols -+++ new.nodeModulesPackagePatternExports(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types index 953c741c907..1162099dc3e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff deleted file mode 100644 index ce6a5bb0e8f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).types -+++ new.nodeModulesPackagePatternExports(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt deleted file mode 100644 index ed4a9867202..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.mts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.cts (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*": "./*.cjs", - "./mjs/*": "./*.mjs", - "./js/*": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff deleted file mode 100644 index f0b2c2a1ba0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js index 7de6c11c18f..fd642683ab4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +const cjsi = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(require("inner/js/index")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff deleted file mode 100644 index 25cfbdbef84..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).js -+++ new.nodeModulesPackagePatternExports(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index")); --const mjsi = __importStar(require("inner/mjs/index")); --const typei = __importStar(require("inner/js/index")); -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols index 495d39b65aa..80efcda8a2d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff deleted file mode 100644 index 60825146749..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).symbols -+++ new.nodeModulesPackagePatternExports(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types index 953c741c907..1162099dc3e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff deleted file mode 100644 index 185e002670d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).types -+++ new.nodeModulesPackagePatternExports(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 4dee5d096a4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js index 16d7442eb7f..fd642683ab4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols index 495d39b65aa..80efcda8a2d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff deleted file mode 100644 index 976d0a42fb7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExports(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types index 953c741c907..1162099dc3e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff deleted file mode 100644 index b2f81d75d6f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).types -+++ new.nodeModulesPackagePatternExports(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt index 491a598cda0..ca1c1e73523 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt @@ -8,17 +8,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -83,7 +83,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,7 +100,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +117,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +134,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -136,6 +148,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -143,7 +158,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -171,4 +189,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff deleted file mode 100644 index 59c7ffbc5cd..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).errors.txt -@@= skipped -17, +17 lines =@@ - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -108, +107 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js index 5fe735dbc37..86bc3022ded 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols index 9bcd25bcd79..8f1e180a5ef 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff deleted file mode 100644 index 4e7b9ae82f9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types index 8bdf18e1e45..893175b77cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff deleted file mode 100644 index ae03ffea997..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt index 491a598cda0..ca1c1e73523 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -8,17 +8,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -83,7 +83,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,7 +100,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +117,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +134,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -136,6 +148,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -143,7 +158,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -171,4 +189,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff deleted file mode 100644 index a13dc3c4920..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -@@= skipped -17, +17 lines =@@ - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -108, +107 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js index 5fe735dbc37..86bc3022ded 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols index 9bcd25bcd79..8f1e180a5ef 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff deleted file mode 100644 index 866ec52ea44..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types index 8bdf18e1e45..893175b77cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff deleted file mode 100644 index 920348eae49..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt index 294d0095827..2a889543f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. @@ -8,18 +7,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; @@ -80,7 +78,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -94,7 +95,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -108,7 +112,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -123,6 +130,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -131,6 +141,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -139,6 +152,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -164,4 +180,5 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff deleted file mode 100644 index 77a825c121d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -15, +16 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (3 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/exclude/index"; -@@= skipped -105, +105 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js index 47d4d67006a..86bc3022ded 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,53 +126,83 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; cjsi2; mjsi2; typei2; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; cjsi2; mjsi2; typei2; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +const cjsi = __importStar(require("inner/cjs/exclude/index")); +const mjsi = __importStar(require("inner/mjs/exclude/index")); +const typei = __importStar(require("inner/js/exclude/index")); cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +const cjsi2 = __importStar(require("inner/cjs/index")); +const mjsi2 = __importStar(require("inner/mjs/index")); +const typei2 = __importStar(require("inner/js/index")); cjsi2; mjsi2; typei2; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff deleted file mode 100644 index 24dcd30773d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff +++ /dev/null @@ -1,104 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).js -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).js -@@= skipped -110, +110 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; --import * as cjsi2 from "inner/cjs/index"; --import * as mjsi2 from "inner/mjs/index"; --import * as typei2 from "inner/js/index"; -+const cjsi2 = require("inner/cjs/index"); -+const mjsi2 = require("inner/mjs/index"); -+const typei2 = require("inner/js/index"); - cjsi2; - mjsi2; - typei2; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; --import * as cjsi2 from "inner/cjs/index"; --import * as mjsi2 from "inner/mjs/index"; --import * as typei2 from "inner/js/index"; -+const cjsi2 = require("inner/cjs/index"); -+const mjsi2 = require("inner/mjs/index"); -+const typei2 = require("inner/js/index"); - cjsi2; - mjsi2; - typei2; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/exclude/index")); --const mjsi = __importStar(require("inner/mjs/exclude/index")); --const typei = __importStar(require("inner/js/exclude/index")); -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; --const cjsi2 = __importStar(require("inner/cjs/index")); --const mjsi2 = __importStar(require("inner/mjs/index")); --const typei2 = __importStar(require("inner/js/index")); -+const cjsi2 = require("inner/cjs/index"); -+const mjsi2 = require("inner/mjs/index"); -+const typei2 = require("inner/js/index"); - cjsi2; - mjsi2; - typei2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols index 9bcd25bcd79..8f1e180a5ef 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff deleted file mode 100644 index d499d5611fb..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types index 8bdf18e1e45..893175b77cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff deleted file mode 100644 index 354ba167c70..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt index 7b905f13c13..2a889543f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt @@ -7,15 +7,15 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. ==== index.ts (3 errors) ==== @@ -78,7 +78,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -92,7 +95,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -106,7 +112,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -121,6 +130,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -129,6 +141,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -137,6 +152,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -162,4 +180,5 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff deleted file mode 100644 index 222b759f1a3..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -@@= skipped -15, +15 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - - - ==== index.ts (3 errors) ==== -@@= skipped -105, +104 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js index 5fe735dbc37..86bc3022ded 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols index 9bcd25bcd79..8f1e180a5ef 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff deleted file mode 100644 index 4d2881e721f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types index 8bdf18e1e45..893175b77cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff deleted file mode 100644 index 6a0208d1eda..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).types -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt index 2210b62d742..df6aa2d2e6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff deleted file mode 100644 index c8e9804b85e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js index 7e40184e6af..52eefeb4606 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols index 8b4f028de21..c8615a5f47c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff deleted file mode 100644 index 6efcd2e82cc..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json index df9bceab107..586e2b5caf2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types index 7d054eb1286..7f7b1d09ed3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff deleted file mode 100644 index 0eb34521ce4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt index 2210b62d742..df6aa2d2e6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff deleted file mode 100644 index 9477452c754..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js index 7e40184e6af..52eefeb4606 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols index 8b4f028de21..c8615a5f47c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff deleted file mode 100644 index dbec2322af3..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json index df9bceab107..586e2b5caf2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types index 7d054eb1286..7f7b1d09ed3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff deleted file mode 100644 index db52145154d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt deleted file mode 100644 index 719d75264b1..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.mts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.cts (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*.cjs": "./*.cjs", - "./mjs/*.mjs": "./*.mjs", - "./js/*.js": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff deleted file mode 100644 index 86de4c001a1..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js index 2cfbc7f1fad..52eefeb4606 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +const cjsi = __importStar(require("inner/cjs/index.cjs")); +const mjsi = __importStar(require("inner/mjs/index.mjs")); +const typei = __importStar(require("inner/js/index.js")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff deleted file mode 100644 index b0579fb6ca7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).js -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index.cjs")); --const mjsi = __importStar(require("inner/mjs/index.mjs")); --const typei = __importStar(require("inner/js/index.js")); -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols index 8b4f028de21..c8615a5f47c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff deleted file mode 100644 index bc462f6f50e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json index 06b7bca3a76..ab77c5a4009 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json @@ -1,6 +1,6 @@ ======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. Found 'package.json' at '/.src/package.json'. Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -12,8 +12,8 @@ File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== ======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -25,8 +25,8 @@ File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== ======== Resolving module 'inner/js/index.js' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,9 +118,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -110,9 +128,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -120,9 +138,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types index 7d054eb1286..7f7b1d09ed3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff deleted file mode 100644 index 60501fc3e5d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff deleted file mode 100644 index 140525150f8..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js index 7e40184e6af..52eefeb4606 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols index 8b4f028de21..c8615a5f47c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff deleted file mode 100644 index f5dd3186c01..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json index f537658d65e..937c9e47845 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types index 7d054eb1286..7f7b1d09ed3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff deleted file mode 100644 index edc61e89d4f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt index 57fa0360c31..5a28c77e93b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt @@ -1,4 +1,3 @@ -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. @@ -15,14 +14,12 @@ index.ts(3,38): error TS2823: Import attributes are only supported when the '--m !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; -==== index.cts (1 errors) ==== +==== index.cts (0 errors) ==== import pkg from "./package.json"; export const name = pkg.name; import * as ns from "./package.json"; export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== index.mts (2 errors) ==== import pkg from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff deleted file mode 100644 index de3ff5ceb26..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).errors.txt -+++ new.nodeModulesResolveJsonModule(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -@@= skipped -13, +14 lines =@@ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export const thing = ns; - export const name2 = ns.default.name; --==== index.cts (0 errors) ==== -+==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. - ==== index.mts (2 errors) ==== - import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js index f310acacc73..5194c1c452f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js @@ -109,9 +109,14 @@ export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff deleted file mode 100644 index e549926d352..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).js -+++ new.nodeModulesResolveJsonModule(module=node16).js -@@= skipped -108, +108 lines =@@ - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols index 569f4b48c09..e38476567ac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols @@ -44,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff deleted file mode 100644 index 75e1f384396..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).symbols -+++ new.nodeModulesResolveJsonModule(module=node16).symbols -@@= skipped -43, +43 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types index 8fd2b5dc735..10ecedb4346 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff deleted file mode 100644 index cf78840e099..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).types -+++ new.nodeModulesResolveJsonModule(module=node16).types -@@= skipped -37, +37 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt deleted file mode 100644 index 10ebcd65624..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -==== index.ts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff deleted file mode 100644 index 0363f40d0ff..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node18).errors.txt -+++ new.nodeModulesResolveJsonModule(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+==== index.ts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== index.cts (1 errors) ==== -+ import pkg from "./package.json"; -+ export const name = pkg.name; -+ import * as ns from "./package.json"; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "type": "module", -+ "default": "misedirection" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js index f310acacc73..5194c1c452f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js @@ -109,9 +109,14 @@ export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff deleted file mode 100644 index dd5c415c8ec..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node18).js -+++ new.nodeModulesResolveJsonModule(module=node18).js -@@= skipped -108, +108 lines =@@ - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols index 569f4b48c09..e38476567ac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols @@ -44,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff deleted file mode 100644 index 9001e12b6d9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node18).symbols -+++ new.nodeModulesResolveJsonModule(module=node18).symbols -@@= skipped -43, +43 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types index 8fd2b5dc735..10ecedb4346 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff index 9c95540b001..95ebbedeff0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff @@ -18,33 +18,7 @@ export const thing = ns; >thing : { default: { name: string; version: string; type: string; default: string; }; } -@@= skipped -25, +25 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - +@@= skipped -42, +42 lines =@@ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } @@ -53,7 +27,7 @@ export const name = pkg.name; >name : string -@@= skipped -27, +27 lines =@@ +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt deleted file mode 100644 index 5de66406d80..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt +++ /dev/null @@ -1,41 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -index.ts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.ts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (3 errors) ==== - import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt.diff deleted file mode 100644 index 0093846b570..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node20).errors.txt -+++ new.nodeModulesResolveJsonModule(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+index.ts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.ts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (3 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.cts (1 errors) ==== -+ import pkg from "./package.json"; -+ export const name = pkg.name; -+ import * as ns from "./package.json"; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "type": "module", -+ "default": "misedirection" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js index e0c8814c68e..5194c1c452f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js @@ -34,52 +34,89 @@ export const name2 = ns.default.name; "default": "misedirection" } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); -exports.name = package_json_1.default.name; -const ns = require("./package.json"); -exports.thing = ns; -exports.name2 = ns.default.name; +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); +const package_json_1 = __importDefault(require("./package.json")); exports.name = package_json_1.default.name; -const ns = require("./package.json"); +const ns = __importStar(require("./package.json")); exports.thing = ns; exports.name2 = ns.default.name; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); -exports.name = package_json_1.default.name; -const ns = require("./package.json"); -exports.thing = ns; -exports.name2 = ns.default.name; +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; //// [index.d.ts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.cts] export declare const name: string; export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js.diff deleted file mode 100644 index 3f6b2664502..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node20).js -+++ new.nodeModulesResolveJsonModule(module=node20).js -@@= skipped -33, +33 lines =@@ - "default": "misedirection" - } - //// [index.js] --import pkg from "./package.json" with { type: "json" }; --export const name = pkg.name; --import * as ns from "./package.json" with { type: "json" }; --export const thing = ns; --export const name2 = ns.default.name; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.name2 = exports.thing = exports.name = void 0; -+const package_json_1 = require("./package.json"); -+exports.name = package_json_1.default.name; -+const ns = require("./package.json"); -+exports.thing = ns; -+exports.name2 = ns.default.name; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); --var __importDefault = (this && this.__importDefault) || function (mod) { -- return (mod && mod.__esModule) ? mod : { "default": mod }; --}; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.name2 = exports.thing = exports.name = void 0; --const package_json_1 = __importDefault(require("./package.json")); -+const package_json_1 = require("./package.json"); - exports.name = package_json_1.default.name; --const ns = __importStar(require("./package.json")); -+const ns = require("./package.json"); - exports.thing = ns; - exports.name2 = ns.default.name; - //// [index.mjs] --import pkg from "./package.json" with { type: "json" }; --export const name = pkg.name; --import * as ns from "./package.json" with { type: "json" }; --export const thing = ns; --export const name2 = ns.default.name; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.name2 = exports.thing = exports.name = void 0; -+const package_json_1 = require("./package.json"); -+exports.name = package_json_1.default.name; -+const ns = require("./package.json"); -+exports.thing = ns; -+exports.name2 = ns.default.name; - - - //// [index.d.ts] - export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.cts] - export declare const name: string; - export declare const thing: { - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols index bef5d926299..e38476567ac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols @@ -19,9 +19,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === import pkg from "./package.json"; @@ -42,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols.diff deleted file mode 100644 index b9063592ce2..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node20).symbols -+++ new.nodeModulesResolveJsonModule(module=node20).symbols -@@= skipped -18, +18 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.ts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.ts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.cts === - import pkg from "./package.json"; -@@= skipped -25, +23 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types index acee90d5410..10ecedb4346 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types @@ -12,20 +12,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.cts === import pkg from "./package.json"; @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff index e68ca2723b8..8ddea0652d2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff @@ -9,64 +9,16 @@ export const name = pkg.name; >name : string -@@= skipped -9, +9 lines =@@ - >name : string +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } + >ns : { default: { name: string; version: string; type: string; default: string; }; } ->type : error -+>ns : { name: string; version: string; type: string; default: string; } +>type : any export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === index.cts === - import pkg from "./package.json"; -@@= skipped -26, +26 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - + >thing : { default: { name: string; version: string; type: string; default: string; }; } +@@= skipped -42, +42 lines =@@ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } @@ -75,7 +27,7 @@ export const name = pkg.name; >name : string -@@= skipped -27, +27 lines =@@ +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt deleted file mode 100644 index 10ebcd65624..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -==== index.ts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff deleted file mode 100644 index 3aaa56d5875..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=nodenext).errors.txt -+++ new.nodeModulesResolveJsonModule(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+==== index.ts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== index.cts (1 errors) ==== -+ import pkg from "./package.json"; -+ export const name = pkg.name; -+ import * as ns from "./package.json"; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "type": "module", -+ "default": "misedirection" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js index f310acacc73..5194c1c452f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js @@ -109,9 +109,14 @@ export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff deleted file mode 100644 index a2eb6240f1e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=nodenext).js -+++ new.nodeModulesResolveJsonModule(module=nodenext).js -@@= skipped -108, +108 lines =@@ - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols index 569f4b48c09..e38476567ac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols @@ -44,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff deleted file mode 100644 index 2d36d37729f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=nodenext).symbols -+++ new.nodeModulesResolveJsonModule(module=nodenext).symbols -@@= skipped -43, +43 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types index 8fd2b5dc735..10ecedb4346 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff index 2dbb41b9796..9d3a87b686c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff @@ -18,33 +18,7 @@ export const thing = ns; >thing : { default: { name: string; version: string; type: string; default: string; }; } -@@= skipped -25, +25 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - +@@= skipped -42, +42 lines =@@ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } @@ -53,7 +27,7 @@ export const name = pkg.name; >name : string -@@= skipped -27, +27 lines =@@ +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt deleted file mode 100644 index e8320ee816b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt +++ /dev/null @@ -1,56 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.ts (3 errors) ==== - // cjs format file - import {h} from "../index.js"; - import mod = require("../index.js"); - import {f as _f} from "./index.js"; - import mod2 = require("./index.js"); - export async function f() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - h(); - } -==== index.ts (3 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); - import {f} from "./subfolder/index.js"; - import mod2 = require("./subfolder/index.js"); - export async function h() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - f(); - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt.diff deleted file mode 100644 index 0760cb7d8ef..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node20).errors.txt -+++ new.nodeModulesSynchronousCallErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.ts (3 errors) ==== -+ // cjs format file -+ import {h} from "../index.js"; -+ import mod = require("../index.js"); -+ import {f as _f} from "./index.js"; -+ import mod2 = require("./index.js"); -+ export async function f() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod3 = await import ("../index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod4 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ h(); -+ } -+==== index.ts (3 errors) ==== -+ // esm format file -+ import {h as _h} from "./index.js"; -+ import mod = require("./index.js"); -+ import {f} from "./subfolder/index.js"; -+ import mod2 = require("./subfolder/index.js"); -+ export async function h() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod3 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod4 = await import ("./subfolder/index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ f(); -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js index 0b0f71fc7f5..f317196b7b3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js @@ -34,14 +34,11 @@ export async function h() { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.h = h; -const index_js_1 = require("./subfolder/index.js"); -async function h() { +import { f } from "./subfolder/index.js"; +export async function h() { const mod3 = await import("./index.js"); const mod4 = await import("./subfolder/index.js"); - (0, index_js_1.f)(); + f(); } //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js.diff deleted file mode 100644 index d57e90cc695..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node20).js -+++ new.nodeModulesSynchronousCallErrors(module=node20).js -@@= skipped -33, +33 lines =@@ - } - - //// [index.js] --import { f } from "./subfolder/index.js"; --export async function h() { -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.h = h; -+const index_js_1 = require("./subfolder/index.js"); -+async function h() { - const mod3 = await import("./index.js"); - const mod4 = await import("./subfolder/index.js"); -- f(); -+ (0, index_js_1.f)(); - } - //// [index.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types index 80bd761f00a..f4631698cca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types @@ -19,9 +19,9 @@ export async function f() { >f : () => Promise const mod3 = await import ("../index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("../index.js") : { h(): Promise; default: typeof mod; } ->import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("../index.js") : typeof mod +>import ("../index.js") : Promise >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); @@ -53,9 +53,9 @@ export async function h() { >h : () => Promise const mod3 = await import ("./index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("./index.js") : { h(): Promise; default: typeof mod; } ->import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("./index.js") : typeof mod +>import ("./index.js") : Promise >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types.diff deleted file mode 100644 index 5620ac43153..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node20).types -+++ new.nodeModulesSynchronousCallErrors(module=node20).types -@@= skipped -18, +18 lines =@@ - >f : () => Promise - - const mod3 = await import ("../index.js"); -->mod3 : typeof mod -->await import ("../index.js") : typeof mod -->import ("../index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("../index.js") : { h(): Promise; default: typeof mod; } -+>import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -@@= skipped -34, +34 lines =@@ - >h : () => Promise - - const mod3 = await import ("./index.js"); -->mod3 : typeof mod -->await import ("./index.js") : typeof mod -->import ("./index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("./index.js") : { h(): Promise; default: typeof mod; } -+>import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt index 656d8963cae..0fd2e5390cd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt @@ -1,29 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (2 errors) ==== // cjs format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -==== index.ts (2 errors) ==== +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.ts (0 errors) ==== // esm format file const x = await 1; - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} - ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt.diff deleted file mode 100644 index 5365a9abbb3..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.nodeModulesTopLevelAwait(module=node20).errors.txt -+++ new.nodeModulesTopLevelAwait(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.ts (2 errors) ==== - // cjs format file - const x = await 1; - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --==== index.ts (0 errors) ==== -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+==== index.ts (2 errors) ==== - // esm format file - const x = await 1; -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} -+ ~~~~~ -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js index c39cdd61dff..8d33777f0c4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js @@ -30,12 +30,9 @@ const x = await 1; exports.x = x; for await (const y of []) { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = await 1; -exports.x = x; +export { x }; for await (const y of []) { } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js.diff deleted file mode 100644 index 8eb24ad109f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesTopLevelAwait(module=node20).js -+++ new.nodeModulesTopLevelAwait(module=node20).js -@@= skipped -29, +29 lines =@@ - exports.x = x; - for await (const y of []) { } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = await 1; --export { x }; -+exports.x = x; - for await (const y of []) { } - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt deleted file mode 100644 index 1ce07783b4c..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends RequireInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt.diff deleted file mode 100644 index 6e8adca070e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ export interface LocalInterface extends RequireInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt deleted file mode 100644 index 0f998dfd3f3..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - /// - export interface LocalInterface extends ImportInterface {} - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ImportInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt.diff deleted file mode 100644 index 6ed6c524a28..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ /// -+ export interface LocalInterface extends ImportInterface {} -+ ~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'ImportInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js index ae8fe6ec2ab..86c97ee2d0b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js @@ -29,9 +29,8 @@ declare global { export interface LocalInterface extends ImportInterface {} //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js.diff deleted file mode 100644 index 13ae5bbeca5..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js -@@= skipped -28, +28 lines =@@ - export interface LocalInterface extends ImportInterface {} - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// --export {}; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols index f410e5fca74..dfccc413094 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols @@ -4,12 +4,13 @@ /// export interface LocalInterface extends ImportInterface {} >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { ->global : Symbol(global, Decl(require.d.ts, 0, 10)) +>global : Symbol(global, Decl(import.d.ts, 0, 10)) - interface RequireInterface {} ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) + interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols.diff deleted file mode 100644 index e93c8b3a846..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols -@@= skipped -3, +3 lines =@@ - /// - export interface LocalInterface extends ImportInterface {} - >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) - --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -+>global : Symbol(global, Decl(require.d.ts, 0, 10)) - -- interface ImportInterface {} -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -+ interface RequireInterface {} -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types index 161a51956e7..f2f8e654659 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types @@ -4,10 +4,10 @@ /// export interface LocalInterface extends ImportInterface {} -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { >global : any - interface RequireInterface {} + interface ImportInterface {} } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types.diff deleted file mode 100644 index 716f5d421c9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types -@@= skipped -3, +3 lines =@@ - - /// - export interface LocalInterface extends ImportInterface {} --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { - >global : any - -- interface ImportInterface {} -+ interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt deleted file mode 100644 index 040d70fd36b..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends RequireInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt.diff deleted file mode 100644 index 28f19cdb479..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ export interface LocalInterface extends RequireInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js index 48b106a94af..a8890a9178c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js @@ -29,9 +29,8 @@ declare global { export interface LocalInterface extends RequireInterface {} //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js.diff deleted file mode 100644 index 06771ef4ed5..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js -@@= skipped -28, +28 lines =@@ - export interface LocalInterface extends RequireInterface {} - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// --export {}; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt deleted file mode 100644 index bcea9d5c5d9..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends ImportInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt.diff deleted file mode 100644 index 7f771eaac23..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ export interface LocalInterface extends ImportInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt deleted file mode 100644 index 4c502aa92df..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - /// - export interface LocalInterface extends ImportInterface, RequireInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt.diff deleted file mode 100644 index 033f95dcaa0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ /// -+ export interface LocalInterface extends ImportInterface, RequireInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt deleted file mode 100644 index 588b23d7fcb..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - import obj from "./uses.js" - export default (obj as typeof obj); -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - function getInterR(): RequireInterface; - } -==== /uses.ts (0 errors) ==== - /// - export default getInterR(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt.diff deleted file mode 100644 index 7d3995402bf..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ import obj from "./uses.js" -+ export default (obj as typeof obj); -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ function getInterR(): RequireInterface; -+ } -+==== /uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js index ca5d9f4a4cc..b91a324b323 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js @@ -35,8 +35,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getInterR(); //// [index.js] "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const uses_js_1 = require("./uses.js"); +const uses_js_1 = __importDefault(require("./uses.js")); exports.default = uses_js_1.default; @@ -47,3 +50,43 @@ export default _default; //// [index.d.ts] declare const _default: RequireInterface; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,25): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (1 errors) ==== + declare const _default: RequireInterface; + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface {} + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface {} + function getInterR(): RequireInterface; + } +==== out/uses.d.ts (0 errors) ==== + /// + declare const _default: RequireInterface; + export default _default; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff index 98990ba603d..102a66bb27f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff @@ -1,23 +1,50 @@ --- old.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js +++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js -@@= skipped -34, +34 lines =@@ - exports.default = getInterR(); - //// [index.js] - "use strict"; --var __importDefault = (this && this.__importDefault) || function (mod) { -- return (mod && mod.__esModule) ? mod : { "default": mod }; --}; - Object.defineProperty(exports, "__esModule", { value: true }); --const uses_js_1 = __importDefault(require("./uses.js")); -+const uses_js_1 = require("./uses.js"); - exports.default = uses_js_1.default; - - -@@= skipped -13, +10 lines =@@ +@@= skipped -47, +47 lines =@@ declare const _default: RequireInterface; export default _default; //// [index.d.ts] -import obj from "./uses.js"; -declare const _default: typeof obj; +declare const _default: RequireInterface; - export default _default; \ No newline at end of file + export default _default; ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/index.d.ts(1,25): error TS2304: Cannot find name 'RequireInterface'. ++ ++ ++==== out/index.d.ts (1 errors) ==== ++ declare const _default: RequireInterface; ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'RequireInterface'. ++ export default _default; ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export {}; ++ declare global { ++ interface ImportInterface {} ++ function getInterI(): ImportInterface; ++ } ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export {}; ++ declare global { ++ interface RequireInterface {} ++ function getInterR(): RequireInterface; ++ } ++==== out/uses.d.ts (0 errors) ==== ++ /// ++ declare const _default: RequireInterface; ++ export default _default; ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt deleted file mode 100644 index 66d0faad359..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt +++ /dev/null @@ -1,58 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -/sub1/uses.ts(2,16): error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" - import obj2 from "./sub2/uses.js" - export default [obj1, obj2.default] as const; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface { _i: any; } - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface { _r: any; } - function getInterR(): RequireInterface; - } -==== /sub1/uses.ts (1 errors) ==== - /// - export default getInterI(); - ~~~~~~~~~ -!!! error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -!!! related TS2728 /node_modules/pkg/require.d.ts:4:14: 'getInterR' is declared here. -==== /sub1/package.json (0 errors) ==== - { - "private": true, - "type": "module" - } -==== /sub2/uses.ts (0 errors) ==== - /// - export default getInterR(); -==== /sub2/package.json (0 errors) ==== - { - "private": true, - "type": "commonjs" - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt.diff deleted file mode 100644 index 90986eae328..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+/sub1/uses.ts(2,16): error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ // only an esm file can `import` both kinds of files -+ import obj1 from "./sub1/uses.js" -+ import obj2 from "./sub2/uses.js" -+ export default [obj1, obj2.default] as const; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface { _i: any; } -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface { _r: any; } -+ function getInterR(): RequireInterface; -+ } -+==== /sub1/uses.ts (1 errors) ==== -+ /// -+ export default getInterI(); -+ ~~~~~~~~~ -+!!! error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -+!!! related TS2728 /node_modules/pkg/require.d.ts:4:14: 'getInterR' is declared here. -+==== /sub1/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } -+==== /sub2/uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); -+==== /sub2/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "commonjs" -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js index abe1baa3b17..e6134a89881 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js @@ -49,32 +49,91 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; //// [uses.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// -exports.default = getInterI(); +export default getInterI(); //// [uses.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /// exports.default = getInterR(); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // only an esm file can `import` both kinds of files -const uses_js_1 = require("./sub1/uses.js"); -const uses_js_2 = require("./sub2/uses.js"); -exports.default = [uses_js_1.default, uses_js_2.default.default]; +import obj1 from "./sub1/uses.js"; +import obj2 from "./sub2/uses.js"; +export default [obj1, obj2.default]; //// [uses.d.ts] /// -declare const _default: any; +declare const _default: ImportInterface; export default _default; //// [uses.d.ts] /// declare const _default: RequireInterface; export default _default; //// [index.d.ts] -declare const _default: readonly [any, any]; +declare const _default: readonly [ImportInterface, RequireInterface]; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. +out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (2 errors) ==== + declare const _default: readonly [ImportInterface, RequireInterface]; + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface { _i: any; } + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface { _r: any; } + function getInterR(): RequireInterface; + } +==== out/sub1/uses.d.ts (0 errors) ==== + /// + declare const _default: ImportInterface; + export default _default; + +==== /sub1/package.json (0 errors) ==== + { + "private": true, + "type": "module" + } +==== out/sub2/uses.d.ts (0 errors) ==== + /// + declare const _default: RequireInterface; + export default _default; + +==== /sub2/package.json (0 errors) ==== + { + "private": true, + "type": "commonjs" + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js.diff deleted file mode 100644 index 35a539835f0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js.diff +++ /dev/null @@ -1,104 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js -@@= skipped -48, +48 lines =@@ - export default [obj1, obj2.default] as const; - - //// [uses.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// --export default getInterI(); -+exports.default = getInterI(); - //// [uses.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// - exports.default = getInterR(); - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // only an esm file can `import` both kinds of files --import obj1 from "./sub1/uses.js"; --import obj2 from "./sub2/uses.js"; --export default [obj1, obj2.default]; -+const uses_js_1 = require("./sub1/uses.js"); -+const uses_js_2 = require("./sub2/uses.js"); -+exports.default = [uses_js_1.default, uses_js_2.default.default]; - - - //// [uses.d.ts] - /// --declare const _default: ImportInterface; -+declare const _default: any; - export default _default; - //// [uses.d.ts] - /// - declare const _default: RequireInterface; - export default _default; - //// [index.d.ts] --declare const _default: readonly [ImportInterface, RequireInterface]; -+declare const _default: readonly [any, any]; - export default _default; -- -- --//// [DtsFileErrors] -- -- --out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. --out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. -- -- --==== out/index.d.ts (2 errors) ==== -- declare const _default: readonly [ImportInterface, RequireInterface]; -- ~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'ImportInterface'. -- ~~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'RequireInterface'. -- export default _default; -- --==== /node_modules/pkg/package.json (0 errors) ==== -- { -- "name": "pkg", -- "version": "0.0.1", -- "exports": { -- "import": "./import.js", -- "require": "./require.js" -- } -- } --==== /node_modules/pkg/import.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface ImportInterface { _i: any; } -- function getInterI(): ImportInterface; -- } --==== /node_modules/pkg/require.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface RequireInterface { _r: any; } -- function getInterR(): RequireInterface; -- } --==== out/sub1/uses.d.ts (0 errors) ==== -- /// -- declare const _default: ImportInterface; -- export default _default; -- --==== /sub1/package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } --==== out/sub2/uses.d.ts (0 errors) ==== -- /// -- declare const _default: RequireInterface; -- export default _default; -- --==== /sub2/package.json (0 errors) ==== -- { -- "private": true, -- "type": "commonjs" -- } --==== /package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols index 1899b1069ed..26fb3036384 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols @@ -10,9 +10,24 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) +>obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) +>default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) >const : Symbol(const) +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + interface ImportInterface { _i: any; } +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +>_i : Symbol(ImportInterface._i, Decl(import.d.ts, 2, 31)) + + function getInterI(): ImportInterface; +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +} === /node_modules/pkg/require.d.ts === export {}; declare global { @@ -27,9 +42,10 @@ declare global { >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) } === /sub1/uses.ts === - /// export default getInterI(); +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) + === /sub2/uses.ts === /// export default getInterR(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols.diff deleted file mode 100644 index 2b3ecfe5a6f..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols -@@= skipped -9, +9 lines =@@ - - export default [obj1, obj2.default] as const; - >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) -->obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) - >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) -->default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) - >const : Symbol(const) - --=== /node_modules/pkg/import.d.ts === --export {}; --declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -- -- interface ImportInterface { _i: any; } -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -->_i : Symbol(ImportInterface._i, Decl(import.d.ts, 2, 31)) -- -- function getInterI(): ImportInterface; -->getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) --} - === /node_modules/pkg/require.d.ts === - export {}; - declare global { -@@= skipped -32, +17 lines =@@ - >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) - } - === /sub1/uses.ts === -+ - /// - export default getInterI(); -->getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) -- - === /sub2/uses.ts === - /// - export default getInterR(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types index fc698ca4edb..8fe9ea5bacb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types @@ -3,19 +3,30 @@ === /index.ts === // only an esm file can `import` both kinds of files import obj1 from "./sub1/uses.js" ->obj1 : any +>obj1 : ImportInterface import obj2 from "./sub2/uses.js" ->obj2 : RequireInterface +>obj2 : typeof obj2 export default [obj1, obj2.default] as const; ->[obj1, obj2.default] as const : readonly [any, any] ->[obj1, obj2.default] : readonly [any, any] ->obj1 : any ->obj2.default : any ->obj2 : RequireInterface ->default : any +>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] +>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] +>obj1 : ImportInterface +>obj2.default : RequireInterface +>obj2 : typeof obj2 +>default : RequireInterface + +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global + interface ImportInterface { _i: any; } +>_i : any + + function getInterI(): ImportInterface; +>getInterI : () => ImportInterface +} === /node_modules/pkg/require.d.ts === export {}; declare global { @@ -30,8 +41,8 @@ declare global { === /sub1/uses.ts === /// export default getInterI(); ->getInterI() : any ->getInterI : any +>getInterI() : ImportInterface +>getInterI : () => ImportInterface === /sub2/uses.ts === /// diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types.diff deleted file mode 100644 index 02ee90b8330..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types -@@= skipped -2, +2 lines =@@ - === /index.ts === - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" -->obj1 : ImportInterface -+>obj1 : any - - import obj2 from "./sub2/uses.js" -->obj2 : typeof obj2 -+>obj2 : RequireInterface - - export default [obj1, obj2.default] as const; -->[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] -->[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] -->obj1 : ImportInterface -->obj2.default : RequireInterface -->obj2 : typeof obj2 -->default : RequireInterface -- --=== /node_modules/pkg/import.d.ts === --export {}; --declare global { -->global : typeof global -- -- interface ImportInterface { _i: any; } -->_i : any -- -- function getInterI(): ImportInterface; -->getInterI : () => ImportInterface --} -+>[obj1, obj2.default] as const : readonly [any, any] -+>[obj1, obj2.default] : readonly [any, any] -+>obj1 : any -+>obj2.default : any -+>obj2 : RequireInterface -+>default : any -+ - === /node_modules/pkg/require.d.ts === - export {}; - declare global { -@@= skipped -38, +27 lines =@@ - === /sub1/uses.ts === - /// - export default getInterI(); -->getInterI() : ImportInterface -->getInterI : () => ImportInterface -+>getInterI() : any -+>getInterI : any - - === /sub2/uses.ts === - /// \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt index f24f5f5c437..c9a6ac79317 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt.diff deleted file mode 100644 index f0e06f71af0..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,1): error TS2304: Cannot find name 'foo'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt index 9cc5e69b096..13991aa1353 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt @@ -1,14 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(2,1): error TS2304: Cannot find name 'foo'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; // foo should resolve while bar should not, since index.js is esm - ~~~ -!!! error TS2304: Cannot find name 'foo'. bar; + ~~~ +!!! error TS2304: Cannot find name 'bar'. export {}; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt.diff deleted file mode 100644 index 0f5122051f4..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(3,1): error TS2304: Cannot find name 'bar'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(2,1): error TS2304: Cannot find name 'foo'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; // foo should resolve while bar should not, since index.js is esm -- bar; - ~~~ --!!! error TS2304: Cannot find name 'bar'. -+!!! error TS2304: Cannot find name 'foo'. -+ bar; - export {}; - ==== /node_modules/pkg/package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js index 70cf2e6b258..aee176689b2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js @@ -31,8 +31,7 @@ bar; export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// foo; // foo should resolve while bar should not, since index.js is esm bar; +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js.diff deleted file mode 100644 index 3c3eeee983a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).js -@@= skipped -30, +30 lines =@@ - export {}; - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// - foo; // foo should resolve while bar should not, since index.js is esm - bar; --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols index 834fc88eb44..0f65d258dc7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols @@ -3,15 +3,15 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm -bar; ->bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) +bar; export {}; -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { ->global : Symbol(global, Decl(require.d.ts, 0, 10)) +>global : Symbol(global, Decl(import.d.ts, 0, 10)) - var bar: number; ->bar : Symbol(bar, Decl(require.d.ts, 2, 7)) + var foo: number; +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols.diff deleted file mode 100644 index 0e1268161a7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols -@@= skipped -2, +2 lines =@@ - === /index.ts === - /// - foo; // foo should resolve while bar should not, since index.js is esm -->foo : Symbol(foo, Decl(import.d.ts, 2, 7)) -- - bar; -+>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) -+ - export {}; --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -+>global : Symbol(global, Decl(require.d.ts, 0, 10)) - -- var foo: number; -->foo : Symbol(foo, Decl(import.d.ts, 2, 7)) -+ var bar: number; -+>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types index 235394cd2ca..3b7a7ec78ee 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types @@ -3,17 +3,17 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm ->foo : any +>foo : number bar; ->bar : number +>bar : any export {}; -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { >global : typeof global - var bar: number; ->bar : number + var foo: number; +>foo : number } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types.diff deleted file mode 100644 index 353d9b309b3..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).types -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).types -@@= skipped -2, +2 lines =@@ - === /index.ts === - /// - foo; // foo should resolve while bar should not, since index.js is esm -->foo : number -+>foo : any - - bar; -->bar : any -+>bar : number - - export {}; --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { - >global : typeof global - -- var foo: number; -->foo : number -+ var bar: number; -+>bar : number - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt index 084fe9f4e0a..477d247984d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt.diff deleted file mode 100644 index 936d9207bdb..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,1): error TS2304: Cannot find name 'foo'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js index 7bde651a811..c6806f897de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js @@ -31,8 +31,7 @@ bar; // bar should resolve while foo should not, since even though index.js is e export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// foo; bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js.diff deleted file mode 100644 index c41774a12da..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride3(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeOverride3(module=node20).js -@@= skipped -30, +30 lines =@@ - export {}; - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// - foo; - bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt index ccc0b639564..3d7f07f2775 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt.diff deleted file mode 100644 index 7ebaea03078..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(3,1): error TS2304: Cannot find name 'bar'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt deleted file mode 100644 index f1800f46cbf..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - /// - // Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two - // references above. - foo; - bar; - export {}; -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - var foo: number; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - var bar: number; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt.diff deleted file mode 100644 index 50392d66b56..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ /// -+ // Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two -+ // references above. -+ foo; -+ bar; -+ export {}; -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ var foo: number; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ var bar: number; -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt index aaf67babaf2..cd6427d4804 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; // bad resolution mode, which resolves is arbitrary diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff index 2b5265bb729..7302a4c5be5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff @@ -2,12 +2,10 @@ +++ new.nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -==== /index.ts (2 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== /index.ts (1 errors) ==== /// - ~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt deleted file mode 100644 index 2e1790dd69a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - import { add } from "lodash-ts/add.ts"; // Ok - -==== /node_modules/lodash-ts/add.ts (0 errors) ==== - export function add(a: number, b: number) { - return a + b; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt.diff deleted file mode 100644 index c8c77ac55cc..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesTsFiles(module=node20).errors.txt -+++ new.nodeModulesTsFiles(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ import { add } from "lodash-ts/add.ts"; // Ok -+ -+==== /node_modules/lodash-ts/add.ts (0 errors) ==== -+ export function add(a: number, b: number) { -+ return a + b; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols index 21f0eeeb44c..8ec3cb25a79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols.diff deleted file mode 100644 index 11d9c3446e6..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node16).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=node16).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols index 21f0eeeb44c..8ec3cb25a79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols.diff deleted file mode 100644 index 4b22e379068..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node18).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=node18).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt deleted file mode 100644 index 22c440df850..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,55 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as mod from "inner"; - mod.correctVersionApplied; - -==== index.mts (0 errors) ==== - // esm format file - import * as mod from "inner"; - mod.correctVersionApplied; - -==== index.cts (0 errors) ==== - // cjs format file - import * as mod from "inner"; - mod.correctVersionApplied; - -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const noConditionsApplied = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const importConditionApplied = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const wrongConditionApplied = true; -==== node_modules/inner/old-types.d.ts (0 errors) ==== - export const noVersionApplied = true; -==== node_modules/inner/new-types.d.ts (0 errors) ==== - export const correctVersionApplied = true; -==== node_modules/inner/future-types.d.ts (0 errors) ==== - export const futureVersionApplied = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - ".": { - "types@>=10000": "./future-types.d.ts", - "types@>=1": "./new-types.d.ts", - "types": "./old-types.d.ts", - "import": "./index.mjs", - "node": "./index.js" - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index a58cf39714e..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node20).errors.txt -+++ new.nodeModulesTypesVersionPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as mod from "inner"; -+ mod.correctVersionApplied; -+ -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as mod from "inner"; -+ mod.correctVersionApplied; -+ -+==== index.cts (0 errors) ==== -+ // cjs format file -+ import * as mod from "inner"; -+ mod.correctVersionApplied; -+ -+==== node_modules/inner/index.d.ts (0 errors) ==== -+ // cjs format file -+ export const noConditionsApplied = true; -+==== node_modules/inner/index.d.mts (0 errors) ==== -+ // esm format file -+ export const importConditionApplied = true; -+==== node_modules/inner/index.d.cts (0 errors) ==== -+ // cjs format file -+ export const wrongConditionApplied = true; -+==== node_modules/inner/old-types.d.ts (0 errors) ==== -+ export const noVersionApplied = true; -+==== node_modules/inner/new-types.d.ts (0 errors) ==== -+ export const correctVersionApplied = true; -+==== node_modules/inner/future-types.d.ts (0 errors) ==== -+ export const futureVersionApplied = true; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== node_modules/inner/package.json (0 errors) ==== -+ { -+ "name": "inner", -+ "private": true, -+ "exports": { -+ ".": { -+ "types@>=10000": "./future-types.d.ts", -+ "types@>=1": "./new-types.d.ts", -+ "types": "./old-types.d.ts", -+ "import": "./index.mjs", -+ "node": "./index.js" -+ } -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js index e731a9a3277..0a09964a041 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js @@ -53,22 +53,51 @@ export const futureVersionApplied = true; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const mod = require("inner"); +import * as mod from "inner"; mod.correctVersionApplied; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const mod = require("inner"); +import * as mod from "inner"; mod.correctVersionApplied; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const mod = require("inner"); +const mod = __importStar(require("inner")); mod.correctVersionApplied; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js.diff deleted file mode 100644 index e3009a9fbb7..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node20).js -+++ new.nodeModulesTypesVersionPackageExports(module=node20).js -@@= skipped -52, +52 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as mod from "inner"; -+const mod = require("inner"); - mod.correctVersionApplied; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as mod from "inner"; -+const mod = require("inner"); - mod.correctVersionApplied; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const mod = __importStar(require("inner")); -+const mod = require("inner"); - mod.correctVersionApplied; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols index 21f0eeeb44c..8ec3cb25a79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols.diff deleted file mode 100644 index 2c7e8326f4a..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node20).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=node20).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols index 21f0eeeb44c..8ec3cb25a79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 1ee4fa93954..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=nodenext).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=nodenext).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt deleted file mode 100644 index 0dc2a46ccfe..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as self from "package"; - self; -==== index.mts (0 errors) ==== - // esm format file - import * as self from "package"; - self; -==== index.cts (0 errors) ==== - // esm format file - import * as self from "package"; - self; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.js" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt.diff deleted file mode 100644 index 9f8d98beabf..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodePackageSelfName(module=node20).errors.txt -+++ new.nodePackageSelfName(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== index.cts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js index 808f7208b84..dc65d690cf6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +const self = __importStar(require("package")); self; diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js.diff deleted file mode 100644 index cea0f0b80e2..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodePackageSelfName(module=node20).js -+++ new.nodePackageSelfName(module=node20).js -@@= skipped -20, +20 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const self = __importStar(require("package")); -+const self = require("package"); - self; - diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt deleted file mode 100644 index 0852852eb98..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as self from "@scope/package"; - self; -==== index.mts (0 errors) ==== - // esm format file - import * as self from "@scope/package"; - self; -==== index.cts (0 errors) ==== - // cjs format file - import * as self from "@scope/package"; - self; -==== package.json (0 errors) ==== - { - "name": "@scope/package", - "private": true, - "type": "module", - "exports": "./index.js" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt.diff deleted file mode 100644 index 0c5e2ee7834..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodePackageSelfNameScoped(module=node20).errors.txt -+++ new.nodePackageSelfNameScoped(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as self from "@scope/package"; -+ self; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as self from "@scope/package"; -+ self; -+==== index.cts (0 errors) ==== -+ // cjs format file -+ import * as self from "@scope/package"; -+ self; -+==== package.json (0 errors) ==== -+ { -+ "name": "@scope/package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js index 0ab838fc3ef..f9d633df6fc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("@scope/package"); +import * as self from "@scope/package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("@scope/package"); +import * as self from "@scope/package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const self = require("@scope/package"); +const self = __importStar(require("@scope/package")); self; diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js.diff deleted file mode 100644 index c8c71778060..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodePackageSelfNameScoped(module=node20).js -+++ new.nodePackageSelfNameScoped(module=node20).js -@@= skipped -20, +20 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "@scope/package"; -+const self = require("@scope/package"); - self; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "@scope/package"; -+const self = require("@scope/package"); - self; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const self = __importStar(require("@scope/package")); -+const self = require("@scope/package"); - self; - diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt deleted file mode 100644 index fde53ef312d..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== example.json (0 errors) ==== - {} - -==== styles.d.css.ts (0 errors) ==== - export {}; - -==== index.mts (0 errors) ==== - import {} from "./example.json" with { type: "json" }; // Ok - import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt.diff deleted file mode 100644 index 46899befb50..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.nonTSExtensions(module=node20).errors.txt -+++ new.nonTSExtensions(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== example.json (0 errors) ==== -+ {} -+ -+==== styles.d.css.ts (0 errors) ==== -+ export {}; -+ -+==== index.mts (0 errors) ==== -+ import {} from "./example.json" with { type: "json" }; // Ok -+ import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js index 7952812e2f3..117d199aa7d 100644 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js @@ -11,5 +11,4 @@ import {} from "./example.json" with { type: "json" }; // Ok import {} from "./styles.css"; // Ok //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js.diff deleted file mode 100644 index 3d87f69e614..00000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.nonTSExtensions(module=node20).js -+++ new.nonTSExtensions(module=node20).js -@@= skipped -10, +10 lines =@@ - import {} from "./styles.css"; // Ok - - //// [index.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nullPropertyName.js b/testdata/baselines/reference/submodule/conformance/nullPropertyName.js index 687fcfe9e31..ab6060fccf5 100644 --- a/testdata/baselines/reference/submodule/conformance/nullPropertyName.js +++ b/testdata/baselines/reference/submodule/conformance/nullPropertyName.js @@ -171,3 +171,282 @@ foo.of = 1; //// [nullPropertyName.d.ts] declare function foo(): void; +declare namespace foo { + var x: number; +} +declare namespace foo { + var y: number; +} +declare namespace foo { + var _a: number; + export { _a as break }; +} +declare namespace foo { + var _b: number; + export { _b as case }; +} +declare namespace foo { + var _c: number; + export { _c as catch }; +} +declare namespace foo { + var _d: number; + export { _d as class }; +} +declare namespace foo { + var _e: number; + export { _e as const }; +} +declare namespace foo { + var _f: number; + export { _f as continue }; +} +declare namespace foo { + var _g: number; + export { _g as debugger }; +} +declare namespace foo { + var _h: number; + export { _h as default }; +} +declare namespace foo { + var _j: number; + export { _j as delete }; +} +declare namespace foo { + var _k: number; + export { _k as do }; +} +declare namespace foo { + var _l: number; + export { _l as else }; +} +declare namespace foo { + var _m: number; + export { _m as enum }; +} +declare namespace foo { + var _o: number; + export { _o as export }; +} +declare namespace foo { + var _p: number; + export { _p as extends }; +} +declare namespace foo { + var _q: number; + export { _q as false }; +} +declare namespace foo { + var _r: number; + export { _r as finally }; +} +declare namespace foo { + var _s: number; + export { _s as for }; +} +declare namespace foo { + var _t: number; + export { _t as function }; +} +declare namespace foo { + var _u: number; + export { _u as if }; +} +declare namespace foo { + var _v: number; + export { _v as import }; +} +declare namespace foo { + var _w: number; + export { _w as in }; +} +declare namespace foo { + var _x: number; + export { _x as instanceof }; +} +declare namespace foo { + var _y: number; + export { _y as new }; +} +declare namespace foo { + var _z: number; + export { _z as null }; +} +declare namespace foo { + var _0: number; + export { _0 as return }; +} +declare namespace foo { + var _1: number; + export { _1 as super }; +} +declare namespace foo { + var _2: number; + export { _2 as switch }; +} +declare namespace foo { + var _3: number; + export { _3 as this }; +} +declare namespace foo { + var _4: number; + export { _4 as throw }; +} +declare namespace foo { + var _5: number; + export { _5 as true }; +} +declare namespace foo { + var _6: number; + export { _6 as try }; +} +declare namespace foo { + var _7: number; + export { _7 as typeof }; +} +declare namespace foo { + var _8: number; + export { _8 as var }; +} +declare namespace foo { + var _9: number; + export { _9 as void }; +} +declare namespace foo { + var _10: number; + export { _10 as while }; +} +declare namespace foo { + var _11: number; + export { _11 as with }; +} +declare namespace foo { + var _12: number; + export { _12 as implements }; +} +declare namespace foo { + var _13: number; + export { _13 as interface }; +} +declare namespace foo { + var _14: number; + export { _14 as let }; +} +declare namespace foo { + var _15: number; + export { _15 as package }; +} +declare namespace foo { + var _16: number; + export { _16 as private }; +} +declare namespace foo { + var _17: number; + export { _17 as protected }; +} +declare namespace foo { + var _18: number; + export { _18 as public }; +} +declare namespace foo { + var _19: number; + export { _19 as static }; +} +declare namespace foo { + var _20: number; + export { _20 as yield }; +} +declare namespace foo { + var abstract: number; +} +declare namespace foo { + var as: number; +} +declare namespace foo { + var asserts: number; +} +declare namespace foo { + var any: number; +} +declare namespace foo { + var async: number; +} +declare namespace foo { + var await: number; +} +declare namespace foo { + var boolean: number; +} +declare namespace foo { + var constructor: number; +} +declare namespace foo { + var declare: number; +} +declare namespace foo { + var get: number; +} +declare namespace foo { + var infer: number; +} +declare namespace foo { + var is: number; +} +declare namespace foo { + var keyof: number; +} +declare namespace foo { + var module: number; +} +declare namespace foo { + var namespace: number; +} +declare namespace foo { + var never: number; +} +declare namespace foo { + var readonly: number; +} +declare namespace foo { + var require: number; +} +declare namespace foo { + var number: number; +} +declare namespace foo { + var object: number; +} +declare namespace foo { + var set: number; +} +declare namespace foo { + var string: number; +} +declare namespace foo { + var symbol: number; +} +declare namespace foo { + var type: number; +} +declare namespace foo { + var undefined: number; +} +declare namespace foo { + var unique: number; +} +declare namespace foo { + var unknown: number; +} +declare namespace foo { + var from: number; +} +declare namespace foo { + var global: number; +} +declare namespace foo { + var bigint: number; +} +declare namespace foo { + var of: number; +} diff --git a/testdata/baselines/reference/submodule/conformance/nullPropertyName.js.diff b/testdata/baselines/reference/submodule/conformance/nullPropertyName.js.diff index 60cf26b0b59..a2d826927db 100644 --- a/testdata/baselines/reference/submodule/conformance/nullPropertyName.js.diff +++ b/testdata/baselines/reference/submodule/conformance/nullPropertyName.js.diff @@ -1,57 +1,194 @@ --- old.nullPropertyName.js +++ new.nullPropertyName.js -@@= skipped -170, +170 lines =@@ - +@@= skipped -171, +171 lines =@@ //// [nullPropertyName.d.ts] declare function foo(): void; --declare namespace foo { + declare namespace foo { - export var x: number; - export var y: number; -- var _a: number; -- var _b: number; -- var _c: number; -- var _d: number; -- var _e: number; -- var _f: number; -- var _g: number; -- var _h: number; -- var _j: number; -- var _k: number; -- var _l: number; -- var _m: number; -- var _o: number; -- var _p: number; -- var _q: number; -- var _r: number; -- var _s: number; -- var _t: number; -- var _u: number; -- var _v: number; -- var _w: number; -- var _x: number; -- var _y: number; -- var _z: number; -- var _0: number; -- var _1: number; -- var _2: number; -- var _3: number; -- var _4: number; -- var _5: number; -- var _6: number; -- var _7: number; -- var _8: number; -- var _9: number; -- var _10: number; -- var _11: number; -- var _12: number; -- var _13: number; -- var _14: number; -- var _15: number; -- var _16: number; -- var _17: number; -- var _18: number; -- var _19: number; -- var _20: number; ++ var x: number; ++} ++declare namespace foo { ++ var y: number; ++} ++declare namespace foo { + var _a: number; ++ export { _a as break }; ++} ++declare namespace foo { + var _b: number; ++ export { _b as case }; ++} ++declare namespace foo { + var _c: number; ++ export { _c as catch }; ++} ++declare namespace foo { + var _d: number; ++ export { _d as class }; ++} ++declare namespace foo { + var _e: number; ++ export { _e as const }; ++} ++declare namespace foo { + var _f: number; ++ export { _f as continue }; ++} ++declare namespace foo { + var _g: number; ++ export { _g as debugger }; ++} ++declare namespace foo { + var _h: number; ++ export { _h as default }; ++} ++declare namespace foo { + var _j: number; ++ export { _j as delete }; ++} ++declare namespace foo { + var _k: number; ++ export { _k as do }; ++} ++declare namespace foo { + var _l: number; ++ export { _l as else }; ++} ++declare namespace foo { + var _m: number; ++ export { _m as enum }; ++} ++declare namespace foo { + var _o: number; ++ export { _o as export }; ++} ++declare namespace foo { + var _p: number; ++ export { _p as extends }; ++} ++declare namespace foo { + var _q: number; ++ export { _q as false }; ++} ++declare namespace foo { + var _r: number; ++ export { _r as finally }; ++} ++declare namespace foo { + var _s: number; ++ export { _s as for }; ++} ++declare namespace foo { + var _t: number; ++ export { _t as function }; ++} ++declare namespace foo { + var _u: number; ++ export { _u as if }; ++} ++declare namespace foo { + var _v: number; ++ export { _v as import }; ++} ++declare namespace foo { + var _w: number; ++ export { _w as in }; ++} ++declare namespace foo { + var _x: number; ++ export { _x as instanceof }; ++} ++declare namespace foo { + var _y: number; ++ export { _y as new }; ++} ++declare namespace foo { + var _z: number; ++ export { _z as null }; ++} ++declare namespace foo { + var _0: number; ++ export { _0 as return }; ++} ++declare namespace foo { + var _1: number; ++ export { _1 as super }; ++} ++declare namespace foo { + var _2: number; ++ export { _2 as switch }; ++} ++declare namespace foo { + var _3: number; ++ export { _3 as this }; ++} ++declare namespace foo { + var _4: number; ++ export { _4 as throw }; ++} ++declare namespace foo { + var _5: number; ++ export { _5 as true }; ++} ++declare namespace foo { + var _6: number; ++ export { _6 as try }; ++} ++declare namespace foo { + var _7: number; ++ export { _7 as typeof }; ++} ++declare namespace foo { + var _8: number; ++ export { _8 as var }; ++} ++declare namespace foo { + var _9: number; ++ export { _9 as void }; ++} ++declare namespace foo { + var _10: number; ++ export { _10 as while }; ++} ++declare namespace foo { + var _11: number; ++ export { _11 as with }; ++} ++declare namespace foo { + var _12: number; ++ export { _12 as implements }; ++} ++declare namespace foo { + var _13: number; ++ export { _13 as interface }; ++} ++declare namespace foo { + var _14: number; ++ export { _14 as let }; ++} ++declare namespace foo { + var _15: number; ++ export { _15 as package }; ++} ++declare namespace foo { + var _16: number; ++ export { _16 as private }; ++} ++declare namespace foo { + var _17: number; ++ export { _17 as protected }; ++} ++declare namespace foo { + var _18: number; ++ export { _18 as public }; ++} ++declare namespace foo { + var _19: number; ++ export { _19 as static }; ++} ++declare namespace foo { + var _20: number; - export var abstract: number; - export var as: number; - export var asserts: number; @@ -84,4 +221,98 @@ - export var bigint: number; - export var of: number; - export { _a as break, _b as case, _c as catch, _d as class, _e as const, _f as continue, _g as debugger, _h as default, _j as delete, _k as do, _l as else, _m as enum, _o as export, _p as extends, _q as false, _r as finally, _s as for, _t as function, _u as if, _v as import, _w as in, _x as instanceof, _y as new, _z as null, _0 as return, _1 as super, _2 as switch, _3 as this, _4 as throw, _5 as true, _6 as try, _7 as typeof, _8 as var, _9 as void, _10 as while, _11 as with, _12 as implements, _13 as interface, _14 as let, _15 as package, _16 as private, _17 as protected, _18 as public, _19 as static, _20 as yield }; --} \ No newline at end of file ++ export { _20 as yield }; ++} ++declare namespace foo { ++ var abstract: number; ++} ++declare namespace foo { ++ var as: number; ++} ++declare namespace foo { ++ var asserts: number; ++} ++declare namespace foo { ++ var any: number; ++} ++declare namespace foo { ++ var async: number; ++} ++declare namespace foo { ++ var await: number; ++} ++declare namespace foo { ++ var boolean: number; ++} ++declare namespace foo { ++ var constructor: number; ++} ++declare namespace foo { ++ var declare: number; ++} ++declare namespace foo { ++ var get: number; ++} ++declare namespace foo { ++ var infer: number; ++} ++declare namespace foo { ++ var is: number; ++} ++declare namespace foo { ++ var keyof: number; ++} ++declare namespace foo { ++ var module: number; ++} ++declare namespace foo { ++ var namespace: number; ++} ++declare namespace foo { ++ var never: number; ++} ++declare namespace foo { ++ var readonly: number; ++} ++declare namespace foo { ++ var require: number; ++} ++declare namespace foo { ++ var number: number; ++} ++declare namespace foo { ++ var object: number; ++} ++declare namespace foo { ++ var set: number; ++} ++declare namespace foo { ++ var string: number; ++} ++declare namespace foo { ++ var symbol: number; ++} ++declare namespace foo { ++ var type: number; ++} ++declare namespace foo { ++ var undefined: number; ++} ++declare namespace foo { ++ var unique: number; ++} ++declare namespace foo { ++ var unknown: number; ++} ++declare namespace foo { ++ var from: number; ++} ++declare namespace foo { ++ var global: number; ++} ++declare namespace foo { ++ var bigint: number; ++} ++declare namespace foo { ++ var of: number; + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt index a24608608b5..8167e0cafd0 100644 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,16): error TS2877: This import uses a '.ts' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /package.json (0 errors) ==== { "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt.diff deleted file mode 100644 index 0433a986879..00000000000 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.packageJsonImportsErrors(module=node20).errors.txt -+++ new.packageJsonImportsErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,16): error TS2877: This import uses a '.ts' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /package.json (0 errors) ==== - { - "name": "pkg", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js index c735076d9e8..5a0805f046f 100644 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js @@ -28,14 +28,10 @@ import {} from "#internal/foo.ts"; // Error import {} from "pkg/foo.ts"; // Ok //// [foo.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [foo.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const _foo_ts_1 = require("#foo.ts"); // Ok -const foo_ts_1 = require("#internal/foo.ts"); // Error -const foo_ts_2 = require("pkg/foo.ts"); // Ok +import {} from "#foo.ts"; // Ok +import {} from "#internal/foo.ts"; // Error +import {} from "pkg/foo.ts"; // Ok diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js.diff deleted file mode 100644 index 0857b0dc760..00000000000 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.packageJsonImportsErrors(module=node20).js -+++ new.packageJsonImportsErrors(module=node20).js -@@= skipped -27, +27 lines =@@ - import {} from "pkg/foo.ts"; // Ok - - //// [foo.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [foo.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [index.js] --import {} from "#foo.ts"; // Ok --import {} from "#internal/foo.ts"; // Error --import {} from "pkg/foo.ts"; // Ok -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+const _foo_ts_1 = require("#foo.ts"); // Ok -+const foo_ts_1 = require("#internal/foo.ts"); // Error -+const foo_ts_2 = require("pkg/foo.ts"); // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js index 2726349e596..b31808bd204 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js @@ -170,29 +170,54 @@ var n = ExpandoExpr3.prop + ExpandoExpr3.m(13) + new ExpandoExpr3().n; //// [typeFromPropertyAssignment29.d.ts] declare function ExpandoDecl(n: number): string; +declare namespace ExpandoDecl { + var prop: number; +} +declare namespace ExpandoDecl { + var m: (n: number) => number; +} declare var n: number; -declare const ExpandoExpr: { - (n: number): string; - prop: { +declare function ExpandoExpr(n: number): string; +declare namespace ExpandoExpr { + var prop: { x: number; y?: undefined; } | { x?: undefined; y: string; }; - m: (n: number) => number; -}; +} +declare namespace ExpandoExpr { + var prop: { + x: number; + y?: undefined; + } | { + x?: undefined; + y: string; + }; +} +declare namespace ExpandoExpr { + var m: (n: number) => number; +} declare var n: number; -declare const ExpandoArrow: { - (n: number): string; - prop: number; - m: (n: number) => number; -}; +declare function ExpandoArrow(n: number): string; +declare namespace ExpandoArrow { + var prop: number; +} +declare namespace ExpandoArrow { + var m: (n: number) => number; +} declare function ExpandoNested(n: number): { (m: number): number; total: number; }; +declare namespace ExpandoNested { + var also: number; +} declare function ExpandoMerge(n: number): number; +declare namespace ExpandoMerge { + var p1: number; +} declare namespace ExpandoMerge { var p2: number; } @@ -202,6 +227,9 @@ declare namespace ExpandoMerge { declare var n: number; declare namespace Ns { function ExpandoNamespace(): void; + declare namespace ExpandoNamespace { + var p6: number; + } export function foo(): typeof ExpandoNamespace; export {}; } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js.diff index ec27c638916..c3bef5520aa 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment29.js.diff @@ -31,53 +31,74 @@ }; ExpandoExpr3.prop = 3; ExpandoExpr3.m = function (n) { -@@= skipped -13, +11 lines =@@ - - //// [typeFromPropertyAssignment29.d.ts] +@@= skipped -15, +13 lines =@@ declare function ExpandoDecl(n: number): string; --declare namespace ExpandoDecl { -- var prop: number; + declare namespace ExpandoDecl { + var prop: number; - var m: (n: number) => number; -} - declare var n: number; - declare const ExpandoExpr: { - (n: number): string; -@@= skipped -14, +10 lines =@@ - x?: undefined; - y: string; - }; +-declare var n: number; +-declare const ExpandoExpr: { +- (n: number): string; +- prop: { +- x: number; +- y?: undefined; +- } | { +- x?: undefined; +- y: string; +- }; - m(n: number): number; -+ m: (n: number) => number; - }; - declare var n: number; - declare const ExpandoArrow: { - (n: number): string; - prop: number; +-}; +-declare var n: number; +-declare const ExpandoArrow: { +- (n: number): string; +- prop: number; - m(n: number): number; -+ m: (n: number) => number; - }; +-}; ++} ++declare namespace ExpandoDecl { ++ var m: (n: number) => number; ++} ++declare var n: number; ++declare function ExpandoExpr(n: number): string; ++declare namespace ExpandoExpr { ++ var prop: { ++ x: number; ++ y?: undefined; ++ } | { ++ x?: undefined; ++ y: string; ++ }; ++} ++declare namespace ExpandoExpr { ++ var prop: { ++ x: number; ++ y?: undefined; ++ } | { ++ x?: undefined; ++ y: string; ++ }; ++} ++declare namespace ExpandoExpr { ++ var m: (n: number) => number; ++} ++declare var n: number; ++declare function ExpandoArrow(n: number): string; ++declare namespace ExpandoArrow { ++ var prop: number; ++} ++declare namespace ExpandoArrow { ++ var m: (n: number) => number; ++} declare function ExpandoNested(n: number): { (m: number): number; total: number; - }; --declare namespace ExpandoNested { -- var also: number; --} - declare function ExpandoMerge(n: number): number; - declare namespace ExpandoMerge { -- var p1: number; --} --declare namespace ExpandoMerge { - var p2: number; - } - declare namespace ExpandoMerge { -@@= skipped -28, +22 lines =@@ +@@= skipped -40, +55 lines =@@ declare var n: number; declare namespace Ns { function ExpandoNamespace(): void; - namespace ExpandoNamespace { -- var p6: number; -- } - export function foo(): typeof ExpandoNamespace; - export {}; - } \ No newline at end of file ++ declare namespace ExpandoNamespace { + var p6: number; + } + export function foo(): typeof ExpandoNamespace; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js index 3c3d0d693bd..32c4d0ca601 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js @@ -14,3 +14,42 @@ declare const foo: { blah: number; }; }; +declare namespace foo { + var baz: { + blah: number; + }; +} +declare namespace foo { + var blah: number; +} + + +//// [DtsFileErrors] + + +a.d.ts(1,15): error TS2451: Cannot redeclare block-scoped variable 'foo'. +a.d.ts(6,19): error TS2451: Cannot redeclare block-scoped variable 'foo'. +a.d.ts(11,19): error TS2451: Cannot redeclare block-scoped variable 'foo'. + + +==== a.d.ts (3 errors) ==== + declare const foo: { + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. + baz: { + blah: number; + }; + }; + declare namespace foo { + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. + var baz: { + blah: number; + }; + } + declare namespace foo { + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. + var blah: number; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js.diff index aac15146026..0c5a6e3a9db 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment39.js.diff @@ -13,4 +13,43 @@ + baz: { + blah: number; + }; -+}; \ No newline at end of file ++}; ++declare namespace foo { ++ var baz: { ++ blah: number; ++ }; ++} ++declare namespace foo { ++ var blah: number; ++} ++ ++ ++//// [DtsFileErrors] ++ ++ ++a.d.ts(1,15): error TS2451: Cannot redeclare block-scoped variable 'foo'. ++a.d.ts(6,19): error TS2451: Cannot redeclare block-scoped variable 'foo'. ++a.d.ts(11,19): error TS2451: Cannot redeclare block-scoped variable 'foo'. ++ ++ ++==== a.d.ts (3 errors) ==== ++ declare const foo: { ++ ~~~ ++!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. ++ baz: { ++ blah: number; ++ }; ++ }; ++ declare namespace foo { ++ ~~~ ++!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. ++ var baz: { ++ blah: number; ++ }; ++ } ++ declare namespace foo { ++ ~~~ ++!!! error TS2451: Cannot redeclare block-scoped variable 'foo'. ++ var blah: number; ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js index 05ea5715ce8..c6a71ddc88f 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js @@ -30,4 +30,13 @@ map4.__underscores__(); //// [a.d.ts] declare function Multimap4(): void; +declare namespace Multimap4 { + var prototype: { + /** + * @param {string} key + * @returns {number} the value ok + */ + get(key: string): number; + }; +} declare const map4: any; diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js.diff b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js.diff index d5ffe64194d..1e1f280301b 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPrototypeAssignment4.js.diff @@ -14,6 +14,14 @@ - "add-on"(): void; - addon(): void; - __underscores__(): void; --} ++declare namespace Multimap4 { ++ var prototype: { ++ /** ++ * @param {string} key ++ * @returns {number} the value ok ++ */ ++ get(key: string): number; ++ }; + } -declare const map4: Multimap4; +declare const map4: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt deleted file mode 100644 index 5aab49a4c73..00000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== module.mts (0 errors) ==== - export {}; - -==== common.cts (0 errors) ==== - import type {} from "./module.mts"; - import type {} from "./module.mts" with { "resolution-mode": "import" }; - import type {} from "./module.mts" with { "resolution-mode": "require" }; - type _1 = typeof import("./module.mts"); - type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); - type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt.diff deleted file mode 100644 index ad2ae092894..00000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node20).errors.txt -+++ new.typeOnlyESMImportFromCJS(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== module.mts (0 errors) ==== -+ export {}; -+ -+==== common.cts (0 errors) ==== -+ import type {} from "./module.mts"; -+ import type {} from "./module.mts" with { "resolution-mode": "import" }; -+ import type {} from "./module.mts" with { "resolution-mode": "require" }; -+ type _1 = typeof import("./module.mts"); -+ type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); -+ type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js index 5ba6ae1ae7e..01b406ded5d 100644 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js @@ -13,8 +13,7 @@ type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } //// [module.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [common.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js.diff deleted file mode 100644 index c7e753f5b90..00000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node20).js -+++ new.typeOnlyESMImportFromCJS(module=node20).js -@@= skipped -12, +12 lines =@@ - - - //// [module.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [common.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types index a97ffa95be6..c94b254bed4 100644 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types @@ -9,11 +9,11 @@ import type {} from "./module.mts"; import type {} from "./module.mts" with { "resolution-mode": "import" }; import type {} from "./module.mts" with { "resolution-mode": "require" }; type _1 = typeof import("./module.mts"); ->_1 : typeof import("module") +>_1 : typeof import("module", { with: { "resolution-mode": "import" } }) type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); ->_2 : typeof import("module") +>_2 : typeof import("module", { with: { "resolution-mode": "import" } }) type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); ->_3 : typeof import("module") +>_3 : typeof import("module", { with: { "resolution-mode": "import" } }) diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types.diff deleted file mode 100644 index cb1750eeec3..00000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node20).types -+++ new.typeOnlyESMImportFromCJS(module=node20).types -@@= skipped -8, +8 lines =@@ - import type {} from "./module.mts" with { "resolution-mode": "import" }; - import type {} from "./module.mts" with { "resolution-mode": "require" }; - type _1 = typeof import("./module.mts"); -->_1 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_1 : typeof import("module") - - type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); -->_2 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_2 : typeof import("module") - - type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); -->_3 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_3 : typeof import("module") diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt index 88b431ce341..244b86443cb 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt @@ -1,8 +1,12 @@ typesWithPrivateConstructor.ts(5,9): error TS2673: Constructor of class 'C' is private and only accessible within the class declaration. +typesWithPrivateConstructor.ts(6,5): error TS2322: Type 'Function' is not assignable to type '() => void'. + Type 'Function' provides no match for the signature '(): void'. typesWithPrivateConstructor.ts(13,10): error TS2673: Constructor of class 'C2' is private and only accessible within the class declaration. +typesWithPrivateConstructor.ts(14,5): error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. + Type 'Function' provides no match for the signature '(x: number): void'. -==== typesWithPrivateConstructor.ts (2 errors) ==== +==== typesWithPrivateConstructor.ts (4 errors) ==== class C { private constructor() { } } @@ -11,6 +15,9 @@ typesWithPrivateConstructor.ts(13,10): error TS2673: Constructor of class 'C2' i ~~~~~~~ !!! error TS2673: Constructor of class 'C' is private and only accessible within the class declaration. var r: () => void = c.constructor; + ~ +!!! error TS2322: Type 'Function' is not assignable to type '() => void'. +!!! error TS2322: Type 'Function' provides no match for the signature '(): void'. class C2 { private constructor(x: number); @@ -20,4 +27,7 @@ typesWithPrivateConstructor.ts(13,10): error TS2673: Constructor of class 'C2' i var c2 = new C2(); // error C2 is private ~~~~~~~~ !!! error TS2673: Constructor of class 'C2' is private and only accessible within the class declaration. - var r2: (x: number) => void = c2.constructor; \ No newline at end of file + var r2: (x: number) => void = c2.constructor; + ~~ +!!! error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. +!!! error TS2322: Type 'Function' provides no match for the signature '(x: number): void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt.diff new file mode 100644 index 00000000000..f48b8be4f72 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.errors.txt.diff @@ -0,0 +1,35 @@ +--- old.typesWithPrivateConstructor.errors.txt ++++ new.typesWithPrivateConstructor.errors.txt +@@= skipped -0, +0 lines =@@ + typesWithPrivateConstructor.ts(5,9): error TS2673: Constructor of class 'C' is private and only accessible within the class declaration. ++typesWithPrivateConstructor.ts(6,5): error TS2322: Type 'Function' is not assignable to type '() => void'. ++ Type 'Function' provides no match for the signature '(): void'. + typesWithPrivateConstructor.ts(13,10): error TS2673: Constructor of class 'C2' is private and only accessible within the class declaration. +- +- +-==== typesWithPrivateConstructor.ts (2 errors) ==== ++typesWithPrivateConstructor.ts(14,5): error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. ++ Type 'Function' provides no match for the signature '(x: number): void'. ++ ++ ++==== typesWithPrivateConstructor.ts (4 errors) ==== + class C { + private constructor() { } + } +@@= skipped -10, +14 lines =@@ + ~~~~~~~ + !!! error TS2673: Constructor of class 'C' is private and only accessible within the class declaration. + var r: () => void = c.constructor; ++ ~ ++!!! error TS2322: Type 'Function' is not assignable to type '() => void'. ++!!! error TS2322: Type 'Function' provides no match for the signature '(): void'. + + class C2 { + private constructor(x: number); +@@= skipped -10, +13 lines =@@ + ~~~~~~~~ + !!! error TS2673: Constructor of class 'C2' is private and only accessible within the class declaration. + var r2: (x: number) => void = c2.constructor; ++ ~~ ++!!! error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. ++!!! error TS2322: Type 'Function' provides no match for the signature '(x: number): void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js index 2451eec981b..8c689f0d2e5 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js @@ -33,10 +33,10 @@ var r2 = c2.constructor; declare class C { private constructor(); } -declare var c: any; +declare var c: C; declare var r: () => void; declare class C2 { private constructor(); } -declare var c2: any; +declare var c2: C2; declare var r2: (x: number) => void; diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js.diff b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js.diff new file mode 100644 index 00000000000..5991914cd58 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.js.diff @@ -0,0 +1,15 @@ +--- old.typesWithPrivateConstructor.js ++++ new.typesWithPrivateConstructor.js +@@= skipped -32, +32 lines =@@ + declare class C { + private constructor(); + } +-declare var c: any; ++declare var c: C; + declare var r: () => void; + declare class C2 { + private constructor(); + } +-declare var c2: any; ++declare var c2: C2; + declare var r2: (x: number) => void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols index 843a7fea9f1..34f55dc7007 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols @@ -13,7 +13,9 @@ var c = new C(); // error C is private var r: () => void = c.constructor; >r : Symbol(r, Decl(typesWithPrivateConstructor.ts, 5, 3)) +>c.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >c : Symbol(c, Decl(typesWithPrivateConstructor.ts, 4, 3)) +>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) class C2 { >C2 : Symbol(C2, Decl(typesWithPrivateConstructor.ts, 5, 34)) @@ -32,5 +34,7 @@ var c2 = new C2(); // error C2 is private var r2: (x: number) => void = c2.constructor; >r2 : Symbol(r2, Decl(typesWithPrivateConstructor.ts, 13, 3)) >x : Symbol(x, Decl(typesWithPrivateConstructor.ts, 13, 9)) +>c2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >c2 : Symbol(c2, Decl(typesWithPrivateConstructor.ts, 12, 3)) +>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols.diff b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols.diff new file mode 100644 index 00000000000..6460378e0a0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.symbols.diff @@ -0,0 +1,19 @@ +--- old.typesWithPrivateConstructor.symbols ++++ new.typesWithPrivateConstructor.symbols +@@= skipped -12, +12 lines =@@ + + var r: () => void = c.constructor; + >r : Symbol(r, Decl(typesWithPrivateConstructor.ts, 5, 3)) ++>c.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) + >c : Symbol(c, Decl(typesWithPrivateConstructor.ts, 4, 3)) ++>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) + + class C2 { + >C2 : Symbol(C2, Decl(typesWithPrivateConstructor.ts, 5, 34)) +@@= skipped -19, +21 lines =@@ + var r2: (x: number) => void = c2.constructor; + >r2 : Symbol(r2, Decl(typesWithPrivateConstructor.ts, 13, 3)) + >x : Symbol(x, Decl(typesWithPrivateConstructor.ts, 13, 9)) ++>c2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) + >c2 : Symbol(c2, Decl(typesWithPrivateConstructor.ts, 12, 3)) ++>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types index 81cd79c3486..d125891ce5e 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types @@ -8,15 +8,15 @@ class C { } var c = new C(); // error C is private ->c : any ->new C() : any +>c : C +>new C() : C >C : typeof C var r: () => void = c.constructor; >r : () => void ->c.constructor : any ->c : any ->constructor : any +>c.constructor : Function +>c : C +>constructor : Function class C2 { >C2 : C2 @@ -29,14 +29,14 @@ class C2 { } var c2 = new C2(); // error C2 is private ->c2 : any ->new C2() : any +>c2 : C2 +>new C2() : C2 >C2 : typeof C2 var r2: (x: number) => void = c2.constructor; >r2 : (x: number) => void >x : number ->c2.constructor : any ->c2 : any ->constructor : any +>c2.constructor : Function +>c2 : C2 +>constructor : Function diff --git a/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types.diff b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types.diff new file mode 100644 index 00000000000..617233d1c36 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithPrivateConstructor.types.diff @@ -0,0 +1,42 @@ +--- old.typesWithPrivateConstructor.types ++++ new.typesWithPrivateConstructor.types +@@= skipped -7, +7 lines =@@ + } + + var c = new C(); // error C is private +->c : any +->new C() : any ++>c : C ++>new C() : C + >C : typeof C + + var r: () => void = c.constructor; + >r : () => void +->c.constructor : any +->c : any +->constructor : any ++>c.constructor : Function ++>c : C ++>constructor : Function + + class C2 { + >C2 : C2 +@@= skipped -21, +21 lines =@@ + } + + var c2 = new C2(); // error C2 is private +->c2 : any +->new C2() : any ++>c2 : C2 ++>new C2() : C2 + >C2 : typeof C2 + + var r2: (x: number) => void = c2.constructor; + >r2 : (x: number) => void + >x : number +->c2.constructor : any +->c2 : any +->constructor : any ++>c2.constructor : Function ++>c2 : C2 ++>constructor : Function diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt index 77a5a313eb3..a76f1d19d29 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt @@ -1,8 +1,12 @@ typesWithProtectedConstructor.ts(5,9): error TS2674: Constructor of class 'C' is protected and only accessible within the class declaration. +typesWithProtectedConstructor.ts(6,5): error TS2322: Type 'Function' is not assignable to type '() => void'. + Type 'Function' provides no match for the signature '(): void'. typesWithProtectedConstructor.ts(13,10): error TS2674: Constructor of class 'C2' is protected and only accessible within the class declaration. +typesWithProtectedConstructor.ts(14,5): error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. + Type 'Function' provides no match for the signature '(x: number): void'. -==== typesWithProtectedConstructor.ts (2 errors) ==== +==== typesWithProtectedConstructor.ts (4 errors) ==== class C { protected constructor() { } } @@ -11,6 +15,9 @@ typesWithProtectedConstructor.ts(13,10): error TS2674: Constructor of class 'C2' ~~~~~~~ !!! error TS2674: Constructor of class 'C' is protected and only accessible within the class declaration. var r: () => void = c.constructor; + ~ +!!! error TS2322: Type 'Function' is not assignable to type '() => void'. +!!! error TS2322: Type 'Function' provides no match for the signature '(): void'. class C2 { protected constructor(x: number); @@ -20,4 +27,7 @@ typesWithProtectedConstructor.ts(13,10): error TS2674: Constructor of class 'C2' var c2 = new C2(); // error C2 is protected ~~~~~~~~ !!! error TS2674: Constructor of class 'C2' is protected and only accessible within the class declaration. - var r2: (x: number) => void = c2.constructor; \ No newline at end of file + var r2: (x: number) => void = c2.constructor; + ~~ +!!! error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. +!!! error TS2322: Type 'Function' provides no match for the signature '(x: number): void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt.diff new file mode 100644 index 00000000000..cf1b3e773c5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.errors.txt.diff @@ -0,0 +1,35 @@ +--- old.typesWithProtectedConstructor.errors.txt ++++ new.typesWithProtectedConstructor.errors.txt +@@= skipped -0, +0 lines =@@ + typesWithProtectedConstructor.ts(5,9): error TS2674: Constructor of class 'C' is protected and only accessible within the class declaration. ++typesWithProtectedConstructor.ts(6,5): error TS2322: Type 'Function' is not assignable to type '() => void'. ++ Type 'Function' provides no match for the signature '(): void'. + typesWithProtectedConstructor.ts(13,10): error TS2674: Constructor of class 'C2' is protected and only accessible within the class declaration. +- +- +-==== typesWithProtectedConstructor.ts (2 errors) ==== ++typesWithProtectedConstructor.ts(14,5): error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. ++ Type 'Function' provides no match for the signature '(x: number): void'. ++ ++ ++==== typesWithProtectedConstructor.ts (4 errors) ==== + class C { + protected constructor() { } + } +@@= skipped -10, +14 lines =@@ + ~~~~~~~ + !!! error TS2674: Constructor of class 'C' is protected and only accessible within the class declaration. + var r: () => void = c.constructor; ++ ~ ++!!! error TS2322: Type 'Function' is not assignable to type '() => void'. ++!!! error TS2322: Type 'Function' provides no match for the signature '(): void'. + + class C2 { + protected constructor(x: number); +@@= skipped -10, +13 lines =@@ + ~~~~~~~~ + !!! error TS2674: Constructor of class 'C2' is protected and only accessible within the class declaration. + var r2: (x: number) => void = c2.constructor; ++ ~~ ++!!! error TS2322: Type 'Function' is not assignable to type '(x: number) => void'. ++!!! error TS2322: Type 'Function' provides no match for the signature '(x: number): void'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js index 5844039774e..02f755bcd63 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js @@ -33,10 +33,10 @@ var r2 = c2.constructor; declare class C { protected constructor(); } -declare var c: any; +declare var c: C; declare var r: () => void; declare class C2 { protected constructor(x: number); } -declare var c2: any; +declare var c2: C2; declare var r2: (x: number) => void; diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js.diff b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js.diff new file mode 100644 index 00000000000..79b5c55e47d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.js.diff @@ -0,0 +1,15 @@ +--- old.typesWithProtectedConstructor.js ++++ new.typesWithProtectedConstructor.js +@@= skipped -32, +32 lines =@@ + declare class C { + protected constructor(); + } +-declare var c: any; ++declare var c: C; + declare var r: () => void; + declare class C2 { + protected constructor(x: number); + } +-declare var c2: any; ++declare var c2: C2; + declare var r2: (x: number) => void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols index 3686bb613cf..a2fc591082f 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols @@ -13,7 +13,9 @@ var c = new C(); // error C is protected var r: () => void = c.constructor; >r : Symbol(r, Decl(typesWithProtectedConstructor.ts, 5, 3)) +>c.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >c : Symbol(c, Decl(typesWithProtectedConstructor.ts, 4, 3)) +>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) class C2 { >C2 : Symbol(C2, Decl(typesWithProtectedConstructor.ts, 5, 34)) @@ -32,5 +34,7 @@ var c2 = new C2(); // error C2 is protected var r2: (x: number) => void = c2.constructor; >r2 : Symbol(r2, Decl(typesWithProtectedConstructor.ts, 13, 3)) >x : Symbol(x, Decl(typesWithProtectedConstructor.ts, 13, 9)) +>c2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) >c2 : Symbol(c2, Decl(typesWithProtectedConstructor.ts, 12, 3)) +>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols.diff b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols.diff new file mode 100644 index 00000000000..a60cfffa886 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.symbols.diff @@ -0,0 +1,19 @@ +--- old.typesWithProtectedConstructor.symbols ++++ new.typesWithProtectedConstructor.symbols +@@= skipped -12, +12 lines =@@ + + var r: () => void = c.constructor; + >r : Symbol(r, Decl(typesWithProtectedConstructor.ts, 5, 3)) ++>c.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) + >c : Symbol(c, Decl(typesWithProtectedConstructor.ts, 4, 3)) ++>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) + + class C2 { + >C2 : Symbol(C2, Decl(typesWithProtectedConstructor.ts, 5, 34)) +@@= skipped -19, +21 lines =@@ + var r2: (x: number) => void = c2.constructor; + >r2 : Symbol(r2, Decl(typesWithProtectedConstructor.ts, 13, 3)) + >x : Symbol(x, Decl(typesWithProtectedConstructor.ts, 13, 9)) ++>c2.constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) + >c2 : Symbol(c2, Decl(typesWithProtectedConstructor.ts, 12, 3)) ++>constructor : Symbol(Object.constructor, Decl(lib.es5.d.ts, --, --)) diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types index 99a4168b2f1..86a79a727c4 100644 --- a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types @@ -8,15 +8,15 @@ class C { } var c = new C(); // error C is protected ->c : any ->new C() : any +>c : C +>new C() : C >C : typeof C var r: () => void = c.constructor; >r : () => void ->c.constructor : any ->c : any ->constructor : any +>c.constructor : Function +>c : C +>constructor : Function class C2 { >C2 : C2 @@ -29,14 +29,14 @@ class C2 { } var c2 = new C2(); // error C2 is protected ->c2 : any ->new C2() : any +>c2 : C2 +>new C2() : C2 >C2 : typeof C2 var r2: (x: number) => void = c2.constructor; >r2 : (x: number) => void >x : number ->c2.constructor : any ->c2 : any ->constructor : any +>c2.constructor : Function +>c2 : C2 +>constructor : Function diff --git a/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types.diff b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types.diff new file mode 100644 index 00000000000..593d417bd76 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typesWithProtectedConstructor.types.diff @@ -0,0 +1,42 @@ +--- old.typesWithProtectedConstructor.types ++++ new.typesWithProtectedConstructor.types +@@= skipped -7, +7 lines =@@ + } + + var c = new C(); // error C is protected +->c : any +->new C() : any ++>c : C ++>new C() : C + >C : typeof C + + var r: () => void = c.constructor; + >r : () => void +->c.constructor : any +->c : any +->constructor : any ++>c.constructor : Function ++>c : C ++>constructor : Function + + class C2 { + >C2 : C2 +@@= skipped -21, +21 lines =@@ + } + + var c2 = new C2(); // error C2 is protected +->c2 : any +->new C2() : any ++>c2 : C2 ++>new C2() : C2 + >C2 : typeof C2 + + var r2: (x: number) => void = c2.constructor; + >r2 : (x: number) => void + >x : number +->c2.constructor : any +->c2 : any +->constructor : any ++>c2.constructor : Function ++>c2 : C2 ++>constructor : Function diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols index b961f39a840..f29e0d0485e 100644 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols +++ b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols @@ -36,7 +36,7 @@ import type { funciton as funciton2 } from "./decl"; // ok I guess? >funciton2 : Symbol(funciton2, Decl(main.ts, 3, 13)) import("./decl"); // error ->"./decl" : Symbol(esmy2, Decl(decl.d.ts, 0, 0)) +>"./decl" : Symbol("/decl", Decl(decl.d.ts, 0, 0)) type T = typeof import("./decl"); // ok >T : Symbol(T, Decl(main.ts, 4, 17)) diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff index b681206bf8f..23c7dd49db3 100644 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff @@ -8,9 +8,4 @@ +>funciton : Symbol(funciton, Decl(decl.d.ts, 1, 20)) >funciton2 : Symbol(funciton2, Decl(main.ts, 3, 13)) - import("./decl"); // error -->"./decl" : Symbol("/decl", Decl(decl.d.ts, 0, 0)) -+>"./decl" : Symbol(esmy2, Decl(decl.d.ts, 0, 0)) - - type T = typeof import("./decl"); // ok - >T : Symbol(T, Decl(main.ts, 4, 17)) \ No newline at end of file + import("./decl"); // error \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types index 25286bf5e41..cc0780ce99f 100644 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types +++ b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types @@ -36,11 +36,11 @@ import type { funciton as funciton2 } from "./decl"; // ok I guess? >funciton2 : any import("./decl"); // error ->import("./decl") : Promise +>import("./decl") : Promise >"./decl" : "./decl" type T = typeof import("./decl"); // ok ->T : typeof esmy2 +>T : typeof import("/decl") export {}; // error export const x = 1; // error @@ -49,7 +49,7 @@ export const x = 1; // error export interface I {} // ok export type { T }; // ok ->T : typeof esmy2 +>T : typeof import("/decl") export namespace JustTypes { export type T = number; diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types.diff deleted file mode 100644 index 3af74f3d2fa..00000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.verbatimModuleSyntaxRestrictionsCJS.types -+++ new.verbatimModuleSyntaxRestrictionsCJS.types -@@= skipped -35, +35 lines =@@ - >funciton2 : any - - import("./decl"); // error -->import("./decl") : Promise -+>import("./decl") : Promise - >"./decl" : "./decl" - - type T = typeof import("./decl"); // ok -->T : typeof import("/decl") -+>T : typeof esmy2 - - export {}; // error - export const x = 1; // error -@@= skipped -13, +13 lines =@@ - - export interface I {} // ok - export type { T }; // ok -->T : typeof import("/decl") -+>T : typeof esmy2 - - export namespace JustTypes { - export type T = number; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.errors.txt.diff deleted file mode 100644 index f01a9dd5b2a..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.esmModuleExports1.errors.txt -+++ new.esmModuleExports1.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(8,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - --==== /importer-cjs.cjs (0 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); -+ ~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (1 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); -+ ~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; - new Foo2(); - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); -+ ~~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.types.diff deleted file mode 100644 index 910ac40e241..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.types.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.esmModuleExports1.types -+++ new.esmModuleExports1.types -@@= skipped -2, +2 lines =@@ - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); - >Foo : typeof Foo -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - === /importer-cts.cts === -@@= skipped -13, +13 lines =@@ - >Foo : typeof Foo - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : typeof Foo -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : Foo -->Foo2 : typeof Foo -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; - >Foo3 : typeof Foo - - new Foo3(); -->new Foo3() : Foo -+>new Foo3() : any - >Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt.diff deleted file mode 100644 index c7302644be9..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=false).errors.txt -+++ new.esmModuleExports2(esmoduleinterop=false).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. --/importer-cts.cts(4,8): error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(8,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (4 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; -- ~~~~ --!!! error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag - new Foo2(); - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); - ~~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).types.diff deleted file mode 100644 index 36b987f2d26..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).types.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=false).types -+++ new.esmModuleExports2(esmoduleinterop=false).types -@@= skipped -1, +1 lines =@@ - - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); -->Foo : "oops" -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>Foo : typeof Foo -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - === /importer-cts.cts === - import Foo = require("./exporter.mjs"); -->Foo : "oops" -+>Foo : typeof Foo - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : any -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : any -->Foo2 : any -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; -->Foo3 : "oops" -+>Foo3 : typeof Foo - - new Foo3(); - >new Foo3() : any -->Foo3 : "oops" -+>Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; - >Oops : any \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt.diff deleted file mode 100644 index 78bdac8da53..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=true).errors.txt -+++ new.esmModuleExports2(esmoduleinterop=true).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. --/importer-cts.cts(5,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(8,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (4 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; - new Foo2(); -- ~~~~ --!!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); - ~~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).types.diff deleted file mode 100644 index be30f1ca4a8..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).types.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=true).types -+++ new.esmModuleExports2(esmoduleinterop=true).types -@@= skipped -1, +1 lines =@@ - - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); -->Foo : "oops" -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>Foo : typeof Foo -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - === /importer-cts.cts === - import Foo = require("./exporter.mjs"); -->Foo : "oops" -+>Foo : typeof Foo - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : "oops" -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : any -->Foo2 : "oops" -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; -->Foo3 : "oops" -+>Foo3 : typeof Foo - - new Foo3(); - >new Foo3() : any -->Foo3 : "oops" -+>Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; - >Oops : any \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.errors.txt.diff deleted file mode 100644 index c720e9cad5f..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.errors.txt.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.esmModuleExports3.errors.txt -+++ new.esmModuleExports3.errors.txt -@@= skipped -0, +0 lines =@@ --/importer-cjs.cjs(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --/importer-cts.cts(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --/importer-cts.cts(5,5): error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. --/importer-cts.cts(8,5): error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(8,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); - ~~~ --!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (4 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); - ~~~ --!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; - new Foo2(); -- ~~~~ --!!! error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo2' was exported here. - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); - ~~~~ --!!! error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo3' was exported here. -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.types.diff deleted file mode 100644 index 8a8247ef985..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.types.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.esmModuleExports3.types -+++ new.esmModuleExports3.types -@@= skipped -2, +2 lines =@@ - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); - >Foo : typeof Foo -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - === /importer-cts.cts === -@@= skipped -13, +13 lines =@@ - >Foo : typeof Foo - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : typeof Foo -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : Foo -->Foo2 : typeof Foo -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; - >Foo3 : typeof Foo - - new Foo3(); -->new Foo3() : Foo -+>new Foo3() : any - >Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff index 806389ea073..7b97f306cc6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff @@ -1,16 +1,12 @@ --- old.nodeAllowJsPackageSelfName(module=node20).errors.txt +++ new.nodeAllowJsPackageSelfName(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -- -- +index.cjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.js(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.mjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (0 errors) ==== - // esm format file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node16).types.diff deleted file mode 100644 index 5a104315ec3..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node16).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node16).types -+++ new.nodeModulesAllowJs1(module=node16).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff deleted file mode 100644 index 53da4828c6b..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node18).types -+++ new.nodeModulesAllowJs1(module=node18).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).errors.txt.diff deleted file mode 100644 index a9f0e9934d3..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).errors.txt.diff +++ /dev/null @@ -1,398 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node20).errors.txt -+++ new.nodeModulesAllowJs1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -8, +10 lines =@@ - index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+index.cjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -33, +22 lines =@@ - index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+index.js(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -33, +22 lines =@@ - index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -- -- -+index.mjs(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== subfolder/index.js (0 errors) ==== - // cjs format file - const x = 1; -@@= skipped -49, +51 lines =@@ - // esm format file - const x = 1; - export {x}; --==== index.js (33 errors) ==== -+==== index.js (22 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -15, +15 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -104, +82 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // esm format file - const x = 1; - export {x}; -@@= skipped -133, +133 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // cjs format file - const x = 1; - export {x}; --==== index.mjs (33 errors) ==== -+==== index.mjs (22 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -50, +50 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -104, +82 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - // esm format file - const x = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).types.diff deleted file mode 100644 index 9e089d18198..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).types.diff +++ /dev/null @@ -1,587 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node20).types -+++ new.nodeModulesAllowJs1(module=node20).types -@@= skipped -119, +119 lines =@@ - - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file -@@= skipped -306, +306 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // cjs format file -@@= skipped -101, +101 lines =@@ - - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).types.diff deleted file mode 100644 index 5c5a7e7e7e2..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModulesAllowJs1(module=nodenext).types -+++ new.nodeModulesAllowJs1(module=nodenext).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff index a866888d64e..a627b9e85e8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff @@ -2,11 +2,9 @@ +++ new.nodeModulesAllowJsCjsFromJs(module=node20).errors.txt @@= skipped -0, +0 lines =@@ - -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? + + -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== foo.cjs (0 errors) ==== + exports.foo = "foo" +==== bar.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index e08d1da38d4..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (2 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff deleted file mode 100644 index 2dffe05f691..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 1dc19bd5b1f..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (2 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff deleted file mode 100644 index d7b146de5db..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index e2024280774..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,192 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.cjs(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.js(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.js(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.js(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (0 errors) ==== -+==== index.js (7 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+ import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+==== index.mjs (4 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; -@@= skipped -67, +124 lines =@@ - ==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -10, +10 lines =@@ - export { type }; - export { ts }; - export const mjsSource = true; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff deleted file mode 100644 index 3bda3207a58..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff +++ /dev/null @@ -1,264 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -+>cjsi.mjsSource : any - >cjsi : typeof cjsi -->mjsSource : true -+>mjsSource : any - - mjsi.mjsSource; -->mjsi.mjsSource : true -->mjsi : typeof cjsi -->mjsSource : true -+>mjsi.mjsSource : any -+>mjsi : any -+>mjsSource : any - - typei.mjsSource; -->typei.mjsSource : true -->typei : typeof cjsi -->mjsSource : true -+>typei.mjsSource : any -+>typei : any -+>mjsSource : any - - ts.mjsSource; -->ts.mjsSource : true -+>ts.mjsSource : any - >ts : typeof cjsi -->mjsSource : true -+>mjsSource : any - - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; -->cjsi : typeof cjsi -+>cjsi : any - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : typeof mjsi - - import * as ts from "inner/types"; -->ts : typeof cjsi -+>ts : typeof mjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -->cjsi : typeof cjsi -->mjsSource : true -+>cjsi.mjsSource : any -+>cjsi : any -+>mjsSource : any - - mjsi.mjsSource; - >mjsi.mjsSource : true -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - >mjsSource : true - - typei.mjsSource; - >typei.mjsSource : true -->typei : typeof cjsi -+>typei : typeof mjsi - >mjsSource : true - - ts.mjsSource; - >ts.mjsSource : true -->ts : typeof cjsi -+>ts : typeof mjsi - >mjsSource : true - - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -139, +139 lines =@@ - >cjsSource : true - - mjsi.cjsSource; -->mjsi.cjsSource : true -->mjsi : typeof cjsi -->cjsSource : true -+>mjsi.cjsSource : any -+>mjsi : any -+>cjsSource : any - - typei.implicitCjsSource; -->typei.implicitCjsSource : true -->typei : typeof cjsi.type -->implicitCjsSource : true -+>typei.implicitCjsSource : any -+>typei : any -+>implicitCjsSource : any - - ts.cjsSource; - >ts.cjsSource : true -@@= skipped -17, +17 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "inner"; -->type : typeof mjs.type -+>type : any - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : any - - export { type }; -->type : typeof mjs.type -+>type : any - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -63, +63 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof cjs -+>mjs : any - - import * as type from "inner"; -->type : typeof cjs.type -+>type : any - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs -+>mjs : any - - export { type }; -->type : typeof cjs.type -+>type : any - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 2ef14964d21..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -51, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff deleted file mode 100644 index 68322d3ac2e..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt.diff deleted file mode 100644 index b4effb63a55..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.nodeModulesAllowJsDynamicImport(module=node20).errors.txt -+++ new.nodeModulesAllowJsDynamicImport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.js (1 errors) ==== -+ // cjs format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== index.js (1 errors) ==== -+ // esm format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff index 0ddbd3ec8e6..4132764be76 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff @@ -2,37 +2,18 @@ +++ new.nodeModulesAllowJsExportAssignment(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. --index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ++file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (1 errors) ==== - // cjs format file - const a = {}; -@@= skipped -13, +13 lines =@@ - // cjs format file - const a = {}; - module.exports = a; --==== index.js (2 errors) ==== -+==== index.js (1 errors) ==== - // esm format file - const a = {}; - export = a; - ~~~~~~~~~~~ --!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -- ~~~~~~~~~~~ - !!! error TS8003: 'export =' can only be used in TypeScript files. --==== file.js (1 errors) ==== -+==== file.js (0 errors) ==== - // esm format file +@@= skipped -26, +26 lines =@@ import "fs"; const a = {}; module.exports = a; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt.diff deleted file mode 100644 index 457ef0f8c8d..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt -+++ new.nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== foo.cjs (0 errors) ==== -+ // this file is a module despite having no imports -+==== bar.js (0 errors) ==== -+ // however this file is _not_ a module \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff index 6f6deff5c88..b45c36835f6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff @@ -1,10 +1,6 @@ --- old.nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt +++ new.nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -subfolder/index.js(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. @@ -12,12 +8,11 @@ -==== subfolder/index.js (4 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== subfolder/index.js (3 errors) ==== // cjs format file function require() {} ~~~~~~~ -@@= skipped -12, +16 lines =@@ +@@= skipped -12, +11 lines =@@ ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} @@ -25,21 +20,4 @@ -!!! error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. export const __esModule = false; ~~~~~~~~~~ - !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; --==== index.js (0 errors) ==== -+==== index.js (3 errors) ==== - // esm format file - function require() {} -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - const exports = {}; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - class Object {} - export const __esModule = false; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; - ==== package.json (0 errors) ==== - { \ No newline at end of file + !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt.diff deleted file mode 100644 index cacb6ea95ab..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesAllowJsImportAssignment(module=node20).errors.txt -+++ new.nodeModulesAllowJsImportAssignment(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - file.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. - file.js(6,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -5, +6 lines =@@ - subfolder/index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (2 errors) ==== - // cjs format file - import fs = require("fs"); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff index 8735318e097..f6fae83200c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff @@ -6,19 +6,35 @@ - - -==== subfolder/index.js (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.js (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; +- // cjs format file +- import {default as _fs} from "fs"; - ~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - _fs.readFile; - import * as fs from "fs"; +- _fs.readFile; +- import * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - fs.readFile; - ==== index.js (0 errors) ==== - // esm format file \ No newline at end of file +- fs.readFile; +-==== index.js (0 errors) ==== +- // esm format file +- import {default as _fs} from "fs"; +- _fs.readFile; +- import * as fs from "fs"; +- fs.readFile; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff index d227545c64d..555476b0543 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff @@ -6,18 +6,31 @@ - - -==== subfolder/index.ts (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; +- // cjs format file +- export * from "fs"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - export * as fs from "fs"; +- export * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - ==== index.js (0 errors) ==== - // esm format file - export * from "fs"; \ No newline at end of file +-==== index.js (0 errors) ==== +- // esm format file +- export * from "fs"; +- export * as fs from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff index dadedfa87a1..c1e1af6d7ce 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff @@ -5,15 +5,31 @@ - - -==== subfolder/index.js (1 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.js (0 errors) ==== - // cjs format file - export {default} from "fs"; +- // cjs format file +- export {default} from "fs"; - ~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - export {default as foo} from "fs"; - export {bar as baz} from "fs"; - ==== index.js (0 errors) ==== \ No newline at end of file +- export {default as foo} from "fs"; +- export {bar as baz} from "fs"; +-==== index.js (0 errors) ==== +- // esm format file +- export {default} from "fs"; +- export {default as foo} from "fs"; +- export {bar as baz} from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt.diff deleted file mode 100644 index 2c508c1be79..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesAllowJsImportMeta(module=node20).errors.txt -+++ new.nodeModulesAllowJsImportMeta(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (1 errors) ==== - // cjs format file - const x = import.meta.url; - ~~~~~~~~~~~ - !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; --==== index.js (0 errors) ==== -+==== index.js (1 errors) ==== - // esm format file - const x = import.meta.url; -+ ~~~~~~~~~~~ -+!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; - ==== package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index e593bff0b76..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff deleted file mode 100644 index fef834137b1..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).types -+++ new.nodeModulesAllowJsPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 7df9bf176f2..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff deleted file mode 100644 index 0cb07ae47ee..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).types -+++ new.nodeModulesAllowJsPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index 813ea4bbc69..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +72 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff deleted file mode 100644 index 9a046a7cc50..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).types -+++ new.nodeModulesAllowJsPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index c15c3e629d5..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +70 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff deleted file mode 100644 index 9090c961285..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).types -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff index d9a3fd70380..51da4daa1b7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff @@ -1,10 +1,7 @@ --- old.nodeModulesAllowJsPackageImports(module=node20).errors.txt +++ new.nodeModulesAllowJsPackageImports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -- -- +index.cjs(2,22): error TS2307: Cannot find module '#cjs' or its corresponding type declarations. +index.cjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding type declarations. +index.cjs(4,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. @@ -14,9 +11,8 @@ +index.mjs(2,22): error TS2307: Cannot find module '#cjs' or its corresponding type declarations. +index.mjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding type declarations. +index.mjs(4,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + !!! error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (0 errors) ==== - // esm format file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff deleted file mode 100644 index d8edc7785a2..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff deleted file mode 100644 index f588eaafe5a..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff deleted file mode 100644 index d3235546df4..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff deleted file mode 100644 index 86cb0215d75..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff deleted file mode 100644 index 69acc68c628..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff deleted file mode 100644 index c71f993ccd3..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff deleted file mode 100644 index b07ff1defa5..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff deleted file mode 100644 index dfcec69d5b7..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt.diff deleted file mode 100644 index 359f8ed9a2c..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.cjs(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.cjs(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.cjs(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -17, +18 lines =@@ - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (3 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/exclude/index"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff deleted file mode 100644 index 318d7c9f6c4..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff deleted file mode 100644 index 8e657345b44..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff deleted file mode 100644 index 6e005d3729a..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff deleted file mode 100644 index 9ef7fde6330..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff deleted file mode 100644 index 4816e4b1ba1..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff deleted file mode 100644 index 1dcb5390997..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff deleted file mode 100644 index d8a2e4916cd..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff deleted file mode 100644 index 32aa1769033..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt.diff deleted file mode 100644 index a2dd4148f94..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt -+++ new.nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -+index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - subfolder/index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. - subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -- -- --==== subfolder/index.js (2 errors) ==== -+subfolder/index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.js (5 errors) ==== - // cjs format file - import {h} from "../index.js"; - import mod = require("../index.js"); -@@= skipped -14, +24 lines =@@ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS8002: 'import ... =' can only be used in TypeScript files. - export async function f() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("../index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - h(); - } --==== index.js (2 errors) ==== -+==== index.js (5 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); -@@= skipped -15, +21 lines =@@ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS8002: 'import ... =' can only be used in TypeScript files. - export async function h() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./subfolder/index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - f(); - } - ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types.diff deleted file mode 100644 index 3e4d28f7eff..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesAllowJsSynchronousCallErrors(module=node20).types -+++ new.nodeModulesAllowJsSynchronousCallErrors(module=node20).types -@@= skipped -18, +18 lines =@@ - >f : () => Promise - - const mod3 = await import ("../index.js"); -->mod3 : typeof mod -->await import ("../index.js") : typeof mod -->import ("../index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("../index.js") : { h(): Promise; default: typeof mod; } -+>import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -@@= skipped -34, +34 lines =@@ - >h : () => Promise - - const mod3 = await import ("./index.js"); -->mod3 : typeof mod -->await import ("./index.js") : typeof mod -->import ("./index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("./index.js") : { h(): Promise; default: typeof mod; } -+>import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt.diff deleted file mode 100644 index 42ebe781694..00000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt -+++ new.nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (2 errors) ==== - // cjs format file - const x = await 1; - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --==== index.js (0 errors) ==== -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+==== index.js (2 errors) ==== - // esm format file - const x = await 1; -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} -+ ~~~~~ -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff index 4c3562dec9f..6e13ad03cb9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff @@ -2,15 +2,11 @@ +++ new.nodeModulesCJSEmit1(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -/3.cjs(2,1): error TS2304: Cannot find name 'exports'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /1.cjs (0 errors) ==== - module.exports = {}; - +@@= skipped -7, +7 lines =@@ ==== /2.cjs (0 errors) ==== exports.foo = 0; diff --git a/testdata/tests/cases/compiler/blockedScopeVariableNotUnused1.ts b/testdata/tests/cases/compiler/blockedScopeVariableNotUnused1.ts new file mode 100644 index 00000000000..e0598e702fa --- /dev/null +++ b/testdata/tests/cases/compiler/blockedScopeVariableNotUnused1.ts @@ -0,0 +1,9 @@ +// @strict: true + +export function foo() { + const _fn = () => { + ;(() => numFilesSelected)() + } + + const numFilesSelected = 1 +} diff --git a/testdata/tests/cases/compiler/declarationEmitExpandoFunction.ts b/testdata/tests/cases/compiler/declarationEmitExpandoFunction.ts new file mode 100644 index 00000000000..607d1162957 --- /dev/null +++ b/testdata/tests/cases/compiler/declarationEmitExpandoFunction.ts @@ -0,0 +1,18 @@ +// @declaration: true + +export function A() { + return 'A'; +} + +export function B() { + return 'B'; +} + +export enum C { + C +} + +A.a = C; +A.b = C; + +B.c = C;