diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 8b86d9e66a..88b4ab1c1d 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -9985,6 +9985,11 @@ type CheckJsDirective struct { Range CommentRange } +type HasFileName interface { + FileName() string + Path() tspath.Path +} + type SourceFile struct { NodeBase DeclarationBase diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 9ef4bf89f4..00a0fe4793 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -2414,15 +2414,15 @@ func GetImpliedNodeFormatForFile(path string, packageJsonType string) core.Modul return impliedNodeFormat } -func GetEmitModuleFormatOfFileWorker(sourceFile *SourceFile, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ModuleKind { - result := GetImpliedNodeFormatForEmitWorker(sourceFile.FileName(), options, sourceFileMetaData) +func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ModuleKind { + result := GetImpliedNodeFormatForEmitWorker(fileName, options, sourceFileMetaData) if result != core.ModuleKindNone { return result } return options.GetEmitModuleKind() } -func GetImpliedNodeFormatForEmitWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ModuleKind { +func GetImpliedNodeFormatForEmitWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ResolutionMode { moduleKind := options.GetEmitModuleKind() if core.ModuleKindNode16 <= moduleKind && moduleKind <= core.ModuleKindNodeNext { if sourceFileMetaData == nil { @@ -3390,6 +3390,14 @@ func IsRightSideOfQualifiedNameOrPropertyAccess(node *Node) bool { return false } +func ShouldTransformImportCall(fileName string, options *core.CompilerOptions, impliedNodeFormatForEmit core.ModuleKind) bool { + moduleKind := options.GetEmitModuleKind() + if core.ModuleKindNode16 <= moduleKind && moduleKind <= core.ModuleKindNodeNext || moduleKind == core.ModuleKindPreserve { + return false + } + return impliedNodeFormatForEmit < core.ModuleKindES2015 +} + func HasQuestionToken(node *Node) bool { switch node.Kind { case KindParameter: diff --git a/internal/checker/checker.go b/internal/checker/checker.go index e81a57a839..ea3f621a9a 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -527,14 +527,13 @@ type Program interface { BindSourceFiles() FileExists(fileName string) bool GetSourceFile(fileName string) *ast.SourceFile - GetEmitModuleFormatOfFile(sourceFile *ast.SourceFile) core.ModuleKind - GetImpliedNodeFormatForEmit(sourceFile *ast.SourceFile) core.ModuleKind - GetResolvedModule(currentSourceFile *ast.SourceFile, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule + GetEmitModuleFormatOfFile(sourceFile ast.HasFileName) core.ModuleKind + GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ModuleKind + GetResolvedModule(currentSourceFile ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule GetResolvedModules() map[tspath.Path]module.ModeAwareCache[*module.ResolvedModule] GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData GetJSXRuntimeImportSpecifier(path tspath.Path) (moduleReference string, specifier *ast.Node) GetImportHelpersImportSpecifier(path tspath.Path) *ast.Node - GetModeForUsageLocation(sourceFile *ast.SourceFile, location *ast.Node) core.ResolutionMode } type Host interface { @@ -14381,7 +14380,7 @@ func (c *Checker) resolveExternalModule(location *ast.Node, moduleReference stri var sourceFile *ast.SourceFile resolvedModule := c.program.GetResolvedModule(importingSourceFile, moduleReference, mode) - if resolvedModule != nil && resolvedModule.IsResolved() { + if resolvedModule.IsResolved() { sourceFile = c.program.GetSourceFile(resolvedModule.ResolvedFileName) } @@ -14473,7 +14472,7 @@ func (c *Checker) resolveExternalModule(location *ast.Node, moduleReference stri return nil } - if resolvedModule != nil && resolvedModule.IsResolved() && !(tspath.ExtensionIsTs(resolvedModule.Extension) || resolvedModule.Extension == tspath.ExtensionJson) { + if resolvedModule.IsResolved() && !(tspath.ExtensionIsTs(resolvedModule.Extension) || resolvedModule.Extension == tspath.ExtensionJson) { if isForAugmentation { c.error( errorNode, diff --git a/internal/compiler/emitHost.go b/internal/compiler/emitHost.go index af34c664a7..bceaae4ac5 100644 --- a/internal/compiler/emitHost.go +++ b/internal/compiler/emitHost.go @@ -5,7 +5,9 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/modulespecifiers" + "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/transformers/declarations" "github.com/microsoft/typescript-go/internal/tspath" @@ -29,7 +31,6 @@ type EmitHost interface { GetCurrentDirectory() string CommonSourceDirectory() string IsEmitBlocked(file string) bool - GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData GetEmitResolver(file *ast.SourceFile, skipDiagnostics bool) printer.EmitResolver } @@ -40,10 +41,22 @@ type emitHost struct { program *Program } -func (host *emitHost) GetDefaultResolutionModeForFile(file modulespecifiers.SourceFileForSpecifierGeneration) core.ResolutionMode { +func (host *emitHost) GetModeForUsageLocation(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) core.ResolutionMode { + return host.program.GetModeForUsageLocation(file, moduleSpecifier) +} + +func (host *emitHost) GetResolvedModuleFromModuleSpecifier(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) *module.ResolvedModule { + return host.program.GetResolvedModuleFromModuleSpecifier(file, moduleSpecifier) +} + +func (host *emitHost) GetDefaultResolutionModeForFile(file ast.HasFileName) core.ResolutionMode { return host.program.GetDefaultResolutionModeForFile(file) } +func (host *emitHost) GetEmitModuleFormatOfFile(file ast.HasFileName) core.ModuleKind { + return host.program.GetEmitModuleFormatOfFile(file) +} + func (host *emitHost) FileExists(path string) bool { return host.program.FileExists(path) } @@ -78,7 +91,7 @@ func (host *emitHost) GetEffectiveDeclarationFlags(node *ast.Node, flags ast.Mod func (host *emitHost) GetOutputPathsFor(file *ast.SourceFile, forceDtsPaths bool) declarations.OutputPaths { // TODO: cache - return getOutputPathsFor(file, host, forceDtsPaths) + return outputpaths.GetOutputPathsFor(file, host.Options(), host, forceDtsPaths) } func (host *emitHost) GetResolutionModeOverride(node *ast.Node) core.ResolutionMode { @@ -114,7 +127,3 @@ func (host *emitHost) GetEmitResolver(file *ast.SourceFile, skipDiagnostics bool defer done() return checker.GetEmitResolver(file, skipDiagnostics) } - -func (host *emitHost) GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData { - return host.program.GetSourceFileMetaData(path) -} diff --git a/internal/compiler/emitter.go b/internal/compiler/emitter.go index 75d581809e..1eb27b621c 100644 --- a/internal/compiler/emitter.go +++ b/internal/compiler/emitter.go @@ -7,6 +7,7 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" + "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/sourcemap" "github.com/microsoft/typescript-go/internal/stringutil" @@ -32,15 +33,15 @@ type emitter struct { emitSkipped bool sourceMapDataList []*SourceMapEmitResult writer printer.EmitTextWriter - paths *outputPaths + paths *outputpaths.OutputPaths sourceFile *ast.SourceFile } func (e *emitter) emit() { // !!! tracing - e.emitJSFile(e.sourceFile, e.paths.jsFilePath, e.paths.sourceMapFilePath) - e.emitDeclarationFile(e.sourceFile, e.paths.declarationFilePath, e.paths.declarationMapPath) - e.emitBuildInfo(e.paths.buildInfoPath) + e.emitJSFile(e.sourceFile, e.paths.JsFilePath(), e.paths.SourceMapFilePath()) + e.emitDeclarationFile(e.sourceFile, e.paths.DeclarationFilePath(), e.paths.DeclarationMapPath()) + e.emitBuildInfo(e.paths.BuildInfoPath()) } func (e *emitter) getDeclarationTransformers(emitContext *printer.EmitContext, sourceFile *ast.SourceFile, declarationFilePath string, declarationMapPath string) []*declarations.DeclarationTransformer { @@ -207,44 +208,6 @@ func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, s return !data.SkippedDtsWrite } -func getSourceFilePathInNewDir(fileName string, newDirPath string, currentDirectory string, commonSourceDirectory string, useCaseSensitiveFileNames bool) string { - sourceFilePath := tspath.GetNormalizedAbsolutePath(fileName, currentDirectory) - commonSourceDirectory = tspath.EnsureTrailingDirectorySeparator(commonSourceDirectory) - isSourceFileInCommonSourceDirectory := tspath.ContainsPath(commonSourceDirectory, sourceFilePath, tspath.ComparePathsOptions{ - UseCaseSensitiveFileNames: useCaseSensitiveFileNames, - CurrentDirectory: currentDirectory, - }) - if isSourceFileInCommonSourceDirectory { - sourceFilePath = sourceFilePath[len(commonSourceDirectory):] - } - return tspath.CombinePaths(newDirPath, sourceFilePath) -} - -func getOwnEmitOutputFilePath(fileName string, host printer.EmitHost, extension string) string { - compilerOptions := host.Options() - var emitOutputFilePathWithoutExtension string - if len(compilerOptions.OutDir) > 0 { - currentDirectory := host.GetCurrentDirectory() - emitOutputFilePathWithoutExtension = tspath.RemoveFileExtension(getSourceFilePathInNewDir( - fileName, - compilerOptions.OutDir, - currentDirectory, - host.CommonSourceDirectory(), - host.UseCaseSensitiveFileNames(), - )) - } else { - emitOutputFilePathWithoutExtension = tspath.RemoveFileExtension(fileName) - } - return emitOutputFilePathWithoutExtension + extension -} - -func getSourceMapFilePath(jsFilePath string, options *core.CompilerOptions) string { - if options.SourceMap.IsTrue() && !options.InlineSourceMap.IsTrue() { - return jsFilePath + ".map" - } - return "" -} - func shouldEmitSourceMaps(mapOptions *core.CompilerOptions, sourceFile *ast.SourceFile) bool { return (mapOptions.SourceMap.IsTrue() || mapOptions.InlineSourceMap.IsTrue()) && !tspath.FileExtensionIs(sourceFile.FileName(), tspath.ExtensionJson) @@ -274,7 +237,7 @@ func (e *emitter) getSourceMapDirectory(mapOptions *core.CompilerOptions, filePa if sourceFile != nil { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = tspath.GetDirectoryPath(getSourceFilePathInNewDir( + sourceMapDir = tspath.GetDirectoryPath(outputpaths.GetSourceFilePathInNewDir( sourceFile.FileName(), sourceMapDir, e.host.GetCurrentDirectory(), @@ -305,7 +268,7 @@ func (e *emitter) getSourceMappingURL(mapOptions *core.CompilerOptions, sourceMa if sourceFile != nil { // For modules or multiple emit files the mapRoot will have directory structure like the sources // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = tspath.GetDirectoryPath(getSourceFilePathInNewDir( + sourceMapDir = tspath.GetDirectoryPath(outputpaths.GetSourceFilePathInNewDir( sourceFile.FileName(), sourceMapDir, e.host.GetCurrentDirectory(), @@ -334,91 +297,6 @@ func (e *emitter) getSourceMappingURL(mapOptions *core.CompilerOptions, sourceMa return stringutil.EncodeURI(sourceMapFile) } -func getDeclarationEmitOutputFilePath(file string, host EmitHost) string { - options := host.Options() - var outputDir *string - if len(options.DeclarationDir) > 0 { - outputDir = &options.DeclarationDir - } else if len(options.OutDir) > 0 { - outputDir = &options.OutDir - } - - var path string - if outputDir != nil { - path = getSourceFilePathInNewDirWorker(file, *outputDir, host.GetCurrentDirectory(), host.CommonSourceDirectory(), host.UseCaseSensitiveFileNames()) - } else { - path = file - } - declarationExtension := tspath.GetDeclarationEmitExtensionForPath(path) - return tspath.RemoveFileExtension(path) + declarationExtension -} - -func getSourceFilePathInNewDirWorker(fileName string, newDirPath string, currentDirectory string, commonSourceDirectory string, useCaseSensitiveFileNames bool) string { - sourceFilePath := tspath.GetNormalizedAbsolutePath(fileName, currentDirectory) - commonDir := tspath.GetCanonicalFileName(commonSourceDirectory, useCaseSensitiveFileNames) - canonFile := tspath.GetCanonicalFileName(sourceFilePath, useCaseSensitiveFileNames) - isSourceFileInCommonSourceDirectory := strings.HasPrefix(canonFile, commonDir) - if isSourceFileInCommonSourceDirectory { - sourceFilePath = sourceFilePath[len(commonSourceDirectory):] - } - return tspath.CombinePaths(newDirPath, sourceFilePath) -} - -type outputPaths struct { - jsFilePath string - sourceMapFilePath string - declarationFilePath string - declarationMapPath string - buildInfoPath string -} - -// DeclarationFilePath implements declarations.OutputPaths. -func (o *outputPaths) DeclarationFilePath() string { - return o.declarationFilePath -} - -// JsFilePath implements declarations.OutputPaths. -func (o *outputPaths) JsFilePath() string { - return o.jsFilePath -} - -func getOutputPathsFor(sourceFile *ast.SourceFile, host EmitHost, forceDtsEmit bool) *outputPaths { - options := host.Options() - // !!! bundle not implemented, may be deprecated - ownOutputFilePath := getOwnEmitOutputFilePath(sourceFile.FileName(), host, core.GetOutputExtension(sourceFile.FileName(), options.Jsx)) - isJsonFile := ast.IsJsonSourceFile(sourceFile) - // If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it - isJsonEmittedToSameLocation := isJsonFile && - tspath.ComparePaths(sourceFile.FileName(), ownOutputFilePath, tspath.ComparePathsOptions{ - CurrentDirectory: host.GetCurrentDirectory(), - UseCaseSensitiveFileNames: host.UseCaseSensitiveFileNames(), - }) == 0 - paths := &outputPaths{} - if options.EmitDeclarationOnly != core.TSTrue && !isJsonEmittedToSameLocation { - paths.jsFilePath = ownOutputFilePath - if !ast.IsJsonSourceFile(sourceFile) { - paths.sourceMapFilePath = getSourceMapFilePath(paths.jsFilePath, options) - } - } - if forceDtsEmit || options.GetEmitDeclarations() && !isJsonFile { - paths.declarationFilePath = getDeclarationEmitOutputFilePath(sourceFile.FileName(), host) - if options.GetAreDeclarationMapsEnabled() { - paths.declarationMapPath = paths.declarationFilePath + ".map" - } - } - return paths -} - -func forEachEmittedFile(host EmitHost, action func(emitFileNames *outputPaths, sourceFile *ast.SourceFile) bool, sourceFiles []*ast.SourceFile, options *EmitOptions) bool { - // !!! outFile not yet implemented, may be deprecated - for _, sourceFile := range sourceFiles { - if action(getOutputPathsFor(sourceFile, host, options.forceDtsEmit), sourceFile) { - return true - } - } - return false -} - func sourceFileMayBeEmitted(sourceFile *ast.SourceFile, host printer.EmitHost, forceDtsEmit bool) bool { // !!! Js files are emitted only if option is enabled diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index 071f8947f4..d8f868a86f 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -12,7 +12,6 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/module" - "github.com/microsoft/typescript-go/internal/modulespecifiers" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -382,7 +381,7 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, resolvedFileName := resolution.resolvedModule.ResolvedFileName // TODO(ercornel): !!!: check if from node modules - mode := getModeForUsageLocation(file, meta, resolution.node, optionsForFile) + mode := getModeForUsageLocation(file.FileName(), meta, resolution.node, optionsForFile) resolutionsInFile[module.ModeAwareCacheKey{Name: resolution.node.Text(), Mode: mode}] = resolution.resolvedModule // add file to program only if: @@ -428,7 +427,7 @@ func (p *fileLoader) resolveModuleNames(entries []*ast.Node, file *ast.SourceFil if moduleName == "" { continue } - resolvedModule := p.resolver.ResolveModuleName(moduleName, file.FileName(), getModeForUsageLocation(file, meta, entry, p.opts.Config.CompilerOptions()), nil) + resolvedModule := p.resolver.ResolveModuleName(moduleName, file.FileName(), getModeForUsageLocation(file.FileName(), meta, entry, p.opts.Config.CompilerOptions()), nil) resolvedModules = append(resolvedModules, &resolution{node: entry, resolvedModule: resolvedModule}) } @@ -462,19 +461,19 @@ func getModeForTypeReferenceDirectiveInFile(ref *ast.FileReference, file *ast.So if ref.ResolutionMode != core.ResolutionModeNone { return ref.ResolutionMode } else { - return getDefaultResolutionModeForFile(file, meta, options) + return getDefaultResolutionModeForFile(file.FileName(), meta, options) } } -func getDefaultResolutionModeForFile(file modulespecifiers.SourceFileForSpecifierGeneration, meta *ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { +func getDefaultResolutionModeForFile(fileName string, meta *ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { if importSyntaxAffectsModuleResolution(options) { - return ast.GetImpliedNodeFormatForEmitWorker(file.FileName(), options, meta) + return ast.GetImpliedNodeFormatForEmitWorker(fileName, options, meta) } else { return core.ResolutionModeNone } } -func getModeForUsageLocation(file *ast.SourceFile, meta *ast.SourceFileMetaData, usage *ast.Node, options *core.CompilerOptions) core.ResolutionMode { +func getModeForUsageLocation(fileName string, meta *ast.SourceFileMetaData, usage *ast.StringLiteralLike, options *core.CompilerOptions) core.ResolutionMode { if ast.IsImportDeclaration(usage.Parent) || ast.IsExportDeclaration(usage.Parent) || ast.IsJSDocImportTag(usage.Parent) { isTypeOnly := ast.IsExclusivelyTypeOnlyImportOrExport(usage.Parent) if isTypeOnly { @@ -500,7 +499,7 @@ func getModeForUsageLocation(file *ast.SourceFile, meta *ast.SourceFileMetaData, } if options != nil && importSyntaxAffectsModuleResolution(options) { - return getEmitSyntaxForUsageLocationWorker(file, meta, usage, options) + return getEmitSyntaxForUsageLocationWorker(fileName, meta, usage, options) } return core.ResolutionModeNone @@ -512,7 +511,7 @@ func importSyntaxAffectsModuleResolution(options *core.CompilerOptions) bool { options.GetResolvePackageJsonExports() || options.GetResolvePackageJsonImports() } -func getEmitSyntaxForUsageLocationWorker(file *ast.SourceFile, meta *ast.SourceFileMetaData, usage *ast.Node, options *core.CompilerOptions) core.ResolutionMode { +func getEmitSyntaxForUsageLocationWorker(fileName string, meta *ast.SourceFileMetaData, usage *ast.Node, options *core.CompilerOptions) core.ResolutionMode { if options == nil { // This should always be provided, but we try to fail somewhat // gracefully to allow projects like ts-node time to update. @@ -523,7 +522,7 @@ func getEmitSyntaxForUsageLocationWorker(file *ast.SourceFile, meta *ast.SourceF return core.ModuleKindCommonJS } if ast.IsImportCall(ast.WalkUpParenthesizedExpressions(usage.Parent)) { - if shouldTransformImportCallWorker(file, meta, options) { + if ast.ShouldTransformImportCall(fileName, options, ast.GetImpliedNodeFormatForEmitWorker(fileName, options, meta)) { return core.ModuleKindCommonJS } else { return core.ModuleKindESNext @@ -536,7 +535,7 @@ func getEmitSyntaxForUsageLocationWorker(file *ast.SourceFile, meta *ast.SourceF // file, until/unless declaration emit can indicate a true ESM import. On the // other hand, writing CJS syntax in a definitely-ESM file is fine, since declaration // emit preserves the CJS syntax. - fileEmitMode := ast.GetEmitModuleFormatOfFileWorker(file, options, meta) + fileEmitMode := ast.GetEmitModuleFormatOfFileWorker(fileName, options, meta) if fileEmitMode == core.ModuleKindCommonJS { return core.ModuleKindCommonJS } else { @@ -546,11 +545,3 @@ func getEmitSyntaxForUsageLocationWorker(file *ast.SourceFile, meta *ast.SourceF } return core.ModuleKindNone } - -func shouldTransformImportCallWorker(file *ast.SourceFile, meta *ast.SourceFileMetaData, options *core.CompilerOptions) bool { - moduleKind := options.GetEmitModuleKind() - if core.ModuleKindNode16 <= moduleKind && moduleKind <= core.ModuleKindNodeNext || moduleKind == core.ModuleKindPreserve { - return false - } - return ast.GetImpliedNodeFormatForEmitWorker(file.FileName(), options, meta) < core.ModuleKindES2015 -} diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 64d7fdc241..3fc7bb3a59 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -13,6 +13,7 @@ import ( "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/modulespecifiers" + "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/scanner" "github.com/microsoft/typescript-go/internal/sourcemap" @@ -350,7 +351,7 @@ func (p *Program) GetTypeCheckerForFile(ctx context.Context, file *ast.SourceFil return p.checkerPool.GetCheckerForFile(ctx, file) } -func (p *Program) GetResolvedModule(file *ast.SourceFile, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule { +func (p *Program) GetResolvedModule(file ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule { if resolutions, ok := p.resolvedModules[file.Path()]; ok { if resolved, ok := resolutions[module.ModeAwareCacheKey{Name: moduleReference, Mode: mode}]; ok { return resolved @@ -359,6 +360,14 @@ func (p *Program) GetResolvedModule(file *ast.SourceFile, moduleReference string return nil } +func (p *Program) GetResolvedModuleFromModuleSpecifier(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) *module.ResolvedModule { + if !ast.IsStringLiteralLike(moduleSpecifier) { + panic("moduleSpecifier must be a StringLiteralLike") + } + mode := p.GetModeForUsageLocation(file, moduleSpecifier) + return p.GetResolvedModule(file, moduleSpecifier.Text(), mode) +} + func (p *Program) GetResolvedModules() map[tspath.Path]module.ModeAwareCache[*module.ResolvedModule] { return p.resolvedModules } @@ -666,24 +675,20 @@ func (p *Program) GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaDat return p.sourceFileMetaDatas[path] } -func (p *Program) GetEmitModuleFormatOfFile(sourceFile *ast.SourceFile) core.ModuleKind { - return p.GetEmitModuleFormatOfFileWorker(sourceFile, p.Options()) -} - -func (p *Program) GetEmitModuleFormatOfFileWorker(sourceFile *ast.SourceFile, options *core.CompilerOptions) core.ModuleKind { - return ast.GetEmitModuleFormatOfFileWorker(sourceFile, options, p.GetSourceFileMetaData(sourceFile.Path())) +func (p *Program) GetEmitModuleFormatOfFile(sourceFile ast.HasFileName) core.ModuleKind { + return ast.GetEmitModuleFormatOfFileWorker(sourceFile.FileName(), p.Options(), p.GetSourceFileMetaData(sourceFile.Path())) } -func (p *Program) GetImpliedNodeFormatForEmit(sourceFile *ast.SourceFile) core.ResolutionMode { +func (p *Program) GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ResolutionMode { return ast.GetImpliedNodeFormatForEmitWorker(sourceFile.FileName(), p.Options(), p.GetSourceFileMetaData(sourceFile.Path())) } -func (p *Program) GetModeForUsageLocation(sourceFile *ast.SourceFile, location *ast.Node) core.ResolutionMode { - return getModeForUsageLocation(sourceFile, p.sourceFileMetaDatas[sourceFile.Path()], location, p.Options()) +func (p *Program) GetModeForUsageLocation(sourceFile ast.HasFileName, location *ast.StringLiteralLike) core.ResolutionMode { + return getModeForUsageLocation(sourceFile.FileName(), p.sourceFileMetaDatas[sourceFile.Path()], location, p.Options()) } -func (p *Program) GetDefaultResolutionModeForFile(sourceFile modulespecifiers.SourceFileForSpecifierGeneration) core.ResolutionMode { - return getDefaultResolutionModeForFile(sourceFile, p.sourceFileMetaDatas[sourceFile.Path()], p.Options()) +func (p *Program) GetDefaultResolutionModeForFile(sourceFile ast.HasFileName) core.ResolutionMode { + return getDefaultResolutionModeForFile(sourceFile.FileName(), p.sourceFileMetaDatas[sourceFile.Path()], p.Options()) } func (p *Program) CommonSourceDirectory() string { @@ -750,10 +755,16 @@ func computeCommonSourceDirectoryOfFilenames(fileNames []string, currentDirector func getCommonSourceDirectory(options *core.CompilerOptions, files []string, currentDirectory string, useCaseSensitiveFileNames bool) string { var commonSourceDirectory string - // !!! If a rootDir is specified use it as the commonSourceDirectory - // !!! Project compilations never infer their root from the input source paths - - commonSourceDirectory = computeCommonSourceDirectoryOfFilenames(files, currentDirectory, useCaseSensitiveFileNames) + if options.RootDir != "" { + // If a rootDir is specified use it as the commonSourceDirectory + commonSourceDirectory = options.RootDir + } else if options.Composite.IsTrue() && options.ConfigFilePath != "" { + // If the rootDir is not specified, but the project is composite, then the common source directory + // is the directory of the config file. + commonSourceDirectory = tspath.GetDirectoryPath(options.ConfigFilePath) + } else { + commonSourceDirectory = computeCommonSourceDirectoryOfFilenames(files, currentDirectory, useCaseSensitiveFileNames) + } if len(commonSourceDirectory) > 0 { // Make sure directory path ends with directory separator so this string can directly @@ -814,7 +825,7 @@ func (p *Program) Emit(options EmitOptions) *EmitResult { // attach writer and perform emit emitter.writer = writer - emitter.paths = getOutputPathsFor(sourceFile, host, options.forceDtsEmit) + emitter.paths = outputpaths.GetOutputPathsFor(sourceFile, host.Options(), host, options.forceDtsEmit) emitter.emit() emitter.writer = nil diff --git a/internal/core/core.go b/internal/core/core.go index 21e9daf4ac..79a95f3714 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -431,21 +431,6 @@ func GetScriptKindFromFileName(fileName string) ScriptKind { return ScriptKindUnknown } -func GetOutputExtension(fileName string, jsx JsxEmit) string { - switch { - case tspath.FileExtensionIs(fileName, tspath.ExtensionJson): - return tspath.ExtensionJson - case jsx == JsxEmitPreserve && tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionJsx, tspath.ExtensionTsx}): - return tspath.ExtensionJsx - case tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionMts, tspath.ExtensionMjs}): - return tspath.ExtensionMjs - case tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionCts, tspath.ExtensionCjs}): - return tspath.ExtensionCjs - default: - return tspath.ExtensionJs - } -} - // Given a name and a list of names that are *not* equal to the name, return a spelling suggestion if there is one that is close enough. // Names less than length 3 only check for case-insensitive equality. // diff --git a/internal/module/types.go b/internal/module/types.go index 26328f85e1..073bf592f3 100644 --- a/internal/module/types.go +++ b/internal/module/types.go @@ -79,7 +79,7 @@ type ResolvedModule struct { } func (r *ResolvedModule) IsResolved() bool { - return r.ResolvedFileName != "" + return r != nil && r.ResolvedFileName != "" } type ResolvedTypeReferenceDirective struct { diff --git a/internal/modulespecifiers/preferences.go b/internal/modulespecifiers/preferences.go index ecab10838f..ce11879329 100644 --- a/internal/modulespecifiers/preferences.go +++ b/internal/modulespecifiers/preferences.go @@ -127,8 +127,7 @@ func getPreferredEnding( } } if resolutionMode == core.ResolutionModeNone { - // !!! TODO: proper import resolution mode support - // resolutionMode = host.GetDefaultResolutionModeForFile(importingSourceFile, compilerOptions) + resolutionMode = host.GetDefaultResolutionModeForFile(importingSourceFile) } return getModuleSpecifierEndingPreference( prefs.ImportModuleSpecifierEndingPreference, @@ -181,18 +180,17 @@ func getModuleSpecifierPreferences( getAllowedEndingsInPreferredOrder := func(syntaxImpliedNodeFormat core.ResolutionMode) []ModuleSpecifierEnding { preferredEnding := filePreferredEnding - // !!! TODO: resolution mode support - // impliedNodeFormat := getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions); - // if impliedNodeFormat != syntaxImpliedNodeFormat { - // preferredEnding = getPreferredEnding( - // prefs, - // host, - // compilerOptions, - // importingSourceFile, - // oldImportSpecifier, - // syntaxImpliedNodeFormat, - // ) - // } + resolutionMode := host.GetDefaultResolutionModeForFile(importingSourceFile) + if resolutionMode != syntaxImpliedNodeFormat { + preferredEnding = getPreferredEnding( + prefs, + host, + compilerOptions, + importingSourceFile, + oldImportSpecifier, + syntaxImpliedNodeFormat, + ) + } moduleResolution := compilerOptions.GetModuleResolutionKind() moduleResolutionIsNodeNext := core.ModuleResolutionKindNode16 <= moduleResolution && moduleResolution <= core.ModuleResolutionKindNodeNext allowImportingTsExtension := shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.FileName()) @@ -202,12 +200,6 @@ func getModuleSpecifierPreferences( } return []ModuleSpecifierEnding{ModuleSpecifierEndingJsExtension} } - // !!! Classic module resolution is dead? - // if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Classic) { - // return preferredEnding === ModuleSpecifierEnding.JsExtension - // ? [ModuleSpecifierEnding.JsExtension, ModuleSpecifierEnding.Index] - // : [ModuleSpecifierEnding.Index, ModuleSpecifierEnding.JsExtension]; - // } switch preferredEnding { case ModuleSpecifierEndingJsExtension: if allowImportingTsExtension { diff --git a/internal/modulespecifiers/specifiers.go b/internal/modulespecifiers/specifiers.go index 4df9b5cb81..927e128404 100644 --- a/internal/modulespecifiers/specifiers.go +++ b/internal/modulespecifiers/specifiers.go @@ -9,6 +9,7 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/module" + "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/packagejson" "github.com/microsoft/typescript-go/internal/stringutil" "github.com/microsoft/typescript-go/internal/tspath" @@ -150,7 +151,7 @@ func getAllModulePathsWorker( allFileNames := make(map[string]ModulePath) paths := getEachFileNameOfModule(info.ImportingSourceFileName, importedFileName, host, true) for _, p := range paths { - allFileNames[p.Path] = p + allFileNames[p.FileName] = p } // Sort by paths closest to importing file Name directory @@ -222,7 +223,7 @@ func getEachFileNameOfModule( for _, p := range targets { if !(shouldFilterIgnoredPaths && containsIgnoredPath(p)) { results = append(results, ModulePath{ - Path: p, + FileName: p, IsInNodeModules: containsNodeModules(p), IsRedirect: referenceRedirect == p, }) @@ -265,7 +266,7 @@ func getEachFileNameOfModule( for _, p := range targets { if !(shouldFilterIgnoredPaths && containsIgnoredPath(p)) { results = append(results, ModulePath{ - Path: p, + FileName: p, IsInNodeModules: containsNodeModules(p), IsRedirect: referenceRedirect == p, }) @@ -288,29 +289,39 @@ func computeModuleSpecifiers( info := getInfo(importingSourceFile.FileName(), host) preferences := getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile, "") - // !!! TODO: getFileIncludeReasons lookup based calculation - // const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, modulePath => - // forEach( - // host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), - // reason => { - // if (reason.kind !== FileIncludeKind.Import || reason.file !== importingSourceFile.path) return undefined; - // // If the candidate import mode doesn't match the mode we're generating for, don't consider it - // // TODO: maybe useful to keep around as an alternative option for certain contexts where the mode is overridable - // const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index); - // const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile); - // if (existingMode !== targetMode && existingMode !== undefined && targetMode !== undefined) { - // return undefined; - // } - // const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; - // // If the preference is for non relative and the module specifier is relative, ignore it - // return preferences.relativePreference !== RelativePreference.NonRelative || !pathIsRelative(specifier) ? - // specifier : - // undefined; - // }, - // )); - // if (existingSpecifier) { - // return { kind: undefined, moduleSpecifiers: [existingSpecifier], computedWithoutCache: true }; - // } + var existingSpecifier string + for _, modulePath := range modulePaths { + targetPath := tspath.ToPath(modulePath.FileName, host.GetCurrentDirectory(), info.UseCaseSensitiveFileNames) + var existingImport *ast.StringLiteralLike + for _, importSpecifier := range importingSourceFile.Imports() { + resolvedModule := host.GetResolvedModuleFromModuleSpecifier(importingSourceFile, importSpecifier) + if resolvedModule.IsResolved() && tspath.ToPath(resolvedModule.ResolvedFileName, host.GetCurrentDirectory(), info.UseCaseSensitiveFileNames) == targetPath { + existingImport = importSpecifier + break + } + } + if existingImport != nil { + if preferences.relativePreference == RelativePreferenceNonRelative && tspath.PathIsRelative(existingImport.Text()) { + // If the preference is for non-relative and the module specifier is relative, ignore it + continue + } + existingMode := host.GetModeForUsageLocation(importingSourceFile, existingImport) + targetMode := options.OverrideImportMode + if targetMode == core.ResolutionModeNone { + targetMode = host.GetDefaultResolutionModeForFile(importingSourceFile) + } + if existingMode != targetMode && existingMode != core.ResolutionModeNone && targetMode != core.ResolutionModeNone { + // If the candidate import mode doesn't match the mode we're generating for, don't consider it + continue + } + existingSpecifier = existingImport.Text() + break + } + } + + if existingSpecifier != "" { + return []string{existingSpecifier} + } importedFileIsInNodeModules := core.Some(modulePaths, func(p ModulePath) bool { return p.IsInNodeModules }) @@ -338,13 +349,16 @@ func computeModuleSpecifiers( } } - // !!! TODO: proper resolutionMode support + importMode := options.OverrideImportMode + if importMode == core.ResolutionModeNone { + importMode = host.GetDefaultResolutionModeForFile(importingSourceFile) + } local := getLocalModuleSpecifier( - modulePath.Path, + modulePath.FileName, info, compilerOptions, host, - options.OverrideImportMode, /*|| importingSourceFile.impliedNodeFormat*/ + importMode, preferences, /*pathsOnly*/ modulePath.IsRedirect || len(specifier) > 0, ) @@ -368,7 +382,7 @@ func computeModuleSpecifiers( // 'node_modules', but we can't create a non-relative specifier (e.g. "@foo/bar/path/to/file"), // that means we had to go through a *sibling's* node_modules, not one we can access directly. // If some path to the file was in node_modules but another was not, this likely indicates that - // we have a monorepo structure with symlinks. In this case, the non-node_modules path is + // we have a monorepo structure with symlinks. In this case, the non-nodeModules path is // probably the realpath, e.g. "../bar/path/to/file", but a relative path to another package // in a monorepo is probably not portable. So, the module specifier we actually go with will be // the relative path through node_modules, so that the declaration emitter can produce a @@ -640,7 +654,7 @@ func tryGetModuleNameAsNodeModule( packageNameOnly bool, overrideMode core.ResolutionMode, ) string { - parts := getNodeModulePathParts(pathObj.Path) + parts := getNodeModulePathParts(pathObj.FileName) if parts == nil { return "" } @@ -650,7 +664,7 @@ func tryGetModuleNameAsNodeModule( allowedEndings := preferences.getAllowedEndingsInPreferredOrder(core.ResolutionModeNone) caseSensitive := host.UseCaseSensitiveFileNames() - moduleSpecifier := pathObj.Path + moduleSpecifier := pathObj.FileName isPackageRootPath := false if !packageNameOnly { packageRootIndex := parts.PackageRootIndex @@ -686,7 +700,7 @@ func tryGetModuleNameAsNodeModule( moduleFileName = moduleFileToTry } // try with next level of directory - packageRootIndex = core.IndexAfter(pathObj.Path, "/", packageRootIndex+1) + packageRootIndex = core.IndexAfter(pathObj.FileName, "/", packageRootIndex+1) if packageRootIndex == -1 { moduleSpecifier = processEnding(moduleFileName, allowedEndings, options, host) break @@ -709,13 +723,7 @@ func tryGetModuleNameAsNodeModule( // If the module was found in @types, get the actual Node package name nodeModulesDirectoryName := moduleSpecifier[parts.TopLevelPackageNameIndex+1:] - packageName := getPackageNameFromTypesPackageName(nodeModulesDirectoryName) - // For classic resolution, only allow importing from node_modules/@types, not other node_modules - // !!! classic resolution is dead? - // if options.GetModuleResolutionKind() == core.ModuleResolutionKindClassic && packageName == nodeModulesDirectoryName { - // return "" - // } - return packageName + return getPackageNameFromTypesPackageName(nodeModulesDirectoryName) } type pkgJsonDirAttemptResult struct { @@ -736,11 +744,11 @@ func tryDirectoryWithPackageJson( ) pkgJsonDirAttemptResult { rootIdx := parts.PackageRootIndex if rootIdx == -1 { - rootIdx = len(pathObj.Path) // TODO: possible strada bug? -1 in js slice removes characters from the end, in go it panics - js behavior seems unwanted here? + rootIdx = len(pathObj.FileName) // TODO: possible strada bug? -1 in js slice removes characters from the end, in go it panics - js behavior seems unwanted here? } - packageRootPath := pathObj.Path[0:rootIdx] + packageRootPath := pathObj.FileName[0:rootIdx] packageJsonPath := tspath.CombinePaths(packageRootPath, "package.json") - moduleFileToTry := pathObj.Path + moduleFileToTry := pathObj.FileName maybeBlockedByTypesVersions := false packageJson := host.GetPackageJsonInfo(packageJsonPath) if packageJson == nil { @@ -774,7 +782,7 @@ func tryDirectoryWithPackageJson( fromExports = tryGetModuleNameFromExports( options, host, - pathObj.Path, + pathObj.FileName, packageRootPath, packageName, packageJsonContent.Fields.Exports, @@ -789,7 +797,7 @@ func tryDirectoryWithPackageJson( } if packageJsonContent != nil && packageJsonContent.Fields.Exports.Type != packagejson.JSONValueTypeNotPresent { return pkgJsonDirAttemptResult{ - moduleFileToTry: pathObj.Path, + moduleFileToTry: pathObj.FileName, blockedByExports: true, } } @@ -800,7 +808,7 @@ func tryDirectoryWithPackageJson( versionPaths = packageJsonContent.GetVersionPaths(nil) } if versionPaths.GetPaths() != nil { - subModuleName := pathObj.Path[len(packageRootPath)+1:] + subModuleName := pathObj.FileName[len(packageRootPath)+1:] fromPaths := tryGetModuleNameFromPaths( subModuleName, versionPaths.GetPaths(), @@ -1098,14 +1106,13 @@ func tryGetModuleNameFromExportsOrImports( case packagejson.JSONValueTypeString: strValue := exports.Value.(string) - // !!! TODO: remapping to output locations // possible strada bug? Always uses compilerOptions of the host project, not those applicable to the targeted package.json! - // var outputFile string - // var declarationFile string - // if isImports { - // outputFile = getOutputJSFileNameWorker(targetFilePath, options) - // declarationFile = getOutputDeclarationFileNameWorker(targetFilePath, options) - // } + var outputFile string + var declarationFile string + if isImports { + outputFile = outputpaths.GetOutputJSFileNameWorker(targetFilePath, options, host) + declarationFile = outputpaths.GetOutputDeclarationFileNameWorker(targetFilePath, options, host) + } pathOrPattern := tspath.GetNormalizedAbsolutePath(tspath.CombinePaths(packageDirectory, strValue), "") var extensionSwappedTarget string @@ -1122,10 +1129,9 @@ func tryGetModuleNameFromExportsOrImports( switch mode { case MatchingModeExact: if len(extensionSwappedTarget) > 0 && tspath.ComparePaths(extensionSwappedTarget, pathOrPattern, compareOpts) == 0 || - tspath.ComparePaths(targetFilePath, pathOrPattern, compareOpts) == 0 { - // !!! TODO: import remapping to output locations - // outputFile && tspath.ComparePaths(outputFile, pathOrPattern, ignoreCase) === Comparison.EqualTo || - // declarationFile && tspath.ComparePaths((declarationFile, pathOrPattern, ignoreCase) === Comparison.EqualTo + tspath.ComparePaths(targetFilePath, pathOrPattern, compareOpts) == 0 || + len(outputFile) > 0 && tspath.ComparePaths(outputFile, pathOrPattern, compareOpts) == 0 || + len(declarationFile) > 0 && tspath.ComparePaths(declarationFile, pathOrPattern, compareOpts) == 0 { return packageName } case MatchingModeDirectory: @@ -1141,44 +1147,45 @@ func tryGetModuleNameFromExportsOrImports( fragment := tspath.GetRelativePathFromDirectory(pathOrPattern, targetFilePath, compareOpts) return tspath.GetNormalizedAbsolutePath(tspath.CombinePaths(tspath.CombinePaths(packageName, strValue), fragment), "") } - // !!! TODO: import remapping to output locations - // if (outputFile && containsPath(pathOrPattern, outputFile, compareOpts)) { - // const fragment = getRelativePathFromDirectory(pathOrPattern, outputFile, /*ignoreCase*/ false); - // return combinePaths(packageName, fragment) - // } - // if (declarationFile && containsPath(pathOrPattern, declarationFile, compareOpts)) { - // const fragment = changeFullExtension(getRelativePathFromDirectory(pathOrPattern, declarationFile, /*ignoreCase*/ false), getJSExtensionForFile(declarationFile, options)); - // return combinePaths(packageName, fragment) - // } + if len(outputFile) > 0 && tspath.ContainsPath(pathOrPattern, outputFile, compareOpts) { + fragment := tspath.GetRelativePathFromDirectory(pathOrPattern, outputFile, compareOpts) + return tspath.CombinePaths(packageName, fragment) + } + if len(declarationFile) > 0 && tspath.ContainsPath(pathOrPattern, declarationFile, compareOpts) { + fragment := tspath.GetRelativePathFromDirectory(pathOrPattern, declarationFile, compareOpts) + jsExtension := getJSExtensionForFile(declarationFile, options) + fragmentWithJsExtension := tspath.ChangeExtension(fragment, jsExtension) + return tspath.CombinePaths(packageName, fragmentWithJsExtension) + } case MatchingModePattern: starPos := strings.Index(pathOrPattern, "*") leadingSlice := pathOrPattern[0:starPos] trailingSlice := pathOrPattern[starPos+1:] caseSensitive := host.UseCaseSensitiveFileNames() - var starReplacement string if canTryTsExtension && stringutil.HasPrefix(targetFilePath, leadingSlice, caseSensitive) && stringutil.HasSuffix(targetFilePath, trailingSlice, caseSensitive) { - starReplacement = targetFilePath[len(leadingSlice) : len(targetFilePath)-len(trailingSlice)] + starReplacement := targetFilePath[len(leadingSlice) : len(targetFilePath)-len(trailingSlice)] + return replaceFirstStar(packageName, starReplacement) } if len(extensionSwappedTarget) > 0 && stringutil.HasPrefix(extensionSwappedTarget, leadingSlice, caseSensitive) && stringutil.HasSuffix(extensionSwappedTarget, trailingSlice, caseSensitive) { - starReplacement = extensionSwappedTarget[len(leadingSlice) : len(extensionSwappedTarget)-len(trailingSlice)] + starReplacement := extensionSwappedTarget[len(leadingSlice) : len(extensionSwappedTarget)-len(trailingSlice)] + return replaceFirstStar(packageName, starReplacement) } if !canTryTsExtension && stringutil.HasPrefix(targetFilePath, leadingSlice, caseSensitive) && stringutil.HasSuffix(targetFilePath, trailingSlice, caseSensitive) { - starReplacement = targetFilePath[len(leadingSlice) : len(targetFilePath)-len(trailingSlice)] + starReplacement := targetFilePath[len(leadingSlice) : len(targetFilePath)-len(trailingSlice)] + return replaceFirstStar(packageName, starReplacement) } - if len(starReplacement) == 0 { - return "" + if len(outputFile) > 0 && stringutil.HasPrefix(outputFile, leadingSlice, caseSensitive) && stringutil.HasSuffix(outputFile, trailingSlice, caseSensitive) { + starReplacement := outputFile[len(leadingSlice) : len(outputFile)-len(trailingSlice)] + return replaceFirstStar(packageName, starReplacement) + } + if len(declarationFile) > 0 && stringutil.HasPrefix(declarationFile, leadingSlice, caseSensitive) && stringutil.HasSuffix(declarationFile, trailingSlice, caseSensitive) { + starReplacement := declarationFile[len(leadingSlice) : len(declarationFile)-len(trailingSlice)] + substituted := replaceFirstStar(packageName, starReplacement) + jsExtension := tryGetJSExtensionForFile(declarationFile, options) + if len(jsExtension) > 0 { + return tspath.ChangeFullExtension(substituted, jsExtension) + } } - return replaceFirstStar(packageName, starReplacement) - // !!! TODO: import remapping to output locations - // if (outputFile && startsWith(outputFile, leadingSlice, ignoreCase) && endsWith(outputFile, trailingSlice, ignoreCase)) { - // const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length); - // } - // if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) { - // const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length); - // const substituted = replaceFirstStar(packageName, starReplacement); - // const jsExtension = tryGetJSExtensionForFile(declarationFile, options); - // return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : undefined; - // } } return "" case packagejson.JSONValueTypeArray: diff --git a/internal/modulespecifiers/types.go b/internal/modulespecifiers/types.go index 6658fe6722..14c26f1cdf 100644 --- a/internal/modulespecifiers/types.go +++ b/internal/modulespecifiers/types.go @@ -3,6 +3,7 @@ package modulespecifiers import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/packagejson" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -11,7 +12,7 @@ type SourceFileForSpecifierGeneration interface { Path() tspath.Path FileName() string OriginalFileName() string - Imports() []*ast.LiteralLikeNode + Imports() []*ast.StringLiteralLike IsJS() bool } @@ -32,7 +33,7 @@ const ( ) type ModulePath struct { - Path string + FileName string IsInNodeModules bool IsRedirect bool } @@ -46,6 +47,7 @@ type ModuleSpecifierGenerationHost interface { // GetModuleResolutionCache() any // !!! TODO: adapt new resolution cache model // GetSymlinkCache() any // !!! TODO: adapt new resolution cache model // GetFileIncludeReasons() any // !!! TODO: adapt new resolution cache model + CommonSourceDirectory() string GetGlobalTypingsCacheLocation() string UseCaseSensitiveFileNames() bool GetCurrentDirectory() string @@ -58,7 +60,9 @@ type ModuleSpecifierGenerationHost interface { GetNearestAncestorDirectoryWithPackageJson(dirname string) string GetPackageJsonInfo(pkgJsonPath string) PackageJsonInfo - GetDefaultResolutionModeForFile(file SourceFileForSpecifierGeneration) core.ResolutionMode + GetDefaultResolutionModeForFile(file ast.HasFileName) core.ResolutionMode + GetResolvedModuleFromModuleSpecifier(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) *module.ResolvedModule + GetModeForUsageLocation(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) core.ResolutionMode } type ImportModuleSpecifierPreference string diff --git a/internal/modulespecifiers/util.go b/internal/modulespecifiers/util.go index 0850ad8b34..6abb7d3605 100644 --- a/internal/modulespecifiers/util.go +++ b/internal/modulespecifiers/util.go @@ -22,7 +22,7 @@ func isNonGlobalAmbientModule(node *ast.Node) bool { func comparePathsByRedirectAndNumberOfDirectorySeparators(a ModulePath, b ModulePath) int { if a.IsRedirect == b.IsRedirect { - return strings.Count(a.Path, "/") - strings.Count(b.Path, "/") + return strings.Count(a.FileName, "/") - strings.Count(b.FileName, "/") } if a.IsRedirect { return 1 diff --git a/internal/outputpaths/outputpaths.go b/internal/outputpaths/outputpaths.go new file mode 100644 index 0000000000..360c3372d6 --- /dev/null +++ b/internal/outputpaths/outputpaths.go @@ -0,0 +1,201 @@ +package outputpaths + +import ( + "strings" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type OutputPathsHost interface { + CommonSourceDirectory() string + GetCurrentDirectory() string + UseCaseSensitiveFileNames() bool +} + +type OutputPaths struct { + jsFilePath string + sourceMapFilePath string + declarationFilePath string + declarationMapPath string + buildInfoPath string +} + +// DeclarationFilePath implements declarations.OutputPaths. +func (o *OutputPaths) DeclarationFilePath() string { + return o.declarationFilePath +} + +// JsFilePath implements declarations.OutputPaths. +func (o *OutputPaths) JsFilePath() string { + return o.jsFilePath +} + +func (o *OutputPaths) SourceMapFilePath() string { + return o.sourceMapFilePath +} + +func (o *OutputPaths) DeclarationMapPath() string { + return o.declarationMapPath +} + +func (o *OutputPaths) BuildInfoPath() string { + return o.buildInfoPath +} + +func GetOutputPathsFor(sourceFile *ast.SourceFile, options *core.CompilerOptions, host OutputPathsHost, forceDtsEmit bool) *OutputPaths { + // !!! bundle not implemented, may be deprecated + ownOutputFilePath := getOwnEmitOutputFilePath(sourceFile.FileName(), options, host, GetOutputExtension(sourceFile.FileName(), options.Jsx)) + isJsonFile := ast.IsJsonSourceFile(sourceFile) + // If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it + isJsonEmittedToSameLocation := isJsonFile && + tspath.ComparePaths(sourceFile.FileName(), ownOutputFilePath, tspath.ComparePathsOptions{ + CurrentDirectory: host.GetCurrentDirectory(), + UseCaseSensitiveFileNames: host.UseCaseSensitiveFileNames(), + }) == 0 + paths := &OutputPaths{} + if options.EmitDeclarationOnly != core.TSTrue && !isJsonEmittedToSameLocation { + paths.jsFilePath = ownOutputFilePath + if !ast.IsJsonSourceFile(sourceFile) { + paths.sourceMapFilePath = getSourceMapFilePath(paths.jsFilePath, options) + } + } + if forceDtsEmit || options.GetEmitDeclarations() && !isJsonFile { + paths.declarationFilePath = GetDeclarationEmitOutputFilePath(sourceFile.FileName(), options, host) + if options.GetAreDeclarationMapsEnabled() { + paths.declarationMapPath = paths.declarationFilePath + ".map" + } + } + return paths +} + +func ForEachEmittedFile(host OutputPathsHost, options *core.CompilerOptions, action func(emitFileNames *OutputPaths, sourceFile *ast.SourceFile) bool, sourceFiles []*ast.SourceFile, forceDtsEmit bool) bool { + // !!! outFile not yet implemented, may be deprecated + for _, sourceFile := range sourceFiles { + if action(GetOutputPathsFor(sourceFile, options, host, forceDtsEmit), sourceFile) { + return true + } + } + return false +} + +func GetOutputJSFileNameWorker(inputFileName string, options *core.CompilerOptions, host OutputPathsHost) string { + return tspath.ChangeExtension( + getOutputPathWithoutChangingExtension(inputFileName, options.OutDir, host), + GetOutputExtension(inputFileName, options.Jsx), + ) +} + +func GetOutputDeclarationFileNameWorker(inputFileName string, options *core.CompilerOptions, host OutputPathsHost) string { + dir := options.DeclarationDir + if len(dir) == 0 { + dir = options.OutDir + } + return tspath.ChangeExtension( + getOutputPathWithoutChangingExtension(inputFileName, dir, host), + getDeclarationEmitExtensionForPath(inputFileName), + ) +} + +func GetOutputExtension(fileName string, jsx core.JsxEmit) string { + switch { + case tspath.FileExtensionIs(fileName, tspath.ExtensionJson): + return tspath.ExtensionJson + case jsx == core.JsxEmitPreserve && tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionJsx, tspath.ExtensionTsx}): + return tspath.ExtensionJsx + case tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionMts, tspath.ExtensionMjs}): + return tspath.ExtensionMjs + case tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionCts, tspath.ExtensionCjs}): + return tspath.ExtensionCjs + default: + return tspath.ExtensionJs + } +} + +func GetDeclarationEmitOutputFilePath(file string, options *core.CompilerOptions, host OutputPathsHost) string { + var outputDir *string + if len(options.DeclarationDir) > 0 { + outputDir = &options.DeclarationDir + } else if len(options.OutDir) > 0 { + outputDir = &options.OutDir + } + + var path string + if outputDir != nil { + path = getSourceFilePathInNewDirWorker(file, *outputDir, host.GetCurrentDirectory(), host.CommonSourceDirectory(), host.UseCaseSensitiveFileNames()) + } else { + path = file + } + declarationExtension := tspath.GetDeclarationEmitExtensionForPath(path) + return tspath.RemoveFileExtension(path) + declarationExtension +} + +func GetSourceFilePathInNewDir(fileName string, newDirPath string, currentDirectory string, commonSourceDirectory string, useCaseSensitiveFileNames bool) string { + sourceFilePath := tspath.GetNormalizedAbsolutePath(fileName, currentDirectory) + commonSourceDirectory = tspath.EnsureTrailingDirectorySeparator(commonSourceDirectory) + isSourceFileInCommonSourceDirectory := tspath.ContainsPath(commonSourceDirectory, sourceFilePath, tspath.ComparePathsOptions{ + UseCaseSensitiveFileNames: useCaseSensitiveFileNames, + CurrentDirectory: currentDirectory, + }) + if isSourceFileInCommonSourceDirectory { + sourceFilePath = sourceFilePath[len(commonSourceDirectory):] + } + return tspath.CombinePaths(newDirPath, sourceFilePath) +} + +func getOutputPathWithoutChangingExtension(inputFileName string, outputDirectory string, host OutputPathsHost) string { + if len(outputDirectory) > 0 { + return tspath.ResolvePath(outputDirectory, tspath.GetRelativePathFromDirectory(host.CommonSourceDirectory(), inputFileName, tspath.ComparePathsOptions{ + UseCaseSensitiveFileNames: host.UseCaseSensitiveFileNames(), + CurrentDirectory: host.GetCurrentDirectory(), + })) + } + return inputFileName +} + +func getSourceFilePathInNewDirWorker(fileName string, newDirPath string, currentDirectory string, commonSourceDirectory string, useCaseSensitiveFileNames bool) string { + sourceFilePath := tspath.GetNormalizedAbsolutePath(fileName, currentDirectory) + commonDir := tspath.GetCanonicalFileName(commonSourceDirectory, useCaseSensitiveFileNames) + canonFile := tspath.GetCanonicalFileName(sourceFilePath, useCaseSensitiveFileNames) + isSourceFileInCommonSourceDirectory := strings.HasPrefix(canonFile, commonDir) + if isSourceFileInCommonSourceDirectory { + sourceFilePath = sourceFilePath[len(commonSourceDirectory):] + } + return tspath.CombinePaths(newDirPath, sourceFilePath) +} + +func getOwnEmitOutputFilePath(fileName string, options *core.CompilerOptions, host OutputPathsHost, extension string) string { + var emitOutputFilePathWithoutExtension string + if len(options.OutDir) > 0 { + currentDirectory := host.GetCurrentDirectory() + emitOutputFilePathWithoutExtension = tspath.RemoveFileExtension(GetSourceFilePathInNewDir( + fileName, + options.OutDir, + currentDirectory, + host.CommonSourceDirectory(), + host.UseCaseSensitiveFileNames(), + )) + } else { + emitOutputFilePathWithoutExtension = tspath.RemoveFileExtension(fileName) + } + return emitOutputFilePathWithoutExtension + extension +} + +func getSourceMapFilePath(jsFilePath string, options *core.CompilerOptions) string { + if options.SourceMap.IsTrue() && !options.InlineSourceMap.IsTrue() { + return jsFilePath + ".map" + } + return "" +} + +func getDeclarationEmitExtensionForPath(fileName string) string { + if tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionMjs, tspath.ExtensionMts}) { + return tspath.ExtensionDmts + } else if tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionCjs, tspath.ExtensionCts}) { + return tspath.ExtensionDcts + } else if tspath.FileExtensionIs(fileName, tspath.ExtensionJson) { + return ".d.json.ts" + } + return tspath.ExtensionDts +} diff --git a/internal/printer/emithost.go b/internal/printer/emithost.go index 3d12e45fe0..6b0757472d 100644 --- a/internal/printer/emithost.go +++ b/internal/printer/emithost.go @@ -3,7 +3,6 @@ package printer import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" - "github.com/microsoft/typescript-go/internal/tspath" ) type WriteFileData struct { @@ -16,7 +15,6 @@ type WriteFileData struct { // NOTE: EmitHost operations must be thread-safe type EmitHost interface { - SourceFileMetaDataProvider Options() *core.CompilerOptions SourceFiles() []*ast.SourceFile UseCaseSensitiveFileNames() bool @@ -24,6 +22,6 @@ type EmitHost interface { CommonSourceDirectory() string IsEmitBlocked(file string) bool WriteFile(fileName string, text string, writeByteOrderMark bool, relatedSourceFiles []*ast.SourceFile, data *WriteFileData) error - GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData + GetEmitModuleFormatOfFile(file ast.HasFileName) core.ModuleKind GetEmitResolver(file *ast.SourceFile, skipDiagnostics bool) EmitResolver } diff --git a/internal/printer/sourcefilemetadataprovider.go b/internal/printer/sourcefilemetadataprovider.go deleted file mode 100644 index fbecce9280..0000000000 --- a/internal/printer/sourcefilemetadataprovider.go +++ /dev/null @@ -1,10 +0,0 @@ -package printer - -import ( - "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/tspath" -) - -type SourceFileMetaDataProvider interface { - GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData -} diff --git a/internal/testutil/harnessutil/harnessutil.go b/internal/testutil/harnessutil/harnessutil.go index c5da18633a..0817f03ad4 100644 --- a/internal/testutil/harnessutil/harnessutil.go +++ b/internal/testutil/harnessutil/harnessutil.go @@ -20,6 +20,7 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/repo" "github.com/microsoft/typescript-go/internal/scanner" @@ -634,7 +635,7 @@ func newCompilationResult( input := &TestFile{UnitName: sourceFile.FileName(), Content: sourceFile.Text()} c.inputs = append(c.inputs, input) if !tspath.IsDeclarationFileName(sourceFile.FileName()) { - extname := core.GetOutputExtension(sourceFile.FileName(), options.Jsx) + extname := outputpaths.GetOutputExtension(sourceFile.FileName(), options.Jsx) outputs := &CompilationOutput{ Inputs: []*TestFile{input}, JS: js.GetOrZero(c.getOutputPath(sourceFile.FileName(), extname)), diff --git a/internal/transformers/commonjsmodule.go b/internal/transformers/commonjsmodule.go index a13ebd1448..61a30189ac 100644 --- a/internal/transformers/commonjsmodule.go +++ b/internal/transformers/commonjsmodule.go @@ -12,26 +12,26 @@ import ( type CommonJSModuleTransformer struct { Transformer - topLevelVisitor *ast.NodeVisitor // visits statements at top level of a module - topLevelNestedVisitor *ast.NodeVisitor // visits nested statements at top level of a module - discardedValueVisitor *ast.NodeVisitor // visits expressions whose values would be discarded at runtime - assignmentPatternVisitor *ast.NodeVisitor // visits assignment patterns in a destructuring assignment - compilerOptions *core.CompilerOptions - resolver binder.ReferenceResolver - sourceFileMetaDataProvider printer.SourceFileMetaDataProvider - moduleKind core.ModuleKind - languageVersion core.ScriptTarget - currentSourceFile *ast.SourceFile - currentModuleInfo *externalModuleInfo - parentNode *ast.Node // used for ancestor tracking via pushNode/popNode to detect expression identifiers - currentNode *ast.Node // used for ancestor tracking via pushNode/popNode to detect expression identifiers -} - -func NewCommonJSModuleTransformer(emitContext *printer.EmitContext, compilerOptions *core.CompilerOptions, resolver binder.ReferenceResolver, sourceFileMetaDataProvider printer.SourceFileMetaDataProvider) *Transformer { + topLevelVisitor *ast.NodeVisitor // visits statements at top level of a module + topLevelNestedVisitor *ast.NodeVisitor // visits nested statements at top level of a module + discardedValueVisitor *ast.NodeVisitor // visits expressions whose values would be discarded at runtime + assignmentPatternVisitor *ast.NodeVisitor // visits assignment patterns in a destructuring assignment + compilerOptions *core.CompilerOptions + resolver binder.ReferenceResolver + getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind + moduleKind core.ModuleKind + languageVersion core.ScriptTarget + currentSourceFile *ast.SourceFile + currentModuleInfo *externalModuleInfo + parentNode *ast.Node // used for ancestor tracking via pushNode/popNode to detect expression identifiers + currentNode *ast.Node // used for ancestor tracking via pushNode/popNode to detect expression identifiers +} + +func NewCommonJSModuleTransformer(emitContext *printer.EmitContext, compilerOptions *core.CompilerOptions, resolver binder.ReferenceResolver, getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind) *Transformer { if resolver == nil { resolver = binder.NewReferenceResolver(compilerOptions, binder.ReferenceResolverHooks{}) } - tx := &CommonJSModuleTransformer{compilerOptions: compilerOptions, resolver: resolver, sourceFileMetaDataProvider: sourceFileMetaDataProvider} + tx := &CommonJSModuleTransformer{compilerOptions: compilerOptions, resolver: resolver, getEmitModuleFormatOfFile: getEmitModuleFormatOfFile} tx.topLevelVisitor = emitContext.NewNodeVisitor(tx.visitTopLevel) tx.topLevelNestedVisitor = emitContext.NewNodeVisitor(tx.visitTopLevelNested) tx.discardedValueVisitor = emitContext.NewNodeVisitor(tx.visitDiscardedValue) @@ -363,7 +363,7 @@ func (tx *CommonJSModuleTransformer) transformCommonJSModule(node *ast.SourceFil result := tx.factory.UpdateSourceFile(node, statementList).AsSourceFile() tx.emitContext.AddEmitHelper(result.AsNode(), tx.emitContext.ReadEmitHelpers()...) - externalHelpersImportDeclaration := createExternalHelpersImportDeclarationIfNeeded(tx.emitContext, result, tx.compilerOptions, tx.sourceFileMetaDataProvider, false /*hasExportStarsToExportValues*/, false /*hasImportStar*/, false /*hasImportDefault*/) + externalHelpersImportDeclaration := createExternalHelpersImportDeclarationIfNeeded(tx.emitContext, result, tx.compilerOptions, tx.getEmitModuleFormatOfFile(node), false /*hasExportStarsToExportValues*/, false /*hasImportStar*/, false /*hasImportDefault*/) if externalHelpersImportDeclaration != nil { prologue, rest := tx.factory.SplitStandardPrologue(result.Statements.Nodes) custom, rest := tx.factory.SplitCustomPrologue(rest) @@ -1670,8 +1670,7 @@ func (tx *CommonJSModuleTransformer) visitCallExpression(node *ast.CallExpressio } func (tx *CommonJSModuleTransformer) shouldTransformImportCall() bool { - // !!! host.shouldTransformImportCall? - return shouldTransformImportCallWorker(tx.currentSourceFile, tx.compilerOptions, tx.sourceFileMetaDataProvider.GetSourceFileMetaData(tx.currentSourceFile.Path())) + return ast.ShouldTransformImportCall(tx.currentSourceFile.FileName(), tx.compilerOptions, tx.getEmitModuleFormatOfFile(tx.currentSourceFile)) } func (tx *CommonJSModuleTransformer) visitImportCallExpression(node *ast.CallExpression, rewriteOrShim bool) *ast.Node { @@ -1988,11 +1987,3 @@ func (tx *CommonJSModuleTransformer) getExports(name *ast.IdentifierNode) []*ast } return nil } - -func shouldTransformImportCallWorker(sourceFile *ast.SourceFile, options *core.CompilerOptions, sourceFileMetaData *ast.SourceFileMetaData) bool { - moduleKind := options.GetEmitModuleKind() - if core.ModuleKindNode16 <= moduleKind && moduleKind <= core.ModuleKindNodeNext || moduleKind == core.ModuleKindPreserve { - return false - } - return ast.GetEmitModuleFormatOfFileWorker(sourceFile, options, sourceFileMetaData) < core.ModuleKindES2015 -} diff --git a/internal/transformers/commonjsmodule_test.go b/internal/transformers/commonjsmodule_test.go index f9d2bda37f..045876f1c6 100644 --- a/internal/transformers/commonjsmodule_test.go +++ b/internal/transformers/commonjsmodule_test.go @@ -9,13 +9,10 @@ import ( "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/testutil/emittestutil" "github.com/microsoft/typescript-go/internal/testutil/parsetestutil" - "github.com/microsoft/typescript-go/internal/tspath" ) -type fakeSourceFileMetaDataProvider struct{} - -func (p *fakeSourceFileMetaDataProvider) GetSourceFileMetaData(path tspath.Path) *ast.SourceFileMetaData { - return nil +func fakeGetEmitModuleFormatOfFile(file ast.HasFileName) core.ModuleKind { + return core.ModuleKindNone } func TestCommonJSModuleTransformer(t *testing.T) { @@ -1035,10 +1032,9 @@ exports.a = a;`, emitContext := printer.NewEmitContext() resolver := binder.NewReferenceResolver(&compilerOptions, binder.ReferenceResolverHooks{}) - program := &fakeSourceFileMetaDataProvider{} file = NewRuntimeSyntaxTransformer(emitContext, &compilerOptions, resolver).TransformSourceFile(file) - file = NewCommonJSModuleTransformer(emitContext, &compilerOptions, resolver, program).TransformSourceFile(file) + file = NewCommonJSModuleTransformer(emitContext, &compilerOptions, resolver, fakeGetEmitModuleFormatOfFile).TransformSourceFile(file) emittestutil.CheckEmit(t, emitContext, file, rec.output) }) } diff --git a/internal/transformers/esmodule.go b/internal/transformers/esmodule.go index c7d85b6064..a10247abdb 100644 --- a/internal/transformers/esmodule.go +++ b/internal/transformers/esmodule.go @@ -11,12 +11,12 @@ import ( type ESModuleTransformer struct { Transformer - compilerOptions *core.CompilerOptions - resolver binder.ReferenceResolver - sourceFileMetaDataProvider printer.SourceFileMetaDataProvider - currentSourceFile *ast.SourceFile - importRequireStatements *importRequireStatements - helperNameSubstitutions map[string]*ast.IdentifierNode + compilerOptions *core.CompilerOptions + resolver binder.ReferenceResolver + getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind + currentSourceFile *ast.SourceFile + importRequireStatements *importRequireStatements + helperNameSubstitutions map[string]*ast.IdentifierNode } type importRequireStatements struct { @@ -24,11 +24,11 @@ type importRequireStatements struct { requireHelperName *ast.IdentifierNode } -func NewESModuleTransformer(emitContext *printer.EmitContext, compilerOptions *core.CompilerOptions, resolver binder.ReferenceResolver, sourceFileMetaDataProvider printer.SourceFileMetaDataProvider) *Transformer { +func NewESModuleTransformer(emitContext *printer.EmitContext, compilerOptions *core.CompilerOptions, resolver binder.ReferenceResolver, getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind) *Transformer { if resolver == nil { resolver = binder.NewReferenceResolver(compilerOptions, binder.ReferenceResolverHooks{}) } - tx := &ESModuleTransformer{compilerOptions: compilerOptions, resolver: resolver, sourceFileMetaDataProvider: sourceFileMetaDataProvider} + tx := &ESModuleTransformer{compilerOptions: compilerOptions, resolver: resolver, getEmitModuleFormatOfFile: getEmitModuleFormatOfFile} return tx.NewTransformer(tx.visit, emitContext) } @@ -65,7 +65,7 @@ func (tx *ESModuleTransformer) visitSourceFile(node *ast.SourceFile) *ast.Node { result := tx.visitor.VisitEachChild(node.AsNode()).AsSourceFile() tx.emitContext.AddEmitHelper(result.AsNode(), tx.emitContext.ReadEmitHelpers()...) - externalHelpersImportDeclaration := createExternalHelpersImportDeclarationIfNeeded(tx.emitContext, result, tx.compilerOptions, tx.sourceFileMetaDataProvider, false /*hasExportStarsToExportValues*/, false /*hasImportStar*/, false /*hasImportDefault*/) + externalHelpersImportDeclaration := createExternalHelpersImportDeclarationIfNeeded(tx.emitContext, result, tx.compilerOptions, tx.getEmitModuleFormatOfFile(node), false /*hasExportStarsToExportValues*/, false /*hasImportStar*/, false /*hasImportDefault*/) if externalHelpersImportDeclaration != nil || tx.importRequireStatements != nil { prologue, rest := tx.factory.SplitStandardPrologue(result.Statements.Nodes) statements := slices.Clone(prologue) diff --git a/internal/transformers/esmodule_test.go b/internal/transformers/esmodule_test.go index 2e3df4686e..2e71653bc5 100644 --- a/internal/transformers/esmodule_test.go +++ b/internal/transformers/esmodule_test.go @@ -234,10 +234,9 @@ var __rewriteRelativeImportExtension;`, emitContext := printer.NewEmitContext() resolver := binder.NewReferenceResolver(&compilerOptions, binder.ReferenceResolverHooks{}) - program := &fakeSourceFileMetaDataProvider{} file = NewRuntimeSyntaxTransformer(emitContext, &compilerOptions, resolver).TransformSourceFile(file) - file = NewESModuleTransformer(emitContext, &compilerOptions, resolver, program).TransformSourceFile(file) + file = NewESModuleTransformer(emitContext, &compilerOptions, resolver, fakeGetEmitModuleFormatOfFile).TransformSourceFile(file) emittestutil.CheckEmit(t, emitContext, file, rec.output) }) } diff --git a/internal/transformers/externalmoduleinfo.go b/internal/transformers/externalmoduleinfo.go index 863c7c35ea..927d7873dd 100644 --- a/internal/transformers/externalmoduleinfo.go +++ b/internal/transformers/externalmoduleinfo.go @@ -246,14 +246,24 @@ func (c *externalModuleInfoCollector) collectExportedVariableInfo(decl *ast.Node const externalHelpersModuleNameText = "tslib" -func createExternalHelpersImportDeclarationIfNeeded(emitContext *printer.EmitContext, sourceFile *ast.SourceFile, compilerOptions *core.CompilerOptions, sourceFileMetaDataProvider printer.SourceFileMetaDataProvider, hasExportStarsToExportValues bool, hasImportStar bool, hasImportDefault bool) *ast.Node /*ImportDeclaration | ImportEqualsDeclaration*/ { +func createExternalHelpersImportDeclarationIfNeeded(emitContext *printer.EmitContext, sourceFile *ast.SourceFile, compilerOptions *core.CompilerOptions, fileModuleKind core.ModuleKind, hasExportStarsToExportValues bool, hasImportStar bool, hasImportDefault bool) *ast.Node /*ImportDeclaration | ImportEqualsDeclaration*/ { if compilerOptions.ImportHelpers.IsTrue() && ast.IsEffectiveExternalModule(sourceFile, compilerOptions) { moduleKind := compilerOptions.GetEmitModuleKind() - impliedModuleKind := ast.GetImpliedNodeFormatForEmitWorker(sourceFile.FileName(), compilerOptions, sourceFileMetaDataProvider.GetSourceFileMetaData(sourceFile.Path())) helpers := getImportedHelpers(emitContext, sourceFile) - if (moduleKind >= core.ModuleKindES2015 && moduleKind <= core.ModuleKindESNext) || - impliedModuleKind == core.ModuleKindESNext || - impliedModuleKind == core.ModuleKindNone && moduleKind == core.ModuleKindPreserve { + if fileModuleKind == core.ModuleKindCommonJS || fileModuleKind == core.ModuleKindNone && moduleKind == core.ModuleKindCommonJS { + // When we emit to a non-ES module, generate a synthetic `import tslib = require("tslib")` to be further transformed. + externalHelpersModuleName := getOrCreateExternalHelpersModuleNameIfNeeded(emitContext, sourceFile, compilerOptions, helpers, hasExportStarsToExportValues, hasImportStar || hasImportDefault, fileModuleKind) + if externalHelpersModuleName != nil { + externalHelpersImportDeclaration := emitContext.Factory.NewImportEqualsDeclaration( + nil, /*modifiers*/ + false, /*isTypeOnly*/ + externalHelpersModuleName, + emitContext.Factory.NewExternalModuleReference(emitContext.Factory.NewStringLiteral(externalHelpersModuleNameText)), + ) + emitContext.AddEmitFlags(externalHelpersImportDeclaration, printer.EFNeverApplyImportHelper|printer.EFCustomPrologue) + return externalHelpersImportDeclaration + } + } else { // When we emit as an ES module, generate an `import` declaration that uses named imports for helpers. // If we cannot determine the implied module kind under `module: preserve` we assume ESM. var helperNames []string @@ -286,19 +296,6 @@ func createExternalHelpersImportDeclarationIfNeeded(emitContext *printer.EmitCon nil, /*attributes*/ ) - emitContext.AddEmitFlags(externalHelpersImportDeclaration, printer.EFNeverApplyImportHelper|printer.EFCustomPrologue) - return externalHelpersImportDeclaration - } - } else { - // When we emit to a non-ES module, generate a synthetic `import tslib = require("tslib")` to be further transformed. - externalHelpersModuleName := getOrCreateExternalHelpersModuleNameIfNeeded(emitContext, sourceFile, compilerOptions, helpers, hasExportStarsToExportValues, hasImportStar || hasImportDefault, sourceFileMetaDataProvider.GetSourceFileMetaData(sourceFile.Path())) - if externalHelpersModuleName != nil { - externalHelpersImportDeclaration := emitContext.Factory.NewImportEqualsDeclaration( - nil, /*modifiers*/ - false, /*isTypeOnly*/ - externalHelpersModuleName, - emitContext.Factory.NewExternalModuleReference(emitContext.Factory.NewStringLiteral(externalHelpersModuleNameText)), - ) emitContext.AddEmitFlags(externalHelpersImportDeclaration, printer.EFNeverApplyImportHelper|printer.EFCustomPrologue) return externalHelpersImportDeclaration } @@ -317,7 +314,7 @@ func getImportedHelpers(emitContext *printer.EmitContext, sourceFile *ast.Source return helpers } -func getOrCreateExternalHelpersModuleNameIfNeeded(emitContext *printer.EmitContext, node *ast.SourceFile, compilerOptions *core.CompilerOptions, helpers []*printer.EmitHelper, hasExportStarsToExportValues bool, hasImportStarOrImportDefault bool, sourceFileMetaData *ast.SourceFileMetaData) *ast.IdentifierNode { +func getOrCreateExternalHelpersModuleNameIfNeeded(emitContext *printer.EmitContext, node *ast.SourceFile, compilerOptions *core.CompilerOptions, helpers []*printer.EmitHelper, hasExportStarsToExportValues bool, hasImportStarOrImportDefault bool, fileModuleKind core.ModuleKind) *ast.IdentifierNode { externalHelpersModuleName := emitContext.GetExternalHelpersModuleName(node) if externalHelpersModuleName != nil { return externalHelpersModuleName @@ -325,7 +322,7 @@ func getOrCreateExternalHelpersModuleNameIfNeeded(emitContext *printer.EmitConte create := len(helpers) > 0 || (hasExportStarsToExportValues || compilerOptions.GetESModuleInterop() && hasImportStarOrImportDefault) && - ast.GetEmitModuleFormatOfFileWorker(node, compilerOptions, sourceFileMetaData) < core.ModuleKindSystem + fileModuleKind < core.ModuleKindSystem if create { externalHelpersModuleName = emitContext.Factory.NewUniqueName(externalHelpersModuleNameText) diff --git a/internal/transformers/impliedmodule.go b/internal/transformers/impliedmodule.go index 011239bdb1..0ace66e810 100644 --- a/internal/transformers/impliedmodule.go +++ b/internal/transformers/impliedmodule.go @@ -9,18 +9,18 @@ import ( type ImpliedModuleTransformer struct { Transformer - compilerOptions *core.CompilerOptions - resolver binder.ReferenceResolver - sourceFileMetaDataProvider printer.SourceFileMetaDataProvider - cjsTransformer *Transformer - esmTransformer *Transformer + compilerOptions *core.CompilerOptions + resolver binder.ReferenceResolver + getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind + cjsTransformer *Transformer + esmTransformer *Transformer } -func NewImpliedModuleTransformer(emitContext *printer.EmitContext, compilerOptions *core.CompilerOptions, resolver binder.ReferenceResolver, sourceFileMetaDataProvider printer.SourceFileMetaDataProvider) *Transformer { +func NewImpliedModuleTransformer(emitContext *printer.EmitContext, compilerOptions *core.CompilerOptions, resolver binder.ReferenceResolver, getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind) *Transformer { if resolver == nil { resolver = binder.NewReferenceResolver(compilerOptions, binder.ReferenceResolverHooks{}) } - tx := &ImpliedModuleTransformer{compilerOptions: compilerOptions, resolver: resolver, sourceFileMetaDataProvider: sourceFileMetaDataProvider} + tx := &ImpliedModuleTransformer{compilerOptions: compilerOptions, resolver: resolver, getEmitModuleFormatOfFile: getEmitModuleFormatOfFile} return tx.NewTransformer(tx.visit, emitContext) } @@ -42,20 +42,15 @@ func (tx *ImpliedModuleTransformer) visitSourceFile(node *ast.SourceFile) *ast.N var transformer *Transformer if format >= core.ModuleKindES2015 { if tx.esmTransformer == nil { - tx.esmTransformer = NewESModuleTransformer(tx.emitContext, tx.compilerOptions, tx.resolver, tx.sourceFileMetaDataProvider) + tx.esmTransformer = NewESModuleTransformer(tx.emitContext, tx.compilerOptions, tx.resolver, tx.getEmitModuleFormatOfFile) } transformer = tx.esmTransformer } else { if tx.cjsTransformer == nil { - tx.cjsTransformer = NewCommonJSModuleTransformer(tx.emitContext, tx.compilerOptions, tx.resolver, tx.sourceFileMetaDataProvider) + tx.cjsTransformer = NewCommonJSModuleTransformer(tx.emitContext, tx.compilerOptions, tx.resolver, tx.getEmitModuleFormatOfFile) } transformer = tx.cjsTransformer } return transformer.TransformSourceFile(node).AsNode() } - -func (tx *ImpliedModuleTransformer) getEmitModuleFormatOfFile(node *ast.SourceFile) core.ModuleKind { - // !!! host.getEmitModuleFormatOfFile? - return ast.GetEmitModuleFormatOfFileWorker(node, tx.compilerOptions, tx.sourceFileMetaDataProvider.GetSourceFileMetaData(node.Path())) -} diff --git a/internal/transformers/importelision_test.go b/internal/transformers/importelision_test.go index f4db82942b..eaf9f82751 100644 --- a/internal/transformers/importelision_test.go +++ b/internal/transformers/importelision_test.go @@ -19,12 +19,21 @@ type fakeProgram struct { singleThreaded bool compilerOptions *core.CompilerOptions files []*ast.SourceFile - getEmitModuleFormatOfFile func(sourceFile modulespecifiers.SourceFileForSpecifierGeneration) core.ModuleKind - getImpliedNodeFormatForEmit func(sourceFile *ast.SourceFile) core.ModuleKind - getResolvedModule func(currentSourceFile *ast.SourceFile, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule + getEmitModuleFormatOfFile func(sourceFile ast.HasFileName) core.ModuleKind + getImpliedNodeFormatForEmit func(sourceFile ast.HasFileName) core.ModuleKind + getResolvedModule func(currentSourceFile ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule getSourceFile func(FileName string) *ast.SourceFile } +// CommonSourceDirectory implements checker.Program. +func (p *fakeProgram) CommonSourceDirectory() string { + panic("unimplemented") +} + +func (p *fakeProgram) GetResolvedModuleFromModuleSpecifier(file ast.HasFileName, moduleSpecifier *ast.StringLiteralLike) *module.ResolvedModule { + panic("unimplemented") +} + func (p *fakeProgram) FileExists(path string) bool { return false } @@ -81,23 +90,23 @@ func (p *fakeProgram) BindSourceFiles() { wg.RunAndWait() } -func (p *fakeProgram) GetEmitModuleFormatOfFile(sourceFile *ast.SourceFile) core.ModuleKind { +func (p *fakeProgram) GetEmitModuleFormatOfFile(sourceFile ast.HasFileName) core.ModuleKind { return p.getEmitModuleFormatOfFile(sourceFile) } -func (p *fakeProgram) GetImpliedNodeFormatForEmit(sourceFile *ast.SourceFile) core.ModuleKind { +func (p *fakeProgram) GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ModuleKind { return p.getImpliedNodeFormatForEmit(sourceFile) } -func (p *fakeProgram) GetDefaultResolutionModeForFile(sourceFile modulespecifiers.SourceFileForSpecifierGeneration) core.ResolutionMode { +func (p *fakeProgram) GetDefaultResolutionModeForFile(sourceFile ast.HasFileName) core.ResolutionMode { return p.getEmitModuleFormatOfFile(sourceFile) } -func (p *fakeProgram) GetModeForUsageLocation(sourceFile *ast.SourceFile, location *ast.Node) core.ResolutionMode { +func (p *fakeProgram) GetModeForUsageLocation(sourceFile ast.HasFileName, location *ast.Node) core.ResolutionMode { return p.getEmitModuleFormatOfFile(sourceFile) } -func (p *fakeProgram) GetResolvedModule(currentSourceFile *ast.SourceFile, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule { +func (p *fakeProgram) GetResolvedModule(currentSourceFile ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule { return p.getResolvedModule(currentSourceFile, moduleReference, mode) } @@ -173,10 +182,10 @@ func TestImportElision(t *testing.T) { singleThreaded: true, compilerOptions: compilerOptions, files: files, - getEmitModuleFormatOfFile: func(sourceFile modulespecifiers.SourceFileForSpecifierGeneration) core.ModuleKind { + getEmitModuleFormatOfFile: func(sourceFile ast.HasFileName) core.ModuleKind { return core.ModuleKindESNext }, - getImpliedNodeFormatForEmit: func(sourceFile *ast.SourceFile) core.ModuleKind { + getImpliedNodeFormatForEmit: func(sourceFile ast.HasFileName) core.ModuleKind { return core.ModuleKindESNext }, getSourceFile: func(fileName string) *ast.SourceFile { @@ -185,7 +194,7 @@ func TestImportElision(t *testing.T) { } return nil }, - getResolvedModule: func(currentSourceFile *ast.SourceFile, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule { + getResolvedModule: func(currentSourceFile ast.HasFileName, moduleReference string, mode core.ResolutionMode) *module.ResolvedModule { if currentSourceFile == file && moduleReference == "other" { return &module.ResolvedModule{ ResolvedFileName: "other.ts", diff --git a/internal/transformers/transformer.go b/internal/transformers/transformer.go index 3e5d5b3005..1bb1924a5b 100644 --- a/internal/transformers/transformer.go +++ b/internal/transformers/transformer.go @@ -42,11 +42,11 @@ func (tx *Transformer) TransformSourceFile(file *ast.SourceFile) *ast.SourceFile return tx.visitor.VisitSourceFile(file) } -func getModuleTransformer(emitContext *printer.EmitContext, options *core.CompilerOptions, resolver binder.ReferenceResolver, sourceFileMetaDataProvider printer.SourceFileMetaDataProvider) *Transformer { +func getModuleTransformer(emitContext *printer.EmitContext, options *core.CompilerOptions, resolver binder.ReferenceResolver, getEmitModuleFormatOfFile func(file ast.HasFileName) core.ModuleKind) *Transformer { switch options.GetEmitModuleKind() { case core.ModuleKindPreserve: // `ESModuleTransformer` contains logic for preserving CJS input syntax in `--module preserve` - return NewESModuleTransformer(emitContext, options, resolver, sourceFileMetaDataProvider) + return NewESModuleTransformer(emitContext, options, resolver, getEmitModuleFormatOfFile) case core.ModuleKindESNext, core.ModuleKindES2022, @@ -55,10 +55,10 @@ func getModuleTransformer(emitContext *printer.EmitContext, options *core.Compil core.ModuleKindNode16, core.ModuleKindNodeNext, core.ModuleKindCommonJS: - return NewImpliedModuleTransformer(emitContext, options, resolver, sourceFileMetaDataProvider) + return NewImpliedModuleTransformer(emitContext, options, resolver, getEmitModuleFormatOfFile) default: - return NewCommonJSModuleTransformer(emitContext, options, resolver, sourceFileMetaDataProvider) + return NewCommonJSModuleTransformer(emitContext, options, resolver, getEmitModuleFormatOfFile) } } @@ -106,6 +106,6 @@ func GetScriptTransformers(emitContext *printer.EmitContext, host printer.EmitHo // !!! transform other language targets // transform module syntax - tx = append(tx, getModuleTransformer(emitContext, options, referenceResolver, host)) + tx = append(tx, getModuleTransformer(emitContext, options, referenceResolver, host.GetEmitModuleFormatOfFile)) return tx } diff --git a/internal/transformers/utilities.go b/internal/transformers/utilities.go index fd1ff7f2fd..cd4b06d194 100644 --- a/internal/transformers/utilities.go +++ b/internal/transformers/utilities.go @@ -6,6 +6,7 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/jsnum" + "github.com/microsoft/typescript-go/internal/outputpaths" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -335,7 +336,7 @@ func rewriteModuleSpecifier(emitContext *printer.EmitContext, node *ast.Expressi if node == nil || !ast.IsStringLiteral(node) || !shouldRewriteModuleSpecifier(node.Text(), compilerOptions) { return node } - updatedText := tspath.ChangeExtension(node.Text(), core.GetOutputExtension(node.Text(), compilerOptions.Jsx)) + updatedText := tspath.ChangeExtension(node.Text(), outputpaths.GetOutputExtension(node.Text(), compilerOptions.Jsx)) if updatedText != node.Text() { updated := emitContext.Factory.NewStringLiteral(updatedText) // !!! set quote style diff --git a/internal/tspath/extension.go b/internal/tspath/extension.go index 243530c067..cc30d48a66 100644 --- a/internal/tspath/extension.go +++ b/internal/tspath/extension.go @@ -159,3 +159,20 @@ func changeAnyExtension(path string, ext string, extensions []string, ignoreCase func ChangeExtension(path string, newExtension string) string { return changeAnyExtension(path, newExtension, extensionsToRemove /*ignoreCase*/, false) } + +// Like `changeAnyExtension`, but declaration file extensions are recognized +// and replaced starting from the `.d`. +// +// changeAnyExtension("file.d.ts", ".js") === "file.d.js" +// changeFullExtension("file.d.ts", ".js") === "file.js" +func ChangeFullExtension(path string, newExtension string) string { + declarationExtension := GetDeclarationFileExtension(path) + if declarationExtension != "" { + ext := newExtension + if !strings.HasPrefix(ext, ".") { + ext = "." + ext + } + return path[:len(path)-len(declarationExtension)] + ext + } + return ChangeExtension(path, newExtension) +} diff --git a/testdata/baselines/reference/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types b/testdata/baselines/reference/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types index 1baf44e028..7d476d96a6 100644 --- a/testdata/baselines/reference/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types +++ b/testdata/baselines/reference/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types @@ -17,9 +17,9 @@ import { BindingKey } from '@loopback/context'; export const CONTROLLER_CLASS = BindingKey.create(null as any); // line in question >CONTROLLER_CLASS : BindingKey >BindingKey.create(null as any) : BindingKey ->BindingKey.create : >(ctor: T) => BindingKey +>BindingKey.create : >(ctor: T) => BindingKey >BindingKey : typeof BindingKey ->create : >(ctor: T) => BindingKey +>create : >(ctor: T) => BindingKey >null as any : any === /monorepo/context/src/value-promise.d.ts === diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types b/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types index 3df63b2ac0..dc15c089d7 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types @@ -13,7 +13,7 @@ export const x = add(import("./sub")); >"./sub" : "./sub" export * as Q from "./sub"; ->Q : typeof import("./sub.js") +>Q : typeof import("./sub") declare function add(x: Promise): T; >add : (x: Promise) => T diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types.diff index 750bfc4c10..148ccb5cfa 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitDoesNotUseReexportedNamespaceAsLocal.types.diff @@ -15,7 +15,7 @@ export * as Q from "./sub"; ->Q : typeof import("sub") -+>Q : typeof import("./sub.js") ++>Q : typeof import("./sub") declare function add(x: Promise): T; >add : (x: Promise) => T \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js index 91254750e8..6dfa3680cf 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js @@ -31,4 +31,4 @@ exports.a = (0, typescript_fsa_1.getA)(); //// [index.d.ts] -export declare const a: import("../cache/typescript-fsa").A; +export declare const a: import("typescript-fsa").A; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff index aebc51e130..ce8cbc65ab 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.js.diff @@ -8,7 +8,3 @@ +const typescript_fsa_1 = require("typescript-fsa"); exports.a = (0, typescript_fsa_1.getA)(); - - //// [index.d.ts] --export declare const a: import("typescript-fsa").A; -+export declare const a: import("../cache/typescript-fsa").A; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types index 878ea15aa9..66d218ad4f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types @@ -18,15 +18,15 @@ import * as _whatever from "p2"; >_whatever : typeof _whatever import { getA } from "typescript-fsa"; ->getA : () => import("../cache/typescript-fsa").A +>getA : () => import("typescript-fsa").A export const a = getA(); ->a : import("../cache/typescript-fsa").A ->getA() : import("../cache/typescript-fsa").A ->getA : () => import("../cache/typescript-fsa").A +>a : import("typescript-fsa").A +>getA() : import("typescript-fsa").A +>getA : () => import("typescript-fsa").A === /p2/index.d.ts === export const a: import("typescript-fsa").A; ->a : import("../cache/typescript-fsa").A +>a : import("typescript-fsa").A diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types.diff index 0725825517..9243323f7a 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitForGlobalishSpecifierSymlink2.types.diff @@ -5,18 +5,18 @@ import { getA } from "typescript-fsa"; ->getA : () => import("/cache/typescript-fsa/index").A -+>getA : () => import("../cache/typescript-fsa").A ++>getA : () => import("typescript-fsa").A export const a = getA(); ->a : import("/cache/typescript-fsa/index").A ->getA() : import("/cache/typescript-fsa/index").A ->getA : () => import("/cache/typescript-fsa/index").A -+>a : import("../cache/typescript-fsa").A -+>getA() : import("../cache/typescript-fsa").A -+>getA : () => import("../cache/typescript-fsa").A ++>a : import("typescript-fsa").A ++>getA() : import("typescript-fsa").A ++>getA : () => import("typescript-fsa").A === /p2/index.d.ts === export const a: import("typescript-fsa").A; ->a : import("/cache/typescript-fsa/index").A -+>a : import("../cache/typescript-fsa").A ++>a : import("typescript-fsa").A diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types index 8c6eaae6f1..f3f4dff2d6 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types @@ -48,14 +48,14 @@ declare class TRPCBuilder { >TRPCBuilder : TRPCBuilder create>(): { ->create : >() => { procedure: {}; middleware: >(fn: import("@trpc/server").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>; router: {}; } +>create : >() => { procedure: {}; middleware: >(fn: import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>; router: {}; } procedure: {}; >procedure : {} middleware: >(fn: import("./middleware").MiddlewareFunction<{ ->middleware : >(fn: import("@trpc/server").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> ->fn : import("@trpc/server").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> +>middleware : >(fn: import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> +>fn : import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> _config: RootConfig<{ >_config : RootConfig<{ errorShape: ErrorFormatterShape>>>; }> diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types.diff index 8be6574d90..9a849ae44c 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitIsolatedDeclarationErrorNotEmittedForNonEmittedFile.types.diff @@ -5,7 +5,7 @@ create>(): { ->create : >() => { procedure: {}; middleware: >(fn: import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>; }>; }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>; }>; }, TNewParams>; router: {}; } -+>create : >() => { procedure: {}; middleware: >(fn: import("@trpc/server").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>; router: {}; } ++>create : >() => { procedure: {}; middleware: >(fn: import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>; router: {}; } procedure: {}; >procedure : {} @@ -13,8 +13,8 @@ middleware: >(fn: import("./middleware").MiddlewareFunction<{ ->middleware : >(fn: import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>; }>; }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>; }>; }, TNewParams> ->fn : import("node_modules/@trpc/server/middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>; }>; }, TNewParams> -+>middleware : >(fn: import("@trpc/server").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> -+>fn : import("@trpc/server").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> ++>middleware : >(fn: import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams>) => import("./middleware").MiddlewareBuilder<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> ++>fn : import("./middleware").MiddlewareFunction<{ _config: RootConfig<{ errorShape: ErrorFormatterShape>>>; }>; }, TNewParams> _config: RootConfig<{ ->_config : RootConfig<{ errorShape: ErrorFormatterShape>>; }> diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.errors.txt deleted file mode 100644 index 04231affee..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.errors.txt +++ /dev/null @@ -1,57 +0,0 @@ -/packages/compiler-sfc/src/index.ts(2,17): error TS2742: The inferred type of 'resolveParserPlugins' cannot be named without a reference to '.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser'. This is likely not portable. A type annotation is necessary. - - -==== /tsconfig.json (0 errors) ==== - { - "compilerOptions": { - "module": "nodenext", - "declaration": true, - "outDir": "temp", - "baseUrl": "." - } - } - -==== /packages/compiler-core/src/index.ts (0 errors) ==== - import { PluginConfig } from "@babel/parser"; - -==== /packages/compiler-sfc/src/index.ts (1 errors) ==== - import { createPlugin } from "@babel/parser"; - export function resolveParserPlugins() { - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2742: The inferred type of 'resolveParserPlugins' cannot be named without a reference to '.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser'. This is likely not portable. A type annotation is necessary. - return [createPlugin()]; - } - -==== /node_modules/.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser/package.json (0 errors) ==== - { - "name": "@babel/parser", - "version": "7.23.6", - "main": "./lib/index.js", - "types": "./typings/babel-parser.d.ts" - } - -==== /node_modules/.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser/typings/babel-parser.d.ts (0 errors) ==== - export declare function createPlugin(): PluginConfig; - export declare class PluginConfig {} - -==== /packages/compiler-core/package.json (0 errors) ==== - { - "name": "@vue/compiler-core", - "version": "3.0.0", - "main": "./src/index.ts", - "dependencies": { - "@babel/parser": "^7.0.0" - } - } - -==== /packages/compiler-sfc/package.json (0 errors) ==== - { - "name": "@vue/compiler-sfc", - "version": "3.0.0", - "main": "./src/index.ts", - "dependencies": { - "@babel/parser": "^7.0.0", - "@vue/compiler-core": "^3.0.0" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js b/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js index f689b6ccaa..de71b6c171 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js @@ -59,4 +59,4 @@ function resolveParserPlugins() { //// [index.d.ts] export {}; //// [index.d.ts] -export declare function resolveParserPlugins(): any; +export declare function resolveParserPlugins(): import("@babel/parser").PluginConfig[]; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js.diff deleted file mode 100644 index 2fe4470542..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitMonorepoBaseUrl.js.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.declarationEmitMonorepoBaseUrl.js -+++ new.declarationEmitMonorepoBaseUrl.js -@@= skipped -58, +58 lines =@@ - //// [index.d.ts] - export {}; - //// [index.d.ts] --export declare function resolveParserPlugins(): import("@babel/parser").PluginConfig[]; -+export declare function resolveParserPlugins(): any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js index 9c26edabea..db59c23bec 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js @@ -45,29 +45,6 @@ export interface Scalar { export declare function scalar(value: string): Scalar; //// [spacing.d.ts] declare const _default: { - readonly xs: import("src/lib/operators/scalar").Scalar; + readonly xs: import("../lib/operators/scalar").Scalar; }; export default _default; - - -//// [DtsFileErrors] - - -dist/settings/spacing.d.ts(2,25): error TS2307: Cannot find module 'src/lib/operators/scalar' or its corresponding type declarations. - - -==== dist/lib/operators/scalar.d.ts (0 errors) ==== - export interface Scalar { - (): string; - value: number; - } - export declare function scalar(value: string): Scalar; - -==== dist/settings/spacing.d.ts (1 errors) ==== - declare const _default: { - readonly xs: import("src/lib/operators/scalar").Scalar; - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'src/lib/operators/scalar' or its corresponding type declarations. - }; - export default _default; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js.diff index 925fd0e53b..16adf24359 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.js.diff @@ -8,35 +8,4 @@ +const scalar_1 = require("../lib/operators/scalar"); exports.default = { get xs() { - return (0, scalar_1.scalar)("14px"); -@@= skipped -16, +16 lines =@@ - export declare function scalar(value: string): Scalar; - //// [spacing.d.ts] - declare const _default: { -- readonly xs: import("../lib/operators/scalar").Scalar; -+ readonly xs: import("src/lib/operators/scalar").Scalar; - }; - export default _default; -+ -+ -+//// [DtsFileErrors] -+ -+ -+dist/settings/spacing.d.ts(2,25): error TS2307: Cannot find module 'src/lib/operators/scalar' or its corresponding type declarations. -+ -+ -+==== dist/lib/operators/scalar.d.ts (0 errors) ==== -+ export interface Scalar { -+ (): string; -+ value: number; -+ } -+ export declare function scalar(value: string): Scalar; -+ -+==== dist/settings/spacing.d.ts (1 errors) ==== -+ declare const _default: { -+ readonly xs: import("src/lib/operators/scalar").Scalar; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'src/lib/operators/scalar' or its corresponding type declarations. -+ }; -+ export default _default; -+ \ No newline at end of file + return (0, scalar_1.scalar)("14px"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types index 5ae200962a..0a65ecb05d 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types @@ -16,17 +16,17 @@ export function scalar(value: string): Scalar { } === src/settings/spacing.ts === import { scalar } from '../lib/operators/scalar'; ->scalar : (value: string) => import("src/lib/operators/scalar").Scalar +>scalar : (value: string) => import("../lib/operators/scalar").Scalar export default { ->{ get xs() { return scalar("14px"); }} : { readonly xs: import("src/lib/operators/scalar").Scalar; } +>{ get xs() { return scalar("14px"); }} : { readonly xs: import("../lib/operators/scalar").Scalar; } get xs() { ->xs : import("src/lib/operators/scalar").Scalar +>xs : import("../lib/operators/scalar").Scalar return scalar("14px"); ->scalar("14px") : import("src/lib/operators/scalar").Scalar ->scalar : (value: string) => import("src/lib/operators/scalar").Scalar +>scalar("14px") : import("../lib/operators/scalar").Scalar +>scalar : (value: string) => import("../lib/operators/scalar").Scalar >"14px" : "14px" } }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types.diff new file mode 100644 index 0000000000..1e944145ec --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitPrefersPathKindBasedOnBundling.types.diff @@ -0,0 +1,25 @@ +--- old.declarationEmitPrefersPathKindBasedOnBundling.types ++++ new.declarationEmitPrefersPathKindBasedOnBundling.types +@@= skipped -15, +15 lines =@@ + } + === src/settings/spacing.ts === + import { scalar } from '../lib/operators/scalar'; +->scalar : (value: string) => import("src/lib/operators/scalar").Scalar ++>scalar : (value: string) => import("../lib/operators/scalar").Scalar + + export default { +->{ get xs() { return scalar("14px"); }} : { readonly xs: import("src/lib/operators/scalar").Scalar; } ++>{ get xs() { return scalar("14px"); }} : { readonly xs: import("../lib/operators/scalar").Scalar; } + + get xs() { +->xs : import("src/lib/operators/scalar").Scalar ++>xs : import("../lib/operators/scalar").Scalar + + return scalar("14px"); +->scalar("14px") : import("src/lib/operators/scalar").Scalar +->scalar : (value: string) => import("src/lib/operators/scalar").Scalar ++>scalar("14px") : import("../lib/operators/scalar").Scalar ++>scalar : (value: string) => import("../lib/operators/scalar").Scalar + >"14px" : "14px" + } + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js index a052f78c20..8ac5615ef5 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js @@ -71,6 +71,6 @@ __exportStar(require("./keys"), exports); //// [keys.d.ts] import { MetadataAccessor } from "@raymondfeng/pkg2"; -export declare const ADMIN: MetadataAccessor; +export declare const ADMIN: MetadataAccessor; //// [index.d.ts] export * from './keys'; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff index 2c631d0f54..02b2051f9a 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.js.diff @@ -8,12 +8,4 @@ +const pkg2_1 = require("@raymondfeng/pkg2"); exports.ADMIN = pkg2_1.MetadataAccessor.create('1'); //// [index.js] - "use strict"; -@@= skipped -24, +24 lines =@@ - - //// [keys.d.ts] - import { MetadataAccessor } from "@raymondfeng/pkg2"; --export declare const ADMIN: MetadataAccessor; -+export declare const ADMIN: MetadataAccessor; - //// [index.d.ts] - export * from './keys'; \ No newline at end of file + "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types index a6ce84ee96..b48563a1c0 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types @@ -8,11 +8,11 @@ import {MetadataAccessor} from "@raymondfeng/pkg2"; >MetadataAccessor : typeof MetadataAccessor export const ADMIN = MetadataAccessor.create('1'); ->ADMIN : MetadataAccessor ->MetadataAccessor.create('1') : MetadataAccessor ->MetadataAccessor.create : (key: string) => MetadataAccessor +>ADMIN : MetadataAccessor +>MetadataAccessor.create('1') : MetadataAccessor +>MetadataAccessor.create : (key: string) => MetadataAccessor >MetadataAccessor : typeof MetadataAccessor ->create : (key: string) => MetadataAccessor +>create : (key: string) => MetadataAccessor >'1' : "1" === monorepo/pkg1/dist/index.d.ts === diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types.diff index eb9a2111e7..edf1a71be4 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference.types.diff @@ -7,12 +7,12 @@ ->ADMIN : MetadataAccessor ->MetadataAccessor.create('1') : MetadataAccessor ->MetadataAccessor.create : (key: string) => MetadataAccessor -+>ADMIN : MetadataAccessor -+>MetadataAccessor.create('1') : MetadataAccessor -+>MetadataAccessor.create : (key: string) => MetadataAccessor ++>ADMIN : MetadataAccessor ++>MetadataAccessor.create('1') : MetadataAccessor ++>MetadataAccessor.create : (key: string) => MetadataAccessor >MetadataAccessor : typeof MetadataAccessor ->create : (key: string) => MetadataAccessor -+>create : (key: string) => MetadataAccessor ++>create : (key: string) => MetadataAccessor >'1' : "1" === monorepo/pkg1/dist/index.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types index 8a7267b255..4e655a71a3 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types @@ -56,7 +56,7 @@ import "./secondary"; export * from './types'; === monorepo/pkg2/dist/types.d.ts === export {MetadataAccessor} from '@raymondfeng/pkg1'; ->MetadataAccessor : typeof import("../../pkg1/dist").MetadataAccessor +>MetadataAccessor : typeof import("@raymondfeng/pkg1").MetadataAccessor === monorepo/pkg2/dist/secondary.d.ts === export {IdType} from '@raymondfeng/pkg1'; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types.diff index b945f2fef7..16feddec9b 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference2.types.diff @@ -21,7 +21,7 @@ === monorepo/pkg2/dist/types.d.ts === export {MetadataAccessor} from '@raymondfeng/pkg1'; ->MetadataAccessor : typeof import("monorepo/pkg1/dist/types").MetadataAccessor -+>MetadataAccessor : typeof import("../../pkg1/dist").MetadataAccessor ++>MetadataAccessor : typeof import("@raymondfeng/pkg1").MetadataAccessor === monorepo/pkg2/dist/secondary.d.ts === export {IdType} from '@raymondfeng/pkg1'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types index 4175506338..9bdf276c74 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types @@ -55,5 +55,5 @@ export declare class MetadataAccessor { export * from './types'; === monorepo/pkg2/dist/types.d.ts === export {MetadataAccessor} from '@raymondfeng/pkg1'; ->MetadataAccessor : typeof import("../../pkg1/dist").MetadataAccessor +>MetadataAccessor : typeof import("@raymondfeng/pkg1").MetadataAccessor diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types.diff index 114161545b..0e12a9ad79 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitReexportedSymlinkReference3.types.diff @@ -21,4 +21,4 @@ === monorepo/pkg2/dist/types.d.ts === export {MetadataAccessor} from '@raymondfeng/pkg1'; ->MetadataAccessor : typeof import("monorepo/pkg1/dist/types").MetadataAccessor -+>MetadataAccessor : typeof import("../../pkg1/dist").MetadataAccessor ++>MetadataAccessor : typeof import("@raymondfeng/pkg1").MetadataAccessor diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.errors.txt deleted file mode 100644 index 998453e31c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.errors.txt +++ /dev/null @@ -1,239 +0,0 @@ -src/index.mts(29,14): error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. - - -==== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts (0 errors) ==== - type QueryKey = ReadonlyArray; - - interface Register {} - - type DefaultError = Register extends { - defaultError: infer TError; - } - ? TError - : Error; - - type ShouldRetryFunction = ( - failureCount: number, - error: TError, - ) => boolean; - type RetryValue = boolean | number | ShouldRetryFunction; - - type QueryFunctionContext< - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > = [TPageParam] extends [never] - ? { - queryKey: TQueryKey; - } - : { - queryKey: TQueryKey; - pageParam: TPageParam; - }; - - type QueryFunction< - T = unknown, - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > = (context: QueryFunctionContext) => T | Promise; - - interface QueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > { - retry?: RetryValue; - queryFn?: QueryFunction; - queryKey?: TQueryKey; - initialData?: TData; - initialDataUpdatedAt?: number | (() => number | undefined); - } - - interface QueryObserverOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > extends QueryOptions< - TQueryFnData, - TError, - TQueryData, - TQueryKey, - TPageParam - > { - enabled?: boolean; - refetchInterval?: number; - select?: (data: TQueryData) => TData; - } - - type UseQueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - > = { - [Property in keyof QueryObserverOptions< - TQueryFnData, - TError, - TData, - TQueryData, - TQueryKey - >]: QueryObserverOptions< - TQueryFnData, - TError, - TData, - TQueryData, - TQueryKey - >[Property]; - }; - - type UndefinedInitialQueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - > = UseQueryOptions & { - initialData?: undefined; - }; - - interface QueryObserverBaseResult { - data: TData | undefined; - dataUpdatedAt: number; - error: TError | null; - errorUpdatedAt: number; - failureCount: number; - failureReason: TError | null; - errorUpdateCount: number; - isError: boolean; - isFetched: boolean; - isFetchedAfterMount: boolean; - isFetching: boolean; - isLoading: boolean; - isPending: boolean; - isLoadingError: boolean; - isInitialLoading: boolean; - isPaused: boolean; - isPlaceholderData: boolean; - isRefetchError: boolean; - isRefetching: boolean; - isStale: boolean; - isSuccess: boolean; - } - - interface QueryObserverSuccessResult - extends QueryObserverBaseResult { - data: TData; - error: null; - isError: false; - isPending: false; - isLoadingError: false; - isRefetchError: false; - isSuccess: true; - status: "success"; - } - - type DefinedQueryObserverResult< - TData = unknown, - TError = DefaultError, - > = QueryObserverSuccessResult; - type QueryObserverResult< - TData = unknown, - TError = DefaultError, - > = DefinedQueryObserverResult; - - type ToRef = { - value: T; - }; - - type UseBaseQueryReturnType< - TData, - TError, - Result = QueryObserverResult, - > = { - [K in keyof Result]: K extends - | "fetchNextPage" - | "fetchPreviousPage" - | "refetch" - ? Result[K] - : ToRef[K]>; - } & { - suspense: () => Promise; - }; - - type UseQueryReturnType = UseBaseQueryReturnType; - - declare function useQuery< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - >( - options: UndefinedInitialQueryOptions, - ): UseQueryReturnType; - - export { type UseQueryReturnType, useQuery }; - -==== node_modules/@tanstack/vue-query/build/modern/index.d.ts (0 errors) ==== - export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; - -==== node_modules/@tanstack/vue-query/package.json (0 errors) ==== - { - "name": "@tanstack/vue-query", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/modern/index.d.ts", - "default": "./build/modern/index.js" - }, - "require": { - "types": "./build/modern/index.d.cts", - "default": "./build/modern/index.cjs" - } - } - } - } - -==== src/index.mts (1 errors) ==== - import { useQuery } from '@tanstack/vue-query' - - const baseUrl = 'https://api.publicapis.org/' - - interface IEntry { - API: string - Description: string - Auth: string - HTTPS: boolean - Cors: string - Link: string - Category: string - } - - const testApi = { - getEntries: (): Promise => { - return fetch(baseUrl + 'entries') - .then((res) => res.json()) - .then((data) => data.entries) - .catch((err) => console.log(err)) - } - } - - const entryKeys = { - all: ['entries'] as const, - list: () => [...entryKeys.all, 'list'] as const - } - - export const useEntries = () => { - ~~~~~~~~~~ -!!! error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. - return useQuery({ - queryKey: entryKeys.list(), - queryFn: testApi.getEntries, - select: (data) => data.slice(0, 10) - }) - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.errors.txt.diff deleted file mode 100644 index 97f91b4e7e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.errors.txt.diff +++ /dev/null @@ -1,243 +0,0 @@ ---- old.declarationEmitUsingAlternativeContainingModules1.errors.txt -+++ new.declarationEmitUsingAlternativeContainingModules1.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/index.mts(29,14): error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts (0 errors) ==== -+ type QueryKey = ReadonlyArray; -+ -+ interface Register {} -+ -+ type DefaultError = Register extends { -+ defaultError: infer TError; -+ } -+ ? TError -+ : Error; -+ -+ type ShouldRetryFunction = ( -+ failureCount: number, -+ error: TError, -+ ) => boolean; -+ type RetryValue = boolean | number | ShouldRetryFunction; -+ -+ type QueryFunctionContext< -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > = [TPageParam] extends [never] -+ ? { -+ queryKey: TQueryKey; -+ } -+ : { -+ queryKey: TQueryKey; -+ pageParam: TPageParam; -+ }; -+ -+ type QueryFunction< -+ T = unknown, -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > = (context: QueryFunctionContext) => T | Promise; -+ -+ interface QueryOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > { -+ retry?: RetryValue; -+ queryFn?: QueryFunction; -+ queryKey?: TQueryKey; -+ initialData?: TData; -+ initialDataUpdatedAt?: number | (() => number | undefined); -+ } -+ -+ interface QueryObserverOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > extends QueryOptions< -+ TQueryFnData, -+ TError, -+ TQueryData, -+ TQueryKey, -+ TPageParam -+ > { -+ enabled?: boolean; -+ refetchInterval?: number; -+ select?: (data: TQueryData) => TData; -+ } -+ -+ type UseQueryOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ > = { -+ [Property in keyof QueryObserverOptions< -+ TQueryFnData, -+ TError, -+ TData, -+ TQueryData, -+ TQueryKey -+ >]: QueryObserverOptions< -+ TQueryFnData, -+ TError, -+ TData, -+ TQueryData, -+ TQueryKey -+ >[Property]; -+ }; -+ -+ type UndefinedInitialQueryOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ > = UseQueryOptions & { -+ initialData?: undefined; -+ }; -+ -+ interface QueryObserverBaseResult { -+ data: TData | undefined; -+ dataUpdatedAt: number; -+ error: TError | null; -+ errorUpdatedAt: number; -+ failureCount: number; -+ failureReason: TError | null; -+ errorUpdateCount: number; -+ isError: boolean; -+ isFetched: boolean; -+ isFetchedAfterMount: boolean; -+ isFetching: boolean; -+ isLoading: boolean; -+ isPending: boolean; -+ isLoadingError: boolean; -+ isInitialLoading: boolean; -+ isPaused: boolean; -+ isPlaceholderData: boolean; -+ isRefetchError: boolean; -+ isRefetching: boolean; -+ isStale: boolean; -+ isSuccess: boolean; -+ } -+ -+ interface QueryObserverSuccessResult -+ extends QueryObserverBaseResult { -+ data: TData; -+ error: null; -+ isError: false; -+ isPending: false; -+ isLoadingError: false; -+ isRefetchError: false; -+ isSuccess: true; -+ status: "success"; -+ } -+ -+ type DefinedQueryObserverResult< -+ TData = unknown, -+ TError = DefaultError, -+ > = QueryObserverSuccessResult; -+ type QueryObserverResult< -+ TData = unknown, -+ TError = DefaultError, -+ > = DefinedQueryObserverResult; -+ -+ type ToRef = { -+ value: T; -+ }; -+ -+ type UseBaseQueryReturnType< -+ TData, -+ TError, -+ Result = QueryObserverResult, -+ > = { -+ [K in keyof Result]: K extends -+ | "fetchNextPage" -+ | "fetchPreviousPage" -+ | "refetch" -+ ? Result[K] -+ : ToRef[K]>; -+ } & { -+ suspense: () => Promise; -+ }; -+ -+ type UseQueryReturnType = UseBaseQueryReturnType; -+ -+ declare function useQuery< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ >( -+ options: UndefinedInitialQueryOptions, -+ ): UseQueryReturnType; -+ -+ export { type UseQueryReturnType, useQuery }; -+ -+==== node_modules/@tanstack/vue-query/build/modern/index.d.ts (0 errors) ==== -+ export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; -+ -+==== node_modules/@tanstack/vue-query/package.json (0 errors) ==== -+ { -+ "name": "@tanstack/vue-query", -+ "type": "module", -+ "exports": { -+ ".": { -+ "import": { -+ "types": "./build/modern/index.d.ts", -+ "default": "./build/modern/index.js" -+ }, -+ "require": { -+ "types": "./build/modern/index.d.cts", -+ "default": "./build/modern/index.cjs" -+ } -+ } -+ } -+ } -+ -+==== src/index.mts (1 errors) ==== -+ import { useQuery } from '@tanstack/vue-query' -+ -+ const baseUrl = 'https://api.publicapis.org/' -+ -+ interface IEntry { -+ API: string -+ Description: string -+ Auth: string -+ HTTPS: boolean -+ Cors: string -+ Link: string -+ Category: string -+ } -+ -+ const testApi = { -+ getEntries: (): Promise => { -+ return fetch(baseUrl + 'entries') -+ .then((res) => res.json()) -+ .then((data) => data.entries) -+ .catch((err) => console.log(err)) -+ } -+ } -+ -+ const entryKeys = { -+ all: ['entries'] as const, -+ list: () => [...entryKeys.all, 'list'] as const -+ } -+ -+ export const useEntries = () => { -+ ~~~~~~~~~~ -+!!! error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. -+ return useQuery({ -+ queryKey: entryKeys.list(), -+ queryFn: testApi.getEntries, -+ select: (data) => data.slice(0, 10) -+ }) -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js index d733d2e7d8..73a3dd98d3 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js @@ -269,5 +269,5 @@ interface IEntry { Link: string; Category: string; } -export declare const useEntries: any; +export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js.diff deleted file mode 100644 index 8c1852a224..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.declarationEmitUsingAlternativeContainingModules1.js -+++ new.declarationEmitUsingAlternativeContainingModules1.js -@@= skipped -268, +268 lines =@@ - Link: string; - Category: string; - } --export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; -+export declare const useEntries: any; - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types index ca51c63b33..b64e8344db 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types @@ -305,7 +305,7 @@ export { UseQueryReturnType, useQuery } from './useQuery-CPqkvEsh.js'; === src/index.mts === import { useQuery } from '@tanstack/vue-query' ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType +>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -407,12 +407,12 @@ const entryKeys = { } export const useEntries = () => { ->useEntries : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType ->() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType +>useEntries : () => import("@tanstack/vue-query").UseQueryReturnType +>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("@tanstack/vue-query").UseQueryReturnType return useQuery({ ->useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType +>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("@tanstack/vue-query").UseQueryReturnType +>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType >{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } queryKey: entryKeys.list(), diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types.diff index e1721b6252..57bd7a038f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules1.types.diff @@ -10,7 +10,7 @@ === src/index.mts === import { useQuery } from '@tanstack/vue-query' ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType -+>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType ++>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -29,14 +29,14 @@ export const useEntries = () => { ->useEntries : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType ->() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType -+>useEntries : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType -+>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType ++>useEntries : () => import("@tanstack/vue-query").UseQueryReturnType ++>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("@tanstack/vue-query").UseQueryReturnType return useQuery({ ->useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").UseQueryReturnType -+>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType -+>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").UseQueryReturnType ++>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("@tanstack/vue-query").UseQueryReturnType ++>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType >{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } queryKey: entryKeys.list(), diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.errors.txt deleted file mode 100644 index 0a871f29c9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.errors.txt +++ /dev/null @@ -1,239 +0,0 @@ -src/index.mts(29,14): error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. - - -==== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts (0 errors) ==== - type QueryKey = ReadonlyArray; - - interface Register {} - - type DefaultError = Register extends { - defaultError: infer TError; - } - ? TError - : Error; - - type ShouldRetryFunction = ( - failureCount: number, - error: TError, - ) => boolean; - type RetryValue = boolean | number | ShouldRetryFunction; - - type QueryFunctionContext< - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > = [TPageParam] extends [never] - ? { - queryKey: TQueryKey; - } - : { - queryKey: TQueryKey; - pageParam: TPageParam; - }; - - type QueryFunction< - T = unknown, - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > = (context: QueryFunctionContext) => T | Promise; - - interface QueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > { - retry?: RetryValue; - queryFn?: QueryFunction; - queryKey?: TQueryKey; - initialData?: TData; - initialDataUpdatedAt?: number | (() => number | undefined); - } - - interface QueryObserverOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - TPageParam = never, - > extends QueryOptions< - TQueryFnData, - TError, - TQueryData, - TQueryKey, - TPageParam - > { - enabled?: boolean; - refetchInterval?: number; - select?: (data: TQueryData) => TData; - } - - type UseQueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - > = { - [Property in keyof QueryObserverOptions< - TQueryFnData, - TError, - TData, - TQueryData, - TQueryKey - >]: QueryObserverOptions< - TQueryFnData, - TError, - TData, - TQueryData, - TQueryKey - >[Property]; - }; - - type UndefinedInitialQueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - > = UseQueryOptions & { - initialData?: undefined; - }; - - interface QueryObserverBaseResult { - data: TData | undefined; - dataUpdatedAt: number; - error: TError | null; - errorUpdatedAt: number; - failureCount: number; - failureReason: TError | null; - errorUpdateCount: number; - isError: boolean; - isFetched: boolean; - isFetchedAfterMount: boolean; - isFetching: boolean; - isLoading: boolean; - isPending: boolean; - isLoadingError: boolean; - isInitialLoading: boolean; - isPaused: boolean; - isPlaceholderData: boolean; - isRefetchError: boolean; - isRefetching: boolean; - isStale: boolean; - isSuccess: boolean; - } - - interface QueryObserverSuccessResult - extends QueryObserverBaseResult { - data: TData; - error: null; - isError: false; - isPending: false; - isLoadingError: false; - isRefetchError: false; - isSuccess: true; - status: "success"; - } - - type DefinedQueryObserverResult< - TData = unknown, - TError = DefaultError, - > = QueryObserverSuccessResult; - type QueryObserverResult< - TData = unknown, - TError = DefaultError, - > = DefinedQueryObserverResult; - - type ToRef = { - value: T; - }; - - type UseBaseQueryReturnType< - TData, - TError, - Result = QueryObserverResult, - > = { - [K in keyof Result]: K extends - | "fetchNextPage" - | "fetchPreviousPage" - | "refetch" - ? Result[K] - : ToRef[K]>; - } & { - suspense: () => Promise; - }; - - type UseQueryReturnType = UseBaseQueryReturnType; - - declare function useQuery< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - >( - options: UndefinedInitialQueryOptions, - ): UseQueryReturnType; - - export { type UseQueryReturnType as b, useQuery as u }; - -==== node_modules/@tanstack/vue-query/build/modern/index.d.ts (0 errors) ==== - export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; - -==== node_modules/@tanstack/vue-query/package.json (0 errors) ==== - { - "name": "@tanstack/vue-query", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/modern/index.d.ts", - "default": "./build/modern/index.js" - }, - "require": { - "types": "./build/modern/index.d.cts", - "default": "./build/modern/index.cjs" - } - } - } - } - -==== src/index.mts (1 errors) ==== - import { useQuery } from '@tanstack/vue-query' - - const baseUrl = 'https://api.publicapis.org/' - - interface IEntry { - API: string - Description: string - Auth: string - HTTPS: boolean - Cors: string - Link: string - Category: string - } - - const testApi = { - getEntries: (): Promise => { - return fetch(baseUrl + 'entries') - .then((res) => res.json()) - .then((data) => data.entries) - .catch((err) => console.log(err)) - } - } - - const entryKeys = { - all: ['entries'] as const, - list: () => [...entryKeys.all, 'list'] as const - } - - export const useEntries = () => { - ~~~~~~~~~~ -!!! error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. - return useQuery({ - queryKey: entryKeys.list(), - queryFn: testApi.getEntries, - select: (data) => data.slice(0, 10) - }) - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.errors.txt.diff deleted file mode 100644 index 94a861c17e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.errors.txt.diff +++ /dev/null @@ -1,243 +0,0 @@ ---- old.declarationEmitUsingAlternativeContainingModules2.errors.txt -+++ new.declarationEmitUsingAlternativeContainingModules2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/index.mts(29,14): error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.d.ts (0 errors) ==== -+ type QueryKey = ReadonlyArray; -+ -+ interface Register {} -+ -+ type DefaultError = Register extends { -+ defaultError: infer TError; -+ } -+ ? TError -+ : Error; -+ -+ type ShouldRetryFunction = ( -+ failureCount: number, -+ error: TError, -+ ) => boolean; -+ type RetryValue = boolean | number | ShouldRetryFunction; -+ -+ type QueryFunctionContext< -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > = [TPageParam] extends [never] -+ ? { -+ queryKey: TQueryKey; -+ } -+ : { -+ queryKey: TQueryKey; -+ pageParam: TPageParam; -+ }; -+ -+ type QueryFunction< -+ T = unknown, -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > = (context: QueryFunctionContext) => T | Promise; -+ -+ interface QueryOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > { -+ retry?: RetryValue; -+ queryFn?: QueryFunction; -+ queryKey?: TQueryKey; -+ initialData?: TData; -+ initialDataUpdatedAt?: number | (() => number | undefined); -+ } -+ -+ interface QueryObserverOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ TPageParam = never, -+ > extends QueryOptions< -+ TQueryFnData, -+ TError, -+ TQueryData, -+ TQueryKey, -+ TPageParam -+ > { -+ enabled?: boolean; -+ refetchInterval?: number; -+ select?: (data: TQueryData) => TData; -+ } -+ -+ type UseQueryOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ > = { -+ [Property in keyof QueryObserverOptions< -+ TQueryFnData, -+ TError, -+ TData, -+ TQueryData, -+ TQueryKey -+ >]: QueryObserverOptions< -+ TQueryFnData, -+ TError, -+ TData, -+ TQueryData, -+ TQueryKey -+ >[Property]; -+ }; -+ -+ type UndefinedInitialQueryOptions< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ > = UseQueryOptions & { -+ initialData?: undefined; -+ }; -+ -+ interface QueryObserverBaseResult { -+ data: TData | undefined; -+ dataUpdatedAt: number; -+ error: TError | null; -+ errorUpdatedAt: number; -+ failureCount: number; -+ failureReason: TError | null; -+ errorUpdateCount: number; -+ isError: boolean; -+ isFetched: boolean; -+ isFetchedAfterMount: boolean; -+ isFetching: boolean; -+ isLoading: boolean; -+ isPending: boolean; -+ isLoadingError: boolean; -+ isInitialLoading: boolean; -+ isPaused: boolean; -+ isPlaceholderData: boolean; -+ isRefetchError: boolean; -+ isRefetching: boolean; -+ isStale: boolean; -+ isSuccess: boolean; -+ } -+ -+ interface QueryObserverSuccessResult -+ extends QueryObserverBaseResult { -+ data: TData; -+ error: null; -+ isError: false; -+ isPending: false; -+ isLoadingError: false; -+ isRefetchError: false; -+ isSuccess: true; -+ status: "success"; -+ } -+ -+ type DefinedQueryObserverResult< -+ TData = unknown, -+ TError = DefaultError, -+ > = QueryObserverSuccessResult; -+ type QueryObserverResult< -+ TData = unknown, -+ TError = DefaultError, -+ > = DefinedQueryObserverResult; -+ -+ type ToRef = { -+ value: T; -+ }; -+ -+ type UseBaseQueryReturnType< -+ TData, -+ TError, -+ Result = QueryObserverResult, -+ > = { -+ [K in keyof Result]: K extends -+ | "fetchNextPage" -+ | "fetchPreviousPage" -+ | "refetch" -+ ? Result[K] -+ : ToRef[K]>; -+ } & { -+ suspense: () => Promise; -+ }; -+ -+ type UseQueryReturnType = UseBaseQueryReturnType; -+ -+ declare function useQuery< -+ TQueryFnData = unknown, -+ TError = DefaultError, -+ TData = TQueryFnData, -+ TQueryKey extends QueryKey = QueryKey, -+ >( -+ options: UndefinedInitialQueryOptions, -+ ): UseQueryReturnType; -+ -+ export { type UseQueryReturnType as b, useQuery as u }; -+ -+==== node_modules/@tanstack/vue-query/build/modern/index.d.ts (0 errors) ==== -+ export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; -+ -+==== node_modules/@tanstack/vue-query/package.json (0 errors) ==== -+ { -+ "name": "@tanstack/vue-query", -+ "type": "module", -+ "exports": { -+ ".": { -+ "import": { -+ "types": "./build/modern/index.d.ts", -+ "default": "./build/modern/index.js" -+ }, -+ "require": { -+ "types": "./build/modern/index.d.cts", -+ "default": "./build/modern/index.cjs" -+ } -+ } -+ } -+ } -+ -+==== src/index.mts (1 errors) ==== -+ import { useQuery } from '@tanstack/vue-query' -+ -+ const baseUrl = 'https://api.publicapis.org/' -+ -+ interface IEntry { -+ API: string -+ Description: string -+ Auth: string -+ HTTPS: boolean -+ Cors: string -+ Link: string -+ Category: string -+ } -+ -+ const testApi = { -+ getEntries: (): Promise => { -+ return fetch(baseUrl + 'entries') -+ .then((res) => res.json()) -+ .then((data) => data.entries) -+ .catch((err) => console.log(err)) -+ } -+ } -+ -+ const entryKeys = { -+ all: ['entries'] as const, -+ list: () => [...entryKeys.all, 'list'] as const -+ } -+ -+ export const useEntries = () => { -+ ~~~~~~~~~~ -+!!! error TS2742: The inferred type of 'useEntries' cannot be named without a reference to '../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js'. This is likely not portable. A type annotation is necessary. -+ return useQuery({ -+ queryKey: entryKeys.list(), -+ queryFn: testApi.getEntries, -+ select: (data) => data.slice(0, 10) -+ }) -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js index 673b6e039b..30edd83e29 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js @@ -269,5 +269,5 @@ interface IEntry { Link: string; Category: string; } -export declare const useEntries: any; +export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js.diff deleted file mode 100644 index ec3ea4a418..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.declarationEmitUsingAlternativeContainingModules2.js -+++ new.declarationEmitUsingAlternativeContainingModules2.js -@@= skipped -268, +268 lines =@@ - Link: string; - Category: string; - } --export declare const useEntries: () => import("@tanstack/vue-query").UseQueryReturnType; -+export declare const useEntries: any; - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types index b08ed73d6e..f8a822a4d8 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types @@ -309,7 +309,7 @@ export { b as UseQueryReturnType, u as useQuery } from './useQuery-CPqkvEsh.js'; === src/index.mts === import { useQuery } from '@tanstack/vue-query' ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b +>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -411,12 +411,12 @@ const entryKeys = { } export const useEntries = () => { ->useEntries : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b ->() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b +>useEntries : () => import("@tanstack/vue-query").UseQueryReturnType +>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("@tanstack/vue-query").UseQueryReturnType return useQuery({ ->useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b +>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("@tanstack/vue-query").UseQueryReturnType +>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType >{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } queryKey: entryKeys.list(), diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types.diff index eca37cd14a..6bb4e8cca8 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingAlternativeContainingModules2.types.diff @@ -12,7 +12,7 @@ === src/index.mts === import { useQuery } from '@tanstack/vue-query' ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -+>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b ++>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType const baseUrl = 'https://api.publicapis.org/' >baseUrl : "https://api.publicapis.org/" @@ -31,14 +31,14 @@ export const useEntries = () => { ->useEntries : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b ->() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -+>useEntries : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b -+>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b ++>useEntries : () => import("@tanstack/vue-query").UseQueryReturnType ++>() => { return useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) })} : () => import("@tanstack/vue-query").UseQueryReturnType return useQuery({ ->useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b ->useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh").b -+>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b -+>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("../node_modules/@tanstack/vue-query/build/modern/useQuery-CPqkvEsh.js").b ++>useQuery({ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) }) : import("@tanstack/vue-query").UseQueryReturnType ++>useQuery : (options: { retry?: (number | boolean | ((failureCount: number, error: TError) => boolean)) | undefined; queryFn?: ((context: { queryKey: TQueryKey; }) => TQueryFnData | Promise) | undefined; queryKey?: TQueryKey | undefined; initialData?: TQueryFnData | undefined; initialDataUpdatedAt?: number | (() => number | undefined) | undefined; enabled?: boolean | undefined; refetchInterval?: number | undefined; select?: ((data: TQueryFnData) => TData) | undefined; } & { initialData?: undefined; }) => import("@tanstack/vue-query").UseQueryReturnType >{ queryKey: entryKeys.list(), queryFn: testApi.getEntries, select: (data) => data.slice(0, 10) } : { queryKey: readonly ["entries", "list"]; queryFn: () => Promise; select: (data: IEntry[]) => IEntry[]; } queryKey: entryKeys.list(), diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.errors.txt deleted file mode 100644 index 5a118caf72..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -src/index.ts(2,14): error TS2742: The inferred type of 'bar' cannot be named without a reference to '../node_modules/some-dep/dist'. This is likely not portable. A type annotation is necessary. - - -==== node_modules/some-dep/dist/inner.d.ts (0 errors) ==== - export declare type Other = { other: string }; - export declare type SomeType = { arg: Other }; - -==== node_modules/some-dep/dist/other.d.ts (0 errors) ==== - export declare const shouldLookupName: unique symbol; - export declare const shouldReuseLocalName: unique symbol; - export declare const reuseDepName: unique symbol; - export declare const shouldBeElided: unique symbol; - export declare const isNotAccessibleShouldError: unique symbol; - -==== node_modules/some-dep/dist/index.d.ts (0 errors) ==== - import { Other } from './inner' - import { shouldLookupName, reuseDepName, shouldReuseLocalName, shouldBeElided } from './other' - export declare const goodDeclaration: () => () => { - /** Other Can't be named in index.ts, but the whole conditional type can be resolved */ - shouldPrintResult: T extends Other? "O": "N", - /** Symbol shouldBeElided should not be present in index.d.ts, it might be since it's tracked before Other is seen and an error reported */ - shouldPrintResult2: T extends typeof shouldBeElided? Other: "N", - /** Specifier should come from module, local path should not be reused */ - shouldLookupName: typeof import('./other').shouldLookupName, - /** This is imported in index so local name should be reused */ - shouldReuseLocalName: typeof shouldReuseLocalName - /** This is NOT imported in index so import should be created */ - reuseDepName: typeof reuseDepName, - } - export { shouldLookupName, shouldReuseLocalName, reuseDepName, shouldBeElided }; - -==== node_modules/some-dep/package.json (0 errors) ==== - { - "name": "some-dep", - "exports": { - ".": "./dist/index.js" - } - } - -==== src/index.ts (1 errors) ==== - import { goodDeclaration, shouldReuseLocalName, shouldBeElided } from "some-dep"; - export const bar = goodDeclaration<{}>; - ~~~ -!!! error TS2742: The inferred type of 'bar' cannot be named without a reference to '../node_modules/some-dep/dist'. This is likely not portable. A type annotation is necessary. - - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.errors.txt.diff deleted file mode 100644 index 90d7603f9d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.errors.txt.diff +++ /dev/null @@ -1,50 +0,0 @@ ---- old.declarationEmitUsingTypeAlias2.errors.txt -+++ new.declarationEmitUsingTypeAlias2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/index.ts(2,14): error TS2742: The inferred type of 'bar' cannot be named without a reference to '../node_modules/some-dep/dist'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== node_modules/some-dep/dist/inner.d.ts (0 errors) ==== -+ export declare type Other = { other: string }; -+ export declare type SomeType = { arg: Other }; -+ -+==== node_modules/some-dep/dist/other.d.ts (0 errors) ==== -+ export declare const shouldLookupName: unique symbol; -+ export declare const shouldReuseLocalName: unique symbol; -+ export declare const reuseDepName: unique symbol; -+ export declare const shouldBeElided: unique symbol; -+ export declare const isNotAccessibleShouldError: unique symbol; -+ -+==== node_modules/some-dep/dist/index.d.ts (0 errors) ==== -+ import { Other } from './inner' -+ import { shouldLookupName, reuseDepName, shouldReuseLocalName, shouldBeElided } from './other' -+ export declare const goodDeclaration: () => () => { -+ /** Other Can't be named in index.ts, but the whole conditional type can be resolved */ -+ shouldPrintResult: T extends Other? "O": "N", -+ /** Symbol shouldBeElided should not be present in index.d.ts, it might be since it's tracked before Other is seen and an error reported */ -+ shouldPrintResult2: T extends typeof shouldBeElided? Other: "N", -+ /** Specifier should come from module, local path should not be reused */ -+ shouldLookupName: typeof import('./other').shouldLookupName, -+ /** This is imported in index so local name should be reused */ -+ shouldReuseLocalName: typeof shouldReuseLocalName -+ /** This is NOT imported in index so import should be created */ -+ reuseDepName: typeof reuseDepName, -+ } -+ export { shouldLookupName, shouldReuseLocalName, reuseDepName, shouldBeElided }; -+ -+==== node_modules/some-dep/package.json (0 errors) ==== -+ { -+ "name": "some-dep", -+ "exports": { -+ ".": "./dist/index.js" -+ } -+ } -+ -+==== src/index.ts (1 errors) ==== -+ import { goodDeclaration, shouldReuseLocalName, shouldBeElided } from "some-dep"; -+ export const bar = goodDeclaration<{}>; -+ ~~~ -+!!! error TS2742: The inferred type of 'bar' cannot be named without a reference to '../node_modules/some-dep/dist'. This is likely not portable. A type annotation is necessary. -+ -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js index 4ca6f918ea..5ed2438807 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js @@ -52,4 +52,10 @@ exports.bar = some_dep_1.goodDeclaration; //// [index.d.ts] import { shouldReuseLocalName } from "some-dep"; -export declare const bar: any; +export declare const bar: () => () => { + shouldPrintResult: "N"; + shouldPrintResult2: "N"; + shouldLookupName: typeof import("some-dep").shouldLookupName; + shouldReuseLocalName: typeof shouldReuseLocalName; + reuseDepName: typeof import("some-dep").reuseDepName; +}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js.diff index 787087abd6..7eaa0ca0ba 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitUsingTypeAlias2.js.diff @@ -8,13 +8,4 @@ +exports.bar = some_dep_1.goodDeclaration; - //// [index.d.ts] - import { shouldReuseLocalName } from "some-dep"; --export declare const bar: () => () => { -- shouldPrintResult: "N"; -- shouldPrintResult2: "N"; -- shouldLookupName: typeof import("some-dep").shouldLookupName; -- shouldReuseLocalName: typeof shouldReuseLocalName; -- reuseDepName: typeof import("some-dep").reuseDepName; --}; -+export declare const bar: any; \ No newline at end of file + //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types index 42b2bb2b16..e4078a07ad 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types +++ b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types @@ -20,7 +20,7 @@ export const Ctor: CtorConstructor; === node_modules/mod/index.d.ts === import { Ctor } from "./ctor"; ->Ctor : import("mod").CtorConstructor +>Ctor : import("./ctor").CtorConstructor export default Ctor; >Ctor : Ctor diff --git a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types.diff b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types.diff index 925977ffb5..2d2ae7b056 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationsIndirectGeneratedAliasReference.types.diff @@ -5,7 +5,7 @@ === node_modules/mod/index.d.ts === import { Ctor } from "./ctor"; ->Ctor : import("node_modules/mod/ctor").CtorConstructor -+>Ctor : import("mod").CtorConstructor ++>Ctor : import("./ctor").CtorConstructor export default Ctor; >Ctor : Ctor diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js b/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js index 7431930c19..90cd99c7cb 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js @@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.B = void 0; const tslib_1 = require("tslib"); const a_1 = require("./a"); -tslib_1.__exportStar(require("./a"), exports); +__exportStar(require("./a"), exports); class B extends a_1.A { } exports.B = B; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js.diff index 630abf9440..bfd2713705 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersAmd.js.diff @@ -41,7 +41,7 @@ +exports.B = void 0; +const tslib_1 = require("tslib"); +const a_1 = require("./a"); -+tslib_1.__exportStar(require("./a"), exports); ++__exportStar(require("./a"), exports); +class B extends a_1.A { +} +exports.B = B; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js b/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js index 560b8aec2b..f42aa4b0aa 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js @@ -30,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.B = void 0; const tslib_1 = require("tslib"); const a_1 = require("./a"); -tslib_1.__exportStar(require("./a"), exports); +__exportStar(require("./a"), exports); class B extends a_1.A { } exports.B = B; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js.diff index 43e6a2b986..9a04f608a2 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersSystem.js.diff @@ -68,7 +68,7 @@ +exports.B = void 0; +const tslib_1 = require("tslib"); +const a_1 = require("./a"); -+tslib_1.__exportStar(require("./a"), exports); ++__exportStar(require("./a"), exports); +class B extends a_1.A { +} +exports.B = B; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types index bebfa36125..380c52036b 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types @@ -6,7 +6,7 @@ export class A { } === b.ts === export * as a from "./a"; ->a : typeof import("./a.js") +>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types.diff index 409791731e..613a56088e 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2015).types.diff @@ -5,7 +5,7 @@ === b.ts === export * as a from "./a"; ->a : typeof import("a") -+>a : typeof import("./a.js") ++>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types index bebfa36125..380c52036b 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types @@ -6,7 +6,7 @@ export class A { } === b.ts === export * as a from "./a"; ->a : typeof import("./a.js") +>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types.diff index fd6d705b8a..11331710d2 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=false,module=es2020).types.diff @@ -5,7 +5,7 @@ === b.ts === export * as a from "./a"; ->a : typeof import("a") -+>a : typeof import("./a.js") ++>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js index ad2ad22bf4..8ba6cddd7d 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js @@ -23,4 +23,4 @@ exports.A = A; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; const tslib_1 = require("tslib"); -exports.a = tslib_1.__importStar(require("./a")); +exports.a = __importStar(require("./a")); diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js.diff index 1f723a3fc3..90ff88641e 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=amd).js.diff @@ -29,4 +29,4 @@ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +const tslib_1 = require("tslib"); -+exports.a = tslib_1.__importStar(require("./a")); \ No newline at end of file ++exports.a = __importStar(require("./a")); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types index bebfa36125..380c52036b 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types @@ -6,7 +6,7 @@ export class A { } === b.ts === export * as a from "./a"; ->a : typeof import("./a.js") +>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types.diff index 3e84b73191..b1b7e43897 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2015).types.diff @@ -5,7 +5,7 @@ === b.ts === export * as a from "./a"; ->a : typeof import("a") -+>a : typeof import("./a.js") ++>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types index bebfa36125..380c52036b 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types @@ -6,7 +6,7 @@ export class A { } === b.ts === export * as a from "./a"; ->a : typeof import("./a.js") +>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types.diff index 7d55d7148b..00e8f6b8cc 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=es2020).types.diff @@ -5,7 +5,7 @@ === b.ts === export * as a from "./a"; ->a : typeof import("a") -+>a : typeof import("./a.js") ++>a : typeof import("./a") === tslib.d.ts === declare module "tslib" { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js index ad2ad22bf4..8ba6cddd7d 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js @@ -23,4 +23,4 @@ exports.A = A; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; const tslib_1 = require("tslib"); -exports.a = tslib_1.__importStar(require("./a")); +exports.a = __importStar(require("./a")); diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js.diff index 98746f96dd..ffc74146dc 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithExportStarAs(esmoduleinterop=true,module=system).js.diff @@ -41,4 +41,4 @@ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +const tslib_1 = require("tslib"); -+exports.a = tslib_1.__importStar(require("./a")); \ No newline at end of file ++exports.a = __importStar(require("./a")); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js index f258390bb2..fa1ecf0470 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js @@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.a = exports.default = void 0; const tslib_1 = require("tslib"); const a_1 = require("./a"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(a_1).default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(a_1).default; } }); const a_2 = require("./a"); -Object.defineProperty(exports, "a", { enumerable: true, get: function () { return tslib_1.__importDefault(a_2).default; } }); -const a_3 = tslib_1.__importDefault(require("./a")); +Object.defineProperty(exports, "a", { enumerable: true, get: function () { return __importDefault(a_2).default; } }); +const a_3 = __importDefault(require("./a")); void a_3.default; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js.diff index 7ccea07d8d..dc425fa6b0 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=amd).js.diff @@ -31,8 +31,8 @@ +exports.a = exports.default = void 0; +const tslib_1 = require("tslib"); +const a_1 = require("./a"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(a_1).default; } }); ++Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(a_1).default; } }); +const a_2 = require("./a"); -+Object.defineProperty(exports, "a", { enumerable: true, get: function () { return tslib_1.__importDefault(a_2).default; } }); -+const a_3 = tslib_1.__importDefault(require("./a")); ++Object.defineProperty(exports, "a", { enumerable: true, get: function () { return __importDefault(a_2).default; } }); ++const a_3 = __importDefault(require("./a")); +void a_3.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js index f258390bb2..fa1ecf0470 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js @@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.a = exports.default = void 0; const tslib_1 = require("tslib"); const a_1 = require("./a"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(a_1).default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(a_1).default; } }); const a_2 = require("./a"); -Object.defineProperty(exports, "a", { enumerable: true, get: function () { return tslib_1.__importDefault(a_2).default; } }); -const a_3 = tslib_1.__importDefault(require("./a")); +Object.defineProperty(exports, "a", { enumerable: true, get: function () { return __importDefault(a_2).default; } }); +const a_3 = __importDefault(require("./a")); void a_3.default; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js.diff index 4b61bf3e39..e661a8e553 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportOrExportDefault(esmoduleinterop=true,module=system).js.diff @@ -49,8 +49,8 @@ +exports.a = exports.default = void 0; +const tslib_1 = require("tslib"); +const a_1 = require("./a"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(a_1).default; } }); ++Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(a_1).default; } }); +const a_2 = require("./a"); -+Object.defineProperty(exports, "a", { enumerable: true, get: function () { return tslib_1.__importDefault(a_2).default; } }); -+const a_3 = tslib_1.__importDefault(require("./a")); ++Object.defineProperty(exports, "a", { enumerable: true, get: function () { return __importDefault(a_2).default; } }); ++const a_3 = __importDefault(require("./a")); +void a_3.default; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js index acb7d3e90b..1306b3f263 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js @@ -24,5 +24,5 @@ exports.A = A; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; const tslib_1 = require("tslib"); -const a = tslib_1.__importStar(require("./a")); +const a = __importStar(require("./a")); exports.a = a; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js.diff index 9969fe761a..c6f1028e98 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=amd).js.diff @@ -30,5 +30,5 @@ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +const tslib_1 = require("tslib"); -+const a = tslib_1.__importStar(require("./a")); ++const a = __importStar(require("./a")); +exports.a = a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js index acb7d3e90b..1306b3f263 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js @@ -24,5 +24,5 @@ exports.A = A; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; const tslib_1 = require("tslib"); -const a = tslib_1.__importStar(require("./a")); +const a = __importStar(require("./a")); exports.a = a; diff --git a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js.diff b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js.diff index 48697076ec..45e689daac 100644 --- a/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js.diff +++ b/testdata/baselines/reference/submodule/compiler/importHelpersWithImportStarAs(esmoduleinterop=true,module=system).js.diff @@ -43,5 +43,5 @@ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +const tslib_1 = require("tslib"); -+const a = tslib_1.__importStar(require("./a")); ++const a = __importStar(require("./a")); +exports.a = a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js index cd762e790c..eb38b06bfc 100644 --- a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js +++ b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js @@ -22,4 +22,4 @@ exports.thing = (0, umd_1.makeThing)(); //// [index.d.ts] -export declare const thing: import("umd.d.ts").Thing; +export declare const thing: import("umd").Thing; diff --git a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff index b9c6c95cc4..2bdd49bfaa 100644 --- a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff +++ b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.js.diff @@ -8,7 +8,3 @@ +const umd_1 = require("umd"); exports.thing = (0, umd_1.makeThing)(); - - //// [index.d.ts] --export declare const thing: import("umd").Thing; -+export declare const thing: import("umd.d.ts").Thing; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types index 7ad7526809..b8bed6497c 100644 --- a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types +++ b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types @@ -16,10 +16,10 @@ export declare function makeThing(): Thing; === index.ts === import { makeThing } from "umd"; ->makeThing : () => import("umd.d.ts").Thing +>makeThing : () => import("umd").Thing export const thing = makeThing(); ->thing : import("umd.d.ts").Thing ->makeThing() : import("umd.d.ts").Thing ->makeThing : () => import("umd.d.ts").Thing +>thing : import("umd").Thing +>makeThing() : import("umd").Thing +>makeThing : () => import("umd").Thing diff --git a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types.diff b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types.diff index ed1352e43c..bdc11ea738 100644 --- a/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types.diff +++ b/testdata/baselines/reference/submodule/compiler/importShouldNotBeElidedInDeclarationEmit.types.diff @@ -14,12 +14,12 @@ === index.ts === import { makeThing } from "umd"; ->makeThing : () => import("node_modules/umd").Thing -+>makeThing : () => import("umd.d.ts").Thing ++>makeThing : () => import("umd").Thing export const thing = makeThing(); ->thing : import("node_modules/umd").Thing ->makeThing() : import("node_modules/umd").Thing ->makeThing : () => import("node_modules/umd").Thing -+>thing : import("umd.d.ts").Thing -+>makeThing() : import("umd.d.ts").Thing -+>makeThing : () => import("umd.d.ts").Thing ++>thing : import("umd").Thing ++>makeThing() : import("umd").Thing ++>makeThing : () => import("umd").Thing diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types index e62b6e0b32..935ccf7ad4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types @@ -5,7 +5,7 @@ const { Thing, useThing, cbThing } = require("./index"); >Thing : Readonly<{ a: "thing"; b: "chill"; }> >useThing : (x: Thing) => void >cbThing : (x: (x: Thing) => void) => void ->require("./index") : typeof import(".") +>require("./index") : typeof import("./index") >require : any >"./index" : "./index" diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types index 234116e431..f9e0364e35 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types @@ -102,14 +102,14 @@ export const selfClosing = ; === index.ts === export * as one from "./one.js"; ->one : typeof import("./one.jsx") +>one : typeof import("./one.js") export * as two from "./two.js"; ->two : typeof import("./two.jsx") +>two : typeof import("./two.js") export * as three from "./three.js"; ->three : typeof import("./three.jsx") +>three : typeof import("./three.js") export * as four from "./four.js"; ->four : typeof import("./four.jsx") +>four : typeof import("./four.js") diff --git a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types.diff b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types.diff index 79759b37ef..9bd7db4427 100644 --- a/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types.diff +++ b/testdata/baselines/reference/submodule/compiler/jsxRuntimePragma(jsx=preserve).types.diff @@ -5,16 +5,16 @@ === index.ts === export * as one from "./one.js"; ->one : typeof import("one") -+>one : typeof import("./one.jsx") ++>one : typeof import("./one.js") export * as two from "./two.js"; ->two : typeof import("two") -+>two : typeof import("./two.jsx") ++>two : typeof import("./two.js") export * as three from "./three.js"; ->three : typeof import("three") -+>three : typeof import("./three.jsx") ++>three : typeof import("./three.js") export * as four from "./four.js"; ->four : typeof import("four") -+>four : typeof import("./four.jsx") ++>four : typeof import("./four.js") diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt index 91b22417d6..6868c30946 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt @@ -1,10 +1,10 @@ -/src/index.ts(1,10): error TS2305: Module '"foo"' has no exported member 'y'. +/src/index.ts(1,10): error TS2305: Module '"../node_modules/foo"' has no exported member 'y'. ==== /src/index.ts (1 errors) ==== import { y } from "../node_modules/foo"; ~ -!!! error TS2305: Module '"foo"' has no exported member 'y'. +!!! error TS2305: Module '"../node_modules/foo"' has no exported member 'y'. ==== /node_modules/foo/index.js (0 errors) ==== exports.x = 0; diff --git a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt b/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt index cbce13f5eb..91637fa1f7 100644 --- a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt @@ -1,4 +1,4 @@ -a.ts(2,10): error TS2305: Module '"./b.js"' has no exported member 'default'. +a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. ==== b.ts (0 errors) ==== @@ -8,4 +8,4 @@ a.ts(2,10): error TS2305: Module '"./b.js"' has no exported member 'default'. export { b } from "./b"; export { default } from "./b"; ~~~~~~~ -!!! error TS2305: Module '"./b.js"' has no exported member 'default'. \ No newline at end of file +!!! error TS2305: Module '"./b"' has no exported member 'default'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt.diff deleted file mode 100644 index e2d095b0b2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/reexportMissingDefault7.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.reexportMissingDefault7.errors.txt -+++ new.reexportMissingDefault7.errors.txt -@@= skipped -0, +0 lines =@@ --a.ts(2,10): error TS2305: Module '"./b"' has no exported member 'default'. -+a.ts(2,10): error TS2305: Module '"./b.js"' has no exported member 'default'. - - - ==== b.ts (0 errors) ==== -@@= skipped -7, +7 lines =@@ - export { b } from "./b"; - export { default } from "./b"; - ~~~~~~~ --!!! error TS2305: Module '"./b"' has no exported member 'default'. -+!!! error TS2305: Module '"./b.js"' has no exported member 'default'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types index e3f3bda9dc..37c19f0e7b 100644 --- a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types +++ b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types @@ -17,9 +17,9 @@ import { BindingKey } from '@loopback/context'; export const CONTROLLER_CLASS = BindingKey.create(null as any); // line in question >CONTROLLER_CLASS : BindingKey >BindingKey.create(null as any) : BindingKey ->BindingKey.create : >(ctor: T) => BindingKey +>BindingKey.create : >(ctor: T) => BindingKey >BindingKey : typeof BindingKey ->create : >(ctor: T) => BindingKey +>create : >(ctor: T) => BindingKey >null as any : any === monorepo/context/src/value-promise.ts === diff --git a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types.diff b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types.diff index cdbd3396d4..33bc5bca1f 100644 --- a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types.diff +++ b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNames.types.diff @@ -5,10 +5,10 @@ >CONTROLLER_CLASS : BindingKey >BindingKey.create(null as any) : BindingKey ->BindingKey.create : >(ctor: T) => BindingKey -+>BindingKey.create : >(ctor: T) => BindingKey ++>BindingKey.create : >(ctor: T) => BindingKey >BindingKey : typeof BindingKey ->create : >(ctor: T) => BindingKey -+>create : >(ctor: T) => BindingKey ++>create : >(ctor: T) => BindingKey >null as any : any === monorepo/context/src/value-promise.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types index 1baf44e028..7d476d96a6 100644 --- a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types +++ b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types @@ -17,9 +17,9 @@ import { BindingKey } from '@loopback/context'; export const CONTROLLER_CLASS = BindingKey.create(null as any); // line in question >CONTROLLER_CLASS : BindingKey >BindingKey.create(null as any) : BindingKey ->BindingKey.create : >(ctor: T) => BindingKey +>BindingKey.create : >(ctor: T) => BindingKey >BindingKey : typeof BindingKey ->create : >(ctor: T) => BindingKey +>create : >(ctor: T) => BindingKey >null as any : any === /monorepo/context/src/value-promise.d.ts === diff --git a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types.diff b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types.diff index 4ff9e5e88c..99317073e9 100644 --- a/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types.diff +++ b/testdata/baselines/reference/submodule/compiler/symbolLinkDeclarationEmitModuleNamesRootDir.types.diff @@ -5,10 +5,10 @@ >CONTROLLER_CLASS : BindingKey >BindingKey.create(null as any) : BindingKey ->BindingKey.create : >(ctor: T) => BindingKey -+>BindingKey.create : >(ctor: T) => BindingKey ++>BindingKey.create : >(ctor: T) => BindingKey >BindingKey : typeof BindingKey ->create : >(ctor: T) => BindingKey -+>create : >(ctor: T) => BindingKey ++>create : >(ctor: T) => BindingKey >null as any : any === /monorepo/context/src/value-promise.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types b/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types index ee2f8fc4ca..872009e048 100644 --- a/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types +++ b/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types @@ -21,8 +21,8 @@ type __A = import("./a.ts").A; // ok >__A : A const aPromise = import("./a.ts"); // error ->aPromise : Promise ->import("./a.ts") : Promise +>aPromise : Promise +>import("./a.ts") : Promise >"./a.ts" : "./a.ts" === c.ts === @@ -38,7 +38,7 @@ type __A = import("./a.d.ts").A; // ok >__A : A const aPromise = import("./a.d.ts"); // error ->aPromise : Promise ->import("./a.d.ts") : Promise +>aPromise : Promise +>import("./a.d.ts") : Promise >"./a.d.ts" : "./a.d.ts" diff --git a/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types.diff b/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types.diff index 1fb318d6c4..a1e44f6634 100644 --- a/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types.diff +++ b/testdata/baselines/reference/submodule/conformance/allowsImportingTsExtension.types.diff @@ -6,8 +6,8 @@ const aPromise = import("./a.ts"); // error ->aPromise : Promise ->import("./a.ts") : Promise -+>aPromise : Promise -+>import("./a.ts") : Promise ++>aPromise : Promise ++>import("./a.ts") : Promise >"./a.ts" : "./a.ts" === c.ts === @@ -17,6 +17,6 @@ const aPromise = import("./a.d.ts"); // error ->aPromise : Promise ->import("./a.d.ts") : Promise -+>aPromise : Promise -+>import("./a.d.ts") : Promise ++>aPromise : Promise ++>import("./a.d.ts") : Promise >"./a.d.ts" : "./a.d.ts" diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt index 0bcb15e810..5f29972f17 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt @@ -1,6 +1,6 @@ -arbitraryModuleNamespaceIdentifiers_importEmpty.ts(4,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"missing"'. -arbitraryModuleNamespaceIdentifiers_importEmpty.ts(5,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"(missing)"'. -arbitraryModuleNamespaceIdentifiers_importEmpty.ts(6,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '""'. +arbitraryModuleNamespaceIdentifiers_importEmpty.ts(4,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"missing"'. +arbitraryModuleNamespaceIdentifiers_importEmpty.ts(5,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"(missing)"'. +arbitraryModuleNamespaceIdentifiers_importEmpty.ts(6,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '""'. ==== arbitraryModuleNamespaceIdentifiers_importEmpty.ts (3 errors) ==== @@ -9,13 +9,13 @@ arbitraryModuleNamespaceIdentifiers_importEmpty.ts(6,3): error TS2305: Module '" import { "missing" as x, ~~~~~~~~~ -!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"missing"'. +!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"missing"'. "(missing)" as y, ~~~~~~~~~~~ -!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"(missing)"'. +!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"(missing)"'. "" as z, ~~ -!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '""'. +!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '""'. } from "./arbitraryModuleNamespaceIdentifiers_importEmpty"; const xyz = [x, y, z]; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt.diff deleted file mode 100644 index 0aebf36e15..0000000000 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt -+++ new.arbitraryModuleNamespaceIdentifiers_importEmpty.errors.txt -@@= skipped -0, +0 lines =@@ --arbitraryModuleNamespaceIdentifiers_importEmpty.ts(4,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"missing"'. --arbitraryModuleNamespaceIdentifiers_importEmpty.ts(5,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"(missing)"'. --arbitraryModuleNamespaceIdentifiers_importEmpty.ts(6,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '""'. -+arbitraryModuleNamespaceIdentifiers_importEmpty.ts(4,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"missing"'. -+arbitraryModuleNamespaceIdentifiers_importEmpty.ts(5,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"(missing)"'. -+arbitraryModuleNamespaceIdentifiers_importEmpty.ts(6,3): error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '""'. - - - ==== arbitraryModuleNamespaceIdentifiers_importEmpty.ts (3 errors) ==== -@@= skipped -8, +8 lines =@@ - import { - "missing" as x, - ~~~~~~~~~ --!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"missing"'. -+!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"missing"'. - "(missing)" as y, - ~~~~~~~~~~~ --!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '"(missing)"'. -+!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '"(missing)"'. - "" as z, - ~~ --!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty"' has no exported member '""'. -+!!! error TS2305: Module '"./arbitraryModuleNamespaceIdentifiers_importEmpty.js"' has no exported member '""'. - } from "./arbitraryModuleNamespaceIdentifiers_importEmpty"; - const xyz = [x, y, z]; - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt index d11cd34bc2..e5307689df 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt @@ -1,17 +1,17 @@ type-clause-bad-export.ts(1,15): error TS1003: Identifier expected. type-clause-bad-import.ts(1,22): error TS1003: Identifier expected. type-clause-no-as.ts(1,15): error TS1003: Identifier expected. -type-clause-type-as-as.ts(1,15): error TS2305: Module '"./type-clause-valid.js"' has no exported member 'as'. +type-clause-type-as-as.ts(1,15): error TS2305: Module '"./type-clause-valid"' has no exported member 'as'. type-clause-type-as-as.ts(1,21): error TS1003: Identifier expected. type-decls-bad-export.ts(1,15): error TS1003: Identifier expected. type-decls-bad-import.ts(1,22): error TS1003: Identifier expected. type-decls-no-as.ts(1,15): error TS1003: Identifier expected. -type-decls-type-as.ts(1,15): error TS2305: Module '"./type-decls-valid.js"' has no exported member 'type'. +type-decls-type-as.ts(1,15): error TS2305: Module '"./type-decls-valid"' has no exported member 'type'. type-decls-type-as.ts(1,23): error TS1003: Identifier expected. values-bad-export.ts(1,10): error TS1003: Identifier expected. values-bad-import.ts(1,17): error TS1003: Identifier expected. values-no-as.ts(1,10): error TS1003: Identifier expected. -values-type-as.ts(1,10): error TS2305: Module '"./values-valid.js"' has no exported member 'type'. +values-type-as.ts(1,10): error TS2305: Module '"./values-valid"' has no exported member 'type'. values-type-as.ts(1,18): error TS1003: Identifier expected. @@ -41,7 +41,7 @@ values-type-as.ts(1,18): error TS1003: Identifier expected. ==== values-type-as.ts (2 errors) ==== import { type as "invalid 4" } from "./values-valid"; ~~~~ -!!! error TS2305: Module '"./values-valid.js"' has no exported member 'type'. +!!! error TS2305: Module '"./values-valid"' has no exported member 'type'. ~~~~~~~~~~~ !!! error TS1003: Identifier expected. @@ -72,7 +72,7 @@ values-type-as.ts(1,18): error TS1003: Identifier expected. ==== type-decls-type-as.ts (2 errors) ==== import type { type as "invalid 4" } from "./type-decls-valid"; ~~~~ -!!! error TS2305: Module '"./type-decls-valid.js"' has no exported member 'type'. +!!! error TS2305: Module '"./type-decls-valid"' has no exported member 'type'. ~~~~~~~~~~~ !!! error TS1003: Identifier expected. @@ -101,7 +101,7 @@ values-type-as.ts(1,18): error TS1003: Identifier expected. ==== type-clause-type-as-as.ts (2 errors) ==== import { type as as "invalid 4" } from "./type-clause-valid"; ~~ -!!! error TS2305: Module '"./type-clause-valid.js"' has no exported member 'as'. +!!! error TS2305: Module '"./type-clause-valid"' has no exported member 'as'. ~~~~~~~~~~~ !!! error TS1003: Identifier expected. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt.diff deleted file mode 100644 index 64f2b0a607..0000000000 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.errors.txt.diff +++ /dev/null @@ -1,50 +0,0 @@ ---- old.arbitraryModuleNamespaceIdentifiers_syntax.errors.txt -+++ new.arbitraryModuleNamespaceIdentifiers_syntax.errors.txt -@@= skipped -0, +0 lines =@@ - type-clause-bad-export.ts(1,15): error TS1003: Identifier expected. - type-clause-bad-import.ts(1,22): error TS1003: Identifier expected. - type-clause-no-as.ts(1,15): error TS1003: Identifier expected. --type-clause-type-as-as.ts(1,15): error TS2305: Module '"./type-clause-valid"' has no exported member 'as'. -+type-clause-type-as-as.ts(1,15): error TS2305: Module '"./type-clause-valid.js"' has no exported member 'as'. - type-clause-type-as-as.ts(1,21): error TS1003: Identifier expected. - type-decls-bad-export.ts(1,15): error TS1003: Identifier expected. - type-decls-bad-import.ts(1,22): error TS1003: Identifier expected. - type-decls-no-as.ts(1,15): error TS1003: Identifier expected. --type-decls-type-as.ts(1,15): error TS2305: Module '"./type-decls-valid"' has no exported member 'type'. -+type-decls-type-as.ts(1,15): error TS2305: Module '"./type-decls-valid.js"' has no exported member 'type'. - type-decls-type-as.ts(1,23): error TS1003: Identifier expected. - values-bad-export.ts(1,10): error TS1003: Identifier expected. - values-bad-import.ts(1,17): error TS1003: Identifier expected. - values-no-as.ts(1,10): error TS1003: Identifier expected. --values-type-as.ts(1,10): error TS2305: Module '"./values-valid"' has no exported member 'type'. -+values-type-as.ts(1,10): error TS2305: Module '"./values-valid.js"' has no exported member 'type'. - values-type-as.ts(1,18): error TS1003: Identifier expected. - - -@@= skipped -40, +40 lines =@@ - ==== values-type-as.ts (2 errors) ==== - import { type as "invalid 4" } from "./values-valid"; - ~~~~ --!!! error TS2305: Module '"./values-valid"' has no exported member 'type'. -+!!! error TS2305: Module '"./values-valid.js"' has no exported member 'type'. - ~~~~~~~~~~~ - !!! error TS1003: Identifier expected. - -@@= skipped -31, +31 lines =@@ - ==== type-decls-type-as.ts (2 errors) ==== - import type { type as "invalid 4" } from "./type-decls-valid"; - ~~~~ --!!! error TS2305: Module '"./type-decls-valid"' has no exported member 'type'. -+!!! error TS2305: Module '"./type-decls-valid.js"' has no exported member 'type'. - ~~~~~~~~~~~ - !!! error TS1003: Identifier expected. - -@@= skipped -29, +29 lines =@@ - ==== type-clause-type-as-as.ts (2 errors) ==== - import { type as as "invalid 4" } from "./type-clause-valid"; - ~~ --!!! error TS2305: Module '"./type-clause-valid"' has no exported member 'as'. -+!!! error TS2305: Module '"./type-clause-valid.js"' has no exported member 'as'. - ~~~~~~~~~~~ - !!! error TS1003: Identifier expected. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types index 82f6bd1012..145586e119 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types @@ -20,7 +20,7 @@ export { foo as "valid 3" } from "./values-valid"; >"valid 3" : 123 export * as "valid 4" from "./values-valid"; ->"valid 4" : typeof import("./values-valid.js") +>"valid 4" : typeof import("./values-valid") === values-bad-import.ts === import { foo as "invalid 2" } from "./values-valid"; @@ -60,7 +60,7 @@ export type { foo as "valid 3" } from "./type-decls-valid"; >"valid 3" : any export type * as "valid 4" from "./type-decls-valid"; ->"valid 4" : typeof import("./type-decls-valid.js") +>"valid 4" : typeof import("./type-decls-valid") === type-decls-bad-import.ts === import type { foo as "invalid 2" } from "./type-decls-valid"; diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types.diff index 5b70ee0104..3bb625b7b0 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types.diff +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_syntax.types.diff @@ -5,7 +5,7 @@ export * as "valid 4" from "./values-valid"; ->"valid 4" : typeof import("values-valid") -+>"valid 4" : typeof import("./values-valid.js") ++>"valid 4" : typeof import("./values-valid") === values-bad-import.ts === import { foo as "invalid 2" } from "./values-valid"; @@ -35,7 +35,7 @@ export type * as "valid 4" from "./type-decls-valid"; ->"valid 4" : typeof import("type-decls-valid") -+>"valid 4" : typeof import("./type-decls-valid.js") ++>"valid 4" : typeof import("./type-decls-valid") === type-decls-bad-import.ts === import type { foo as "invalid 2" } from "./type-decls-valid"; diff --git a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt index 45c6215ffe..7b37a0edde 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt @@ -1,6 +1,6 @@ -/main.cts(1,10): error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. -/main.mts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. -/main.ts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. +/main.cts(1,10): error TS2305: Module '"dual"' has no exported member 'esm'. +/main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. +/main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. ==== /node_modules/dual/package.json (0 errors) ==== @@ -33,15 +33,15 @@ ==== /main.ts (1 errors) ==== import { esm, cjs } from "dual"; ~~~ -!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. ==== /main.mts (1 errors) ==== import { esm, cjs } from "dual"; ~~~ -!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. ==== /main.cts (1 errors) ==== import { esm, cjs } from "dual"; ~~~ -!!! error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. +!!! error TS2305: Module '"dual"' has no exported member 'esm'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt.diff index 50b984ab39..03de766a92 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=esnext).errors.txt.diff @@ -7,41 +7,17 @@ -error TS6504: File '/node_modules/dual/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? - The file is in the program because: - Root file specified for compilation --/main.cts(1,10): error TS2305: Module '"dual"' has no exported member 'esm'. --/main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. --/main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. -- -- + /main.cts(1,10): error TS2305: Module '"dual"' has no exported member 'esm'. + /main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. + /main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. + + -!!! error TS6504: File '/node_modules/dual/index.cjs' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation -!!! error TS6504: File '/node_modules/dual/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation -+/main.cts(1,10): error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. -+/main.mts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. -+/main.ts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. -+ -+ ==== /node_modules/dual/package.json (0 errors) ==== { - "name": "dual", -@@= skipped -44, +32 lines =@@ - ==== /main.ts (1 errors) ==== - import { esm, cjs } from "dual"; - ~~~ --!!! error TS2305: Module '"dual"' has no exported member 'cjs'. -+!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. - - ==== /main.mts (1 errors) ==== - import { esm, cjs } from "dual"; - ~~~ --!!! error TS2305: Module '"dual"' has no exported member 'cjs'. -+!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. - - ==== /main.cts (1 errors) ==== - import { esm, cjs } from "dual"; - ~~~ --!!! error TS2305: Module '"dual"' has no exported member 'esm'. -+!!! error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. - \ No newline at end of file + "name": "dual", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt index 45c6215ffe..7b37a0edde 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt @@ -1,6 +1,6 @@ -/main.cts(1,10): error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. -/main.mts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. -/main.ts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. +/main.cts(1,10): error TS2305: Module '"dual"' has no exported member 'esm'. +/main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. +/main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. ==== /node_modules/dual/package.json (0 errors) ==== @@ -33,15 +33,15 @@ ==== /main.ts (1 errors) ==== import { esm, cjs } from "dual"; ~~~ -!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. ==== /main.mts (1 errors) ==== import { esm, cjs } from "dual"; ~~~ -!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. ==== /main.cts (1 errors) ==== import { esm, cjs } from "dual"; ~~~ -!!! error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. +!!! error TS2305: Module '"dual"' has no exported member 'esm'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt.diff index 9c55a0283d..d957e01b34 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/bundlerNodeModules1(module=preserve).errors.txt.diff @@ -7,41 +7,17 @@ -error TS6504: File '/node_modules/dual/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? - The file is in the program because: - Root file specified for compilation --/main.cts(1,10): error TS2305: Module '"dual"' has no exported member 'esm'. --/main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. --/main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. -- -- + /main.cts(1,10): error TS2305: Module '"dual"' has no exported member 'esm'. + /main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. + /main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. + + -!!! error TS6504: File '/node_modules/dual/index.cjs' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation -!!! error TS6504: File '/node_modules/dual/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation -+/main.cts(1,10): error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. -+/main.mts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. -+/main.ts(1,15): error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. -+ -+ ==== /node_modules/dual/package.json (0 errors) ==== { - "name": "dual", -@@= skipped -44, +32 lines =@@ - ==== /main.ts (1 errors) ==== - import { esm, cjs } from "dual"; - ~~~ --!!! error TS2305: Module '"dual"' has no exported member 'cjs'. -+!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. - - ==== /main.mts (1 errors) ==== - import { esm, cjs } from "dual"; - ~~~ --!!! error TS2305: Module '"dual"' has no exported member 'cjs'. -+!!! error TS2305: Module '"./node_modules/dual/index.js"' has no exported member 'cjs'. - - ==== /main.cts (1 errors) ==== - import { esm, cjs } from "dual"; - ~~~ --!!! error TS2305: Module '"dual"' has no exported member 'esm'. -+!!! error TS2305: Module '"./node_modules/dual/index.d.cts"' has no exported member 'esm'. - \ No newline at end of file + "name": "dual", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types b/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types index 6d13743759..2d3871023b 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types @@ -24,7 +24,7 @@ export class HTML5Element extends HTMLElement { === file.d.ts === export * as mod from "./component.html"; ->mod : typeof import("./component.d.html.js") +>mod : typeof import("./component.html") === main.ts === import { mod } from "./file.js"; diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types.diff index b998fbb4ef..102ed2516f 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types.diff +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForHtmlFileWithinDeclarationFile.types.diff @@ -5,7 +5,7 @@ === file.d.ts === export * as mod from "./component.html"; ->mod : typeof import("component.d.html") -+>mod : typeof import("./component.d.html.js") ++>mod : typeof import("./component.html") === main.ts === import { mod } from "./file.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types index e7d2d652ef..14f26848aa 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as ns from './0'; ->ns : typeof import("./0.js") +>ns : typeof import("./0") ns.a; >ns.a : any diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types.diff index 79ab937e83..33fd4b2451 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=es2015).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as ns from './0'; ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") ns.a; >ns.a : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types index e7d2d652ef..14f26848aa 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as ns from './0'; ->ns : typeof import("./0.js") +>ns : typeof import("./0") ns.a; >ns.a : any diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types.diff index f28116170b..30cad1becf 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace1(module=esnext).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as ns from './0'; ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") ns.a; >ns.a : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types index fcf37f4f85..aafa9eacca 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as ns from './0'; ->ns : typeof import("./0.js") +>ns : typeof import("./0") ns.a; >ns.a : any diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types.diff index 0f824e147c..490344fd6f 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=es2015).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as ns from './0'; ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") ns.a; >ns.a : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types index fcf37f4f85..aafa9eacca 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as ns from './0'; ->ns : typeof import("./0.js") +>ns : typeof import("./0") ns.a; >ns.a : any diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types.diff index 2a4ece76df..5853f35ca6 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace2(module=esnext).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as ns from './0'; ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") ns.a; >ns.a : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types index 0cdb12b02c..125c02e1a9 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as ns from './0'; ->ns : typeof import("./0.js") +>ns : typeof import("./0") ns.a; >ns.a : number diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types.diff index 2e7529d65d..1d7c5ef9de 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=es2015).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as ns from './0'; ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") ns.a; >ns.a : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types index 0cdb12b02c..125c02e1a9 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as ns from './0'; ->ns : typeof import("./0.js") +>ns : typeof import("./0") ns.a; >ns.a : number diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types.diff index c1e35cb9c8..76284e883b 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace3(module=esnext).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as ns from './0'; ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") ns.a; >ns.a : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types index 647c639237..537720d322 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as default from './0'; ->default : typeof import("./0.js") +>default : typeof import("./0") === 11.ts === import * as ns from './0'; diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types.diff index 8432d14fb1..dc622a0f3d 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=es2015).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as default from './0'; ->default : typeof import("0") -+>default : typeof import("./0.js") ++>default : typeof import("./0") === 11.ts === import * as ns from './0'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types index 647c639237..537720d322 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types @@ -11,7 +11,7 @@ export const b = 2; === 1.ts === export * as default from './0'; ->default : typeof import("./0.js") +>default : typeof import("./0") === 11.ts === import * as ns from './0'; diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types.diff index f237e1ea05..cd98542e89 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace4(module=esnext).types.diff @@ -5,7 +5,7 @@ === 1.ts === export * as default from './0'; ->default : typeof import("0") -+>default : typeof import("./0.js") ++>default : typeof import("./0") === 11.ts === import * as ns from './0'; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types b/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types index c0e545ba4b..33008837e8 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types @@ -9,7 +9,7 @@ declare const Named: 0; === two.d.ts === export * as default from "./three"; ->default : typeof import("./three.js") +>default : typeof import("./three") === one.ts === import ns from "./two"; diff --git a/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types.diff b/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types.diff index 029fd0e599..ed5a3d3564 100644 --- a/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types.diff +++ b/testdata/baselines/reference/submodule/conformance/exportAsNamespace5.types.diff @@ -5,7 +5,7 @@ === two.d.ts === export * as default from "./three"; ->default : typeof import("three") -+>default : typeof import("./three.js") ++>default : typeof import("./three") === one.ts === import ns from "./two"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types index 44a7029856..511738644c 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types @@ -22,7 +22,7 @@ export * from './0' assert { type: "json" } >type : any export * as ns from './0' assert { type: "json" } ->ns : typeof import("./0.js") +>ns : typeof import("./0") >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types.diff index c2e25560a4..9d1c5da071 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=es2015).types.diff @@ -5,7 +5,7 @@ export * as ns from './0' assert { type: "json" } ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") >type : any === 2.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types index 44a7029856..511738644c 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types @@ -22,7 +22,7 @@ export * from './0' assert { type: "json" } >type : any export * as ns from './0' assert { type: "json" } ->ns : typeof import("./0.js") +>ns : typeof import("./0") >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types.diff index 86e364809a..7d4d6fbf4e 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAssertion2(module=esnext).types.diff @@ -20,7 +20,7 @@ export * as ns from './0' assert { type: "json" } ->ns : typeof import("0") ->type : error -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") +>type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types index a8f0ef2967..764bc09625 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types @@ -9,7 +9,7 @@ export type {} from './0' assert { type: "json" } >type : any export type { I } from './0' assert { type: "json" } ->I : import("./0.js").I +>I : import("./0").I >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types.diff index 3b2b8ad2df..35d3ca6c0a 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=es2015).types.diff @@ -5,7 +5,7 @@ export type { I } from './0' assert { type: "json" } ->I : import("0").I -+>I : import("./0.js").I ++>I : import("./0").I >type : any === 2.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types index a8f0ef2967..764bc09625 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types @@ -9,7 +9,7 @@ export type {} from './0' assert { type: "json" } >type : any export type { I } from './0' assert { type: "json" } ->I : import("./0.js").I +>I : import("./0").I >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types.diff index a097ab6f44..676d20ddd5 100644 --- a/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAssertion3(module=esnext).types.diff @@ -5,7 +5,7 @@ export type { I } from './0' assert { type: "json" } ->I : import("0").I -+>I : import("./0.js").I ++>I : import("./0").I >type : any === 2.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types index 9a8017cfeb..6008d0b89b 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types @@ -22,7 +22,7 @@ export * from './0' with { type: "json" } >type : any export * as ns from './0' with { type: "json" } ->ns : typeof import("./0.js") +>ns : typeof import("./0") >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types.diff index cdad2785c6..7d3bbc04a8 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=es2015).types.diff @@ -5,7 +5,7 @@ export * as ns from './0' with { type: "json" } ->ns : typeof import("0") -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") >type : any === 2.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types index 9a8017cfeb..6008d0b89b 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types @@ -22,7 +22,7 @@ export * from './0' with { type: "json" } >type : any export * as ns from './0' with { type: "json" } ->ns : typeof import("./0.js") +>ns : typeof import("./0") >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types.diff index 0fc0c049c2..501f9e1204 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAttributes2(module=esnext).types.diff @@ -20,7 +20,7 @@ export * as ns from './0' with { type: "json" } ->ns : typeof import("0") ->type : error -+>ns : typeof import("./0.js") ++>ns : typeof import("./0") +>type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types index 48a1588806..7b71ed23de 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types @@ -9,7 +9,7 @@ export type {} from './0' with { type: "json" } >type : any export type { I } from './0' with { type: "json" } ->I : import("./0.js").I +>I : import("./0").I >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types.diff index 01ccbfea38..c7454f0752 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=es2015).types.diff @@ -5,7 +5,7 @@ export type { I } from './0' with { type: "json" } ->I : import("0").I -+>I : import("./0.js").I ++>I : import("./0").I >type : any === 2.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types index 48a1588806..7b71ed23de 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types @@ -9,7 +9,7 @@ export type {} from './0' with { type: "json" } >type : any export type { I } from './0' with { type: "json" } ->I : import("./0.js").I +>I : import("./0").I >type : any === 2.ts === diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types.diff index 2b9a3a8282..af2a947fe3 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/importAttributes3(module=esnext).types.diff @@ -5,7 +5,7 @@ export type { I } from './0' with { type: "json" } ->I : import("0").I -+>I : import("./0.js").I ++>I : import("./0").I >type : any === 2.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types index 9058f0ef06..feb034a32d 100644 --- a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types +++ b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types @@ -6,9 +6,9 @@ export const a = async () => (await import("inner")).x(); >async () => (await import("inner")).x() : () => Promise >(await import("inner")).x() : import("./node_modules/inner/private").Thing >(await import("inner")).x : () => import("./node_modules/inner/private").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("./node_modules/inner"); } ->await import("inner") : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("./node_modules/inner"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/private").Thing; default: typeof import("./node_modules/inner"); }> +>(await import("inner")) : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("inner"); } +>await import("inner") : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("inner"); } +>import("inner") : Promise<{ x: () => import("./node_modules/inner/private").Thing; default: typeof import("inner"); }> >"inner" : "inner" >x : () => import("./node_modules/inner/private").Thing diff --git a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff index 0c5b9a5d89..706aef9a88 100644 --- a/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff +++ b/testdata/baselines/reference/submodule/conformance/legacyNodeModulesExportsSpecifierGenerationConditions.types.diff @@ -15,9 +15,9 @@ +>async () => (await import("inner")).x() : () => Promise +>(await import("inner")).x() : import("./node_modules/inner/private").Thing +>(await import("inner")).x : () => import("./node_modules/inner/private").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("./node_modules/inner"); } -+>await import("inner") : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("./node_modules/inner"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/private").Thing; default: typeof import("./node_modules/inner"); }> ++>(await import("inner")) : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("inner"); } ++>await import("inner") : { x: () => import("./node_modules/inner/private").Thing; default: typeof import("inner"); } ++>import("inner") : Promise<{ x: () => import("./node_modules/inner/private").Thing; default: typeof import("inner"); }> >"inner" : "inner" ->x : () => import("node_modules/inner/private").Thing +>x : () => import("./node_modules/inner/private").Thing diff --git a/testdata/baselines/reference/submodule/conformance/node10AlternateResult_noResolution.errors.txt b/testdata/baselines/reference/submodule/conformance/node10AlternateResult_noResolution.errors.txt index 7f24128a64..b16c7108d3 100644 --- a/testdata/baselines/reference/submodule/conformance/node10AlternateResult_noResolution.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/node10AlternateResult_noResolution.errors.txt @@ -1,4 +1,4 @@ -/index.ts(1,10): error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. +/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. ==== /node_modules/pkg/package.json (0 errors) ==== @@ -16,5 +16,5 @@ ==== /index.ts (1 errors) ==== import { pkg } from "pkg"; ~~~ -!!! error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. +!!! error TS2305: Module '"pkg"' has no exported member 'pkg'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/node10Alternateresult_noTypes.errors.txt b/testdata/baselines/reference/submodule/conformance/node10Alternateresult_noTypes.errors.txt index ad46bb4253..c576a45745 100644 --- a/testdata/baselines/reference/submodule/conformance/node10Alternateresult_noTypes.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/node10Alternateresult_noTypes.errors.txt @@ -1,4 +1,4 @@ -/index.ts(1,10): error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. +/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. ==== /node_modules/pkg/package.json (0 errors) ==== @@ -20,5 +20,5 @@ ==== /index.ts (1 errors) ==== import { pkg } from "pkg"; ~~~ -!!! error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. +!!! error TS2305: Module '"pkg"' has no exported member 'pkg'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt index 6b491a6138..534056af01 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt @@ -10,7 +10,6 @@ other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed wh other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. @@ -26,10 +25,8 @@ other2.cts(2,14): error TS2742: The inferred type of 'd' cannot be named without other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other2.cts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. other2.ts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. @@ -90,7 +87,7 @@ other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promis !!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.mts (9 errors) ==== +==== other.mts (8 errors) ==== // esm format file export const a = await import("package/cjs"); ~~~~~ @@ -108,24 +105,18 @@ other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promis ~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const f = await import("inner"); - ~ -!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.mts (6 errors) ==== +==== other2.mts (4 errors) ==== // esm format file export const d = await import("inner/cjs"); - ~ -!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. export const e = await import("inner/mjs"); - ~ -!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff index dd1cab4c21..228292c66b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).errors.txt.diff @@ -14,7 +14,6 @@ +other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. +other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. @@ -30,10 +29,8 @@ +other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +other2.cts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. +other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. +other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. +other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +other2.ts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. @@ -94,7 +91,7 @@ +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.mts (9 errors) ==== ++==== other.mts (8 errors) ==== + // esm format file + export const a = await import("package/cjs"); + ~~~~~ @@ -112,24 +109,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. + export const f = await import("inner"); -+ ~ -+!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. + ~~~~~ +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. + ~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.mts (6 errors) ==== ++==== other2.mts (4 errors) ==== + // esm format file + export const d = await import("inner/cjs"); -+ ~ -+!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. + ~~~~~ +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + export const e = await import("inner/mjs"); -+ ~ -+!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. + ~~~~~ +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. + ~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js index f61cbec02c..09d59ac0ff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js @@ -150,14 +150,23 @@ export declare const d: any; export declare const e: any; //// [other.d.mts] // esm format file -export declare const a: typeof import("./index.cts"); -export declare const b: typeof import("./index.mts"); -export declare const c: typeof import("./index.js"); -export declare const f: any; +export declare const a: typeof import("package/cjs"); +export declare const b: typeof import("package/mjs"); +export declare const c: typeof import("package"); +export declare const f: { + cjsMain: true; + default: typeof import("inner"); +}; //// [other2.d.mts] // esm format file -export declare const d: any; -export declare const e: any; +export declare const d: { + cjsNonmain: true; + default: typeof import("inner/cjs"); +}; +export declare const e: { + esm: true; + default: typeof import("inner/mjs"); +}; //// [other.d.cts] // cjs format file, no TLA export declare const a: Promise; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff index cee3cb8401..966545ee2e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).js.diff @@ -101,26 +101,25 @@ -export declare const a: { - default: typeof import("package/cjs"); -}; --export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); --export declare const f: { -- cjsMain: true; -- default: typeof import("inner"); --}; +// esm format file -+export declare const a: typeof import("./index.cts"); -+export declare const b: typeof import("./index.mts"); -+export declare const c: typeof import("./index.js"); -+export declare const f: any; ++export declare const a: typeof import("package/cjs"); + export declare const b: typeof import("package/mjs"); + export declare const c: typeof import("package"); + export declare const f: { +@@= skipped -32, +28 lines =@@ + default: typeof import("inner"); + }; //// [other2.d.mts] --export declare const d: { -- cjsNonmain: true; -- default: typeof import("inner/cjs"); --}; --export declare const e: typeof import("inner/mjs"); +// esm format file -+export declare const d: any; -+export declare const e: any; + export declare const d: { + cjsNonmain: true; + default: typeof import("inner/cjs"); + }; +-export declare const e: typeof import("inner/mjs"); ++export declare const e: { ++ esm: true; ++ default: typeof import("inner/mjs"); ++}; //// [other.d.cts] -export declare const a: Promise<{ - default: typeof import("./index.cjs"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types index 082864b12a..6886f9c9a1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types @@ -55,41 +55,41 @@ export const e = await import("inner/mjs"); === other.mts === // esm format file export const a = await import("package/cjs"); ->a : typeof import("./index.cts") ->await import("package/cjs") : typeof import("./index.cts") ->import("package/cjs") : Promise +>a : typeof import("package/cjs") +>await import("package/cjs") : typeof import("package/cjs") +>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("./index.mts") ->await import("package/mjs") : typeof import("./index.mts") ->import("package/mjs") : Promise +>b : typeof import("package/mjs") +>await import("package/mjs") : typeof import("package/mjs") +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("./index.js") ->await import("package") : typeof import("./index.js") ->import("package") : Promise +>c : typeof import("package") +>await import("package") : typeof import("package") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner/index.js"); }> +>f : { cjsMain: true; default: typeof import("inner"); } +>await import("inner") : { cjsMain: true; default: typeof import("inner"); } +>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> >"inner" : "inner" === other2.mts === // esm format file export const d = await import("inner/cjs"); ->d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> +>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } +>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } +>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> +>e : { esm: true; default: typeof import("inner/mjs"); } +>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } +>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> >"inner/mjs" : "inner/mjs" === other.cts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff index f658535292..7b1cf0387b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node18).types.diff @@ -65,36 +65,36 @@ ->a : { default: typeof import("index"); } ->await import("package/cjs") : { default: typeof import("index"); } ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : typeof import("./index.cts") -+>await import("package/cjs") : typeof import("./index.cts") -+>import("package/cjs") : Promise ++>a : typeof import("package/cjs") ++>await import("package/cjs") : typeof import("package/cjs") ++>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("index") ->await import("package/mjs") : typeof import("index") ->import("package/mjs") : Promise -+>b : typeof import("./index.mts") -+>await import("package/mjs") : typeof import("./index.mts") -+>import("package/mjs") : Promise ++>b : typeof import("package/mjs") ++>await import("package/mjs") : typeof import("package/mjs") ++>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("index") ->await import("package") : typeof import("index") ->import("package") : Promise -+>c : typeof import("./index.js") -+>await import("package") : typeof import("./index.js") -+>import("package") : Promise ++>c : typeof import("package") ++>await import("package") : typeof import("package") ++>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner") : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> -+>f : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner/index.js"); }> ++>f : { cjsMain: true; default: typeof import("inner"); } ++>await import("inner") : { cjsMain: true; default: typeof import("inner"); } ++>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> >"inner" : "inner" === other2.mts === @@ -103,18 +103,18 @@ ->d : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> -+>d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> ++>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } ++>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } ++>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> ++>e : { esm: true; default: typeof import("inner/mjs"); } ++>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } ++>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> >"inner/mjs" : "inner/mjs" === other.cts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 1d7240fa28..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,95 +0,0 @@ -other.cts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -other.mts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -other.ts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -other2.cts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -other2.mts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -other2.mts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -other2.ts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -other2.ts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. - - -==== 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 (1 errors) ==== - // 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"); - ~ -!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -==== other2.ts (2 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~ -!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. - export const e = await import("inner/mjs"); - ~ -!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -==== other.mts (1 errors) ==== - // 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"); - ~ -!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -==== other2.mts (2 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~ -!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. - export const e = await import("inner/mjs"); - ~ -!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -==== other.cts (1 errors) ==== - // cjs format file, no TLA - export const a = import("package/cjs"); - export const b = import("package/mjs"); - export const c = import("package"); - export const f = import("inner"); - ~ -!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -==== other2.cts (1 errors) ==== - // cjs format file, no TLA - export const d = import("inner/cjs"); - ~ -!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. - export const e = import("inner/mjs"); -==== 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=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index ea090787ea..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,99 +0,0 @@ ---- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+other.cts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -+other.mts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -+other.ts(5,14): error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -+other2.cts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+other2.mts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+other2.mts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+other2.ts(2,14): error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+other2.ts(3,14): error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== 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 (1 errors) ==== -+ // 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"); -+ ~ -+!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -+==== other2.ts (2 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~ -+!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+ export const e = await import("inner/mjs"); -+ ~ -+!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+==== other.mts (1 errors) ==== -+ // 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"); -+ ~ -+!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner/index.js'. This is likely not portable. A type annotation is necessary. -+==== other2.mts (2 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~ -+!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+ export const e = await import("inner/mjs"); -+ ~ -+!!! error TS2742: The inferred type of 'e' cannot be named without a reference to './node_modules/inner/index.d.mts'. This is likely not portable. A type annotation is necessary. -+==== other.cts (1 errors) ==== -+ // cjs format file, no TLA -+ export const a = import("package/cjs"); -+ export const b = import("package/mjs"); -+ export const c = import("package"); -+ export const f = import("inner"); -+ ~ -+!!! error TS2742: The inferred type of 'f' cannot be named without a reference to './node_modules/inner'. This is likely not portable. A type annotation is necessary. -+==== other2.cts (1 errors) ==== -+ // cjs format file, no TLA -+ export const d = import("inner/cjs"); -+ ~ -+!!! error TS2742: The inferred type of 'd' cannot be named without a reference to './node_modules/inner/index.d.cts'. This is likely not portable. A type annotation is necessary. -+ export const e = import("inner/mjs"); -+==== 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=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js index 459c78b395..39cd09d224 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js @@ -126,34 +126,58 @@ export {}; export {}; //// [other.d.ts] // esm format file -export declare const a: typeof import("./index.cts"); -export declare const b: typeof import("./index.mts"); -export declare const c: typeof import("./index.js"); -export declare const f: any; +export declare const a: typeof import("package/cjs"); +export declare const b: typeof import("package/mjs"); +export declare const c: typeof import("package"); +export declare const f: { + cjsMain: true; + default: typeof import("inner"); +}; //// [other2.d.ts] // esm format file -export declare const d: any; -export declare const e: any; +export declare const d: { + cjsNonmain: true; + default: typeof import("inner/cjs"); +}; +export declare const e: { + esm: true; + default: typeof import("inner/mjs"); +}; //// [other.d.mts] // esm format file -export declare const a: typeof import("./index.cts"); -export declare const b: typeof import("./index.mts"); -export declare const c: typeof import("./index.js"); -export declare const f: any; +export declare const a: typeof import("package/cjs"); +export declare const b: typeof import("package/mjs"); +export declare const c: typeof import("package"); +export declare const f: { + cjsMain: true; + default: typeof import("inner"); +}; //// [other2.d.mts] // esm format file -export declare const d: any; -export declare const e: any; +export declare const d: { + cjsNonmain: true; + default: typeof import("inner/cjs"); +}; +export declare const e: { + esm: true; + default: typeof import("inner/mjs"); +}; //// [other.d.cts] // cjs format file, no TLA export declare const a: Promise; -export declare const b: Promise; -export declare const c: Promise; -export declare const f: any; +export declare const b: Promise; +export declare const c: Promise; +export declare const f: Promise<{ + cjsMain: true; + default: typeof import("inner", { with: { "resolution-mode": "import" } }); +}>; //// [other2.d.cts] // cjs format file, no TLA -export declare const d: any; +export declare const d: Promise<{ + cjsNonmain: true; + default: typeof import("inner/cjs", { with: { "resolution-mode": "import" } }); +}>; export declare const e: Promise<{ esm: true; - default: typeof import("./node_modules/inner/index.d.mts", { with: { "resolution-mode": "import" } }); + default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }>; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff index e13239f438..503f662b26 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).js.diff @@ -16,73 +16,71 @@ -export declare const a: { - default: typeof import("package/cjs"); -}; --export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); --export declare const f: { -- cjsMain: true; -- default: typeof import("inner"); --}; +// esm format file -+export declare const a: typeof import("./index.cts"); -+export declare const b: typeof import("./index.mts"); -+export declare const c: typeof import("./index.js"); -+export declare const f: any; ++export declare const a: typeof import("package/cjs"); + export declare const b: typeof import("package/mjs"); + export declare const c: typeof import("package"); + export declare const f: { +@@= skipped -16, +18 lines =@@ + default: typeof import("inner"); + }; //// [other2.d.ts] --export declare const d: { -- cjsNonmain: true; -- default: typeof import("inner/cjs"); --}; --export declare const e: typeof import("inner/mjs"); +// esm format file -+export declare const d: any; -+export declare const e: any; + export declare const d: { + cjsNonmain: true; + default: typeof import("inner/cjs"); + }; +-export declare const e: typeof import("inner/mjs"); ++export declare const e: { ++ esm: true; ++ default: typeof import("inner/mjs"); ++}; //// [other.d.mts] -export declare const a: { - default: typeof import("package/cjs"); -}; --export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); --export declare const f: { -- cjsMain: true; -- default: typeof import("inner"); --}; +// esm format file -+export declare const a: typeof import("./index.cts"); -+export declare const b: typeof import("./index.mts"); -+export declare const c: typeof import("./index.js"); -+export declare const f: any; ++export declare const a: typeof import("package/cjs"); + export declare const b: typeof import("package/mjs"); + export declare const c: typeof import("package"); + export declare const f: { +@@= skipped -16, +19 lines =@@ + default: typeof import("inner"); + }; //// [other2.d.mts] --export declare const d: { -- cjsNonmain: true; -- default: typeof import("inner/cjs"); --}; --export declare const e: typeof import("inner/mjs"); +// esm format file -+export declare const d: any; -+export declare const e: any; + export declare const d: { + cjsNonmain: true; + default: typeof import("inner/cjs"); + }; +-export declare const e: typeof import("inner/mjs"); ++export declare const e: { ++ esm: true; ++ default: typeof import("inner/mjs"); ++}; //// [other.d.cts] -export declare const a: Promise<{ - default: typeof import("./index.cjs"); -}>; --export declare const b: Promise; --export declare const c: Promise; --export declare const f: Promise<{ -- cjsMain: true; -- default: typeof import("inner"); --}>; +// cjs format file, no TLA +export declare const a: Promise; -+export declare const b: Promise; -+export declare const c: Promise; -+export declare const f: any; + export declare const b: Promise; + export declare const c: Promise; + export declare const f: Promise<{ + cjsMain: true; +- default: typeof import("inner"); ++ default: typeof import("inner", { with: { "resolution-mode": "import" } }); + }>; //// [other2.d.cts] --export declare const d: Promise<{ -- cjsNonmain: true; -- default: typeof import("inner/cjs"); +// cjs format file, no TLA -+export declare const d: any; + export declare const d: Promise<{ + cjsNonmain: true; +- default: typeof import("inner/cjs"); +-}>; +-export declare const e: Promise; ++ default: typeof import("inner/cjs", { with: { "resolution-mode": "import" } }); ++}>; +export declare const e: Promise<{ + esm: true; -+ default: typeof import("./node_modules/inner/index.d.mts", { with: { "resolution-mode": "import" } }); - }>; --export declare const e: Promise; \ No newline at end of file ++ default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); ++}>; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types index b9e29ef2a5..56f8a5fe7f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types @@ -15,81 +15,81 @@ export {}; === other.ts === // esm format file export const a = await import("package/cjs"); ->a : typeof import("./index.cts") ->await import("package/cjs") : typeof import("./index.cts") ->import("package/cjs") : Promise +>a : typeof import("package/cjs") +>await import("package/cjs") : typeof import("package/cjs") +>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("./index.mts") ->await import("package/mjs") : typeof import("./index.mts") ->import("package/mjs") : Promise +>b : typeof import("package/mjs") +>await import("package/mjs") : typeof import("package/mjs") +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("./index.js") ->await import("package") : typeof import("./index.js") ->import("package") : Promise +>c : typeof import("package") +>await import("package") : typeof import("package") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner/index.js"); }> +>f : { cjsMain: true; default: typeof import("inner"); } +>await import("inner") : { cjsMain: true; default: typeof import("inner"); } +>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> >"inner" : "inner" === other2.ts === // esm format file export const d = await import("inner/cjs"); ->d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> +>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } +>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } +>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> +>e : { esm: true; default: typeof import("inner/mjs"); } +>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } +>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> >"inner/mjs" : "inner/mjs" === other.mts === // esm format file export const a = await import("package/cjs"); ->a : typeof import("./index.cts") ->await import("package/cjs") : typeof import("./index.cts") ->import("package/cjs") : Promise +>a : typeof import("package/cjs") +>await import("package/cjs") : typeof import("package/cjs") +>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("./index.mts") ->await import("package/mjs") : typeof import("./index.mts") ->import("package/mjs") : Promise +>b : typeof import("package/mjs") +>await import("package/mjs") : typeof import("package/mjs") +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("./index.js") ->await import("package") : typeof import("./index.js") ->import("package") : Promise +>c : typeof import("package") +>await import("package") : typeof import("package") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner/index.js"); }> +>f : { cjsMain: true; default: typeof import("inner"); } +>await import("inner") : { cjsMain: true; default: typeof import("inner"); } +>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> >"inner" : "inner" === other2.mts === // esm format file export const d = await import("inner/cjs"); ->d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> +>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } +>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } +>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> +>e : { esm: true; default: typeof import("inner/mjs"); } +>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } +>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> >"inner/mjs" : "inner/mjs" === other.cts === @@ -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 ->import("package") : Promise +>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<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts", { with: { "resolution-mode": "import" } }); }> ->import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts", { with: { "resolution-mode": "import" } }); }> +>e : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> +>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff index 3dd4bfaf8d..4ad77fd641 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=nodenext).types.diff @@ -7,36 +7,36 @@ ->a : { default: typeof import("index"); } ->await import("package/cjs") : { default: typeof import("index"); } ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : typeof import("./index.cts") -+>await import("package/cjs") : typeof import("./index.cts") -+>import("package/cjs") : Promise ++>a : typeof import("package/cjs") ++>await import("package/cjs") : typeof import("package/cjs") ++>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("index") ->await import("package/mjs") : typeof import("index") ->import("package/mjs") : Promise -+>b : typeof import("./index.mts") -+>await import("package/mjs") : typeof import("./index.mts") -+>import("package/mjs") : Promise ++>b : typeof import("package/mjs") ++>await import("package/mjs") : typeof import("package/mjs") ++>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("index") ->await import("package") : typeof import("index") ->import("package") : Promise -+>c : typeof import("./index.js") -+>await import("package") : typeof import("./index.js") -+>import("package") : Promise ++>c : typeof import("package") ++>await import("package") : typeof import("package") ++>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner") : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> -+>f : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner/index.js"); }> ++>f : { cjsMain: true; default: typeof import("inner"); } ++>await import("inner") : { cjsMain: true; default: typeof import("inner"); } ++>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> >"inner" : "inner" === other2.ts === @@ -45,18 +45,18 @@ ->d : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> -+>d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> ++>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } ++>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } ++>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> ++>e : { esm: true; default: typeof import("inner/mjs"); } ++>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } ++>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> >"inner/mjs" : "inner/mjs" === other.mts === @@ -65,36 +65,36 @@ ->a : { default: typeof import("index"); } ->await import("package/cjs") : { default: typeof import("index"); } ->import("package/cjs") : Promise<{ default: typeof import("index"); }> -+>a : typeof import("./index.cts") -+>await import("package/cjs") : typeof import("./index.cts") -+>import("package/cjs") : Promise ++>a : typeof import("package/cjs") ++>await import("package/cjs") : typeof import("package/cjs") ++>import("package/cjs") : Promise >"package/cjs" : "package/cjs" export const b = await import("package/mjs"); ->b : typeof import("index") ->await import("package/mjs") : typeof import("index") ->import("package/mjs") : Promise -+>b : typeof import("./index.mts") -+>await import("package/mjs") : typeof import("./index.mts") -+>import("package/mjs") : Promise ++>b : typeof import("package/mjs") ++>await import("package/mjs") : typeof import("package/mjs") ++>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : typeof import("index") ->await import("package") : typeof import("index") ->import("package") : Promise -+>c : typeof import("./index.js") -+>await import("package") : typeof import("./index.js") -+>import("package") : Promise ++>c : typeof import("package") ++>await import("package") : typeof import("package") ++>import("package") : Promise >"package" : "package" export const f = await import("inner"); ->f : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner") : { cjsMain: true; default: typeof import("node_modules/inner/index"); } ->import("inner") : Promise<{ cjsMain: true; default: typeof import("node_modules/inner/index"); }> -+>f : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { cjsMain: true; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ cjsMain: true; default: typeof import("./node_modules/inner/index.js"); }> ++>f : { cjsMain: true; default: typeof import("inner"); } ++>await import("inner") : { cjsMain: true; default: typeof import("inner"); } ++>import("inner") : Promise<{ cjsMain: true; default: typeof import("inner"); }> >"inner" : "inner" === other2.mts === @@ -103,18 +103,18 @@ ->d : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->await import("inner/cjs") : { cjsNonmain: true; default: typeof import("node_modules/inner/index"); } ->import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("node_modules/inner/index"); }> -+>d : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); } -+>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("./node_modules/inner/index.d.cts"); }> ++>d : { cjsNonmain: true; default: typeof import("inner/cjs"); } ++>await import("inner/cjs") : { cjsNonmain: true; default: typeof import("inner/cjs"); } ++>import("inner/cjs") : Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }> >"inner/cjs" : "inner/cjs" export const e = await import("inner/mjs"); ->e : typeof import("node_modules/inner/index") ->await import("inner/mjs") : typeof import("node_modules/inner/index") ->import("inner/mjs") : Promise -+>e : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>await import("inner/mjs") : { esm: true; default: typeof import("./node_modules/inner/index.d.mts"); } -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts"); }> ++>e : { esm: true; default: typeof import("inner/mjs"); } ++>await import("inner/mjs") : { esm: true; default: typeof import("inner/mjs"); } ++>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs"); }> >"inner/mjs" : "inner/mjs" === other.cts === @@ -129,15 +129,15 @@ export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise -+>b : Promise -+>import("package/mjs") : Promise ++>b : Promise ++>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise ->import("package") : Promise -+>c : Promise -+>import("package") : Promise ++>c : Promise ++>import("package") : Promise >"package" : "package" export const f = import("inner"); @@ -159,8 +159,8 @@ export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise -+>e : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts", { with: { "resolution-mode": "import" } }); }> -+>import("inner/mjs") : Promise<{ esm: true; default: typeof import("./node_modules/inner/index.d.mts", { with: { "resolution-mode": "import" } }); }> ++>e : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> ++>import("inner/mjs") : Promise<{ esm: true; default: typeof import("inner/mjs", { with: { "resolution-mode": "import" } }); }> >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types index ad27f9ed16..76e9254e94 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff index 5402521d4d..f662049978 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types index ad27f9ed16..76e9254e94 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff index 2443147f19..d1f71c8196 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types index 930d3c0a1b..31a1c001b4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : typeof import("./node_modules/inner/index.js") ->await import("inner") : typeof import("./node_modules/inner/index.js") ->import("inner") : Promise +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types.diff index 4ae93aab37..442df9f867 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : typeof import("./node_modules/inner/index.js") -+>await import("inner") : typeof import("./node_modules/inner/index.js") -+>import("inner") : Promise ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types index 930d3c0a1b..31a1c001b4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : typeof import("./node_modules/inner/index.js") ->await import("inner") : typeof import("./node_modules/inner/index.js") ->import("inner") : Promise +>(await import("inner")) : typeof import("inner") +>await import("inner") : typeof import("inner") +>import("inner") : Promise >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types.diff index 254d80e066..19c0ac0d1a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : typeof import("./node_modules/inner/index.js") -+>await import("inner") : typeof import("./node_modules/inner/index.js") -+>import("inner") : Promise ++>(await import("inner")) : typeof import("inner") ++>await import("inner") : typeof import("inner") ++>import("inner") : Promise >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types index c1bc2c5ac2..5b44029f91 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff index e8b43f06e5..9994082a99 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types index c1bc2c5ac2..5b44029f91 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } +>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff index 55ce41fbd0..f0a0c34685 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>await import("inner") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); } ++>import("inner") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner"); }> >"inner" : "inner" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types index 37a2ed7bd2..33d1174764 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff index dbac527c3a..715a27d419 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types index 37a2ed7bd2..33d1174764 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff index a5406bf2e6..a83a840bf5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types index 1227d3387e..69f3818ed7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff index 3c34558ae6..1b1ecd439e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node16).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types index 1227d3387e..69f3818ed7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types @@ -9,9 +9,9 @@ export const a = (await import("inner/index.js")).x(); >a : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing >(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing ->(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } ->import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> +>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } +>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" >x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff index 391e08c8e0..d4f139adfd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=nodenext).types.diff @@ -13,9 +13,9 @@ +>a : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x() : import("./node_modules/inner/other.js").Thing +>(await import("inner/index.js")).x : () => import("./node_modules/inner/other.js").Thing -+>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); } -+>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("./node_modules/inner/index.js"); }> ++>(await import("inner/index.js")) : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>await import("inner/index.js") : { x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); } ++>import("inner/index.js") : Promise<{ x: () => import("./node_modules/inner/other.js").Thing; default: typeof import("inner/index.js"); }> >"inner/index.js" : "inner/index.js" ->x : () => import("node_modules/inner/other").Thing +>x : () => import("./node_modules/inner/other.js").Thing diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt index fd70a3002b..dc92388a5f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt @@ -1,5 +1,5 @@ /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -14,7 +14,7 @@ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt.diff deleted file mode 100644 index 1fd01b6b99..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. --/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - -@@= skipped -13, +13 lines =@@ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt index fd70a3002b..dc92388a5f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt @@ -1,5 +1,5 @@ /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -14,7 +14,7 @@ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff index 1140e639b6..36eb02d9cd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt.diff @@ -2,10 +2,9 @@ +++ new.nodeModulesImportAttributesModeDeclarationEmit1(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. --/index.ts(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,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +-/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -18,8 +17,7 @@ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt index d346fee98a..bf4698ad28 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,5 +1,5 @@ /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 '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/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. @@ -14,7 +14,7 @@ !!! 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 '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt.diff deleted file mode 100644 index 7b1e8b9722..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. --/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - /index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - -@@= skipped -13, +13 lines =@@ - !!! 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 TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt index ae73fc1ebf..1bd8e26f0a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt @@ -1,4 +1,4 @@ -/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -11,7 +11,7 @@ import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt.diff deleted file mode 100644 index 71bb4edda5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -+/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. - /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - -@@= skipped -10, +10 lines =@@ - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt index 8c4e7841c5..4dbf0eda90 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt @@ -1,5 +1,5 @@ /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -14,7 +14,7 @@ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff index 72a3af7c68..81b605a93d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node18).errors.txt.diff @@ -5,7 +5,7 @@ -/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. ++/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -21,7 +21,7 @@ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. ++!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1454: `resolution-mode` can only be set for type-only imports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt index ba0d24b926..d8a8228e80 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,4 +1,4 @@ -/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. @@ -11,7 +11,7 @@ import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! 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" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff index 547268161a..e4d75e6df7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt.diff @@ -1,21 +1,17 @@ --- old.nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt +++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -+/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== -@@= skipped -10, +10 lines =@@ - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +@@= skipped -12, +12 lines =@@ ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. + !!! 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. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt index b906e97cd4..4bd1844e48 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt @@ -1,6 +1,6 @@ /index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -15,7 +15,7 @@ // not type-only import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt.diff deleted file mode 100644 index 0bd82d7a06..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. --/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - /index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - -@@= skipped -14, +14 lines =@@ - // not type-only - import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - // not exclusively type-only \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt index b906e97cd4..4bd1844e48 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt @@ -1,6 +1,6 @@ /index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -15,7 +15,7 @@ // not type-only import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff index ab67288eca..324dad0f4a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node18).errors.txt.diff @@ -4,10 +4,9 @@ -/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. --/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -21,10 +20,9 @@ ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only - import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +@@= skipped -16, +16 lines =@@ ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt index 6ac04663a5..c45ca1322b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt @@ -1,6 +1,6 @@ /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 '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. @@ -15,7 +15,7 @@ // not type-only import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt.diff deleted file mode 100644 index c1489b3e10..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. --/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - /index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - -@@= skipped -14, +14 lines =@@ - // not type-only - import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - // not exclusively type-only \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt deleted file mode 100644 index ef460683d2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -==== /index.ts (2 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); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - 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=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt.diff deleted file mode 100644 index aad868282f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /index.ts (2 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); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+ 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=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js index 87596d3f45..cca2ca8a85 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js @@ -32,5 +32,5 @@ 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: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js.diff index fc8a225cb4..cf378b339a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).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: any; -+export declare const b: any; \ No newline at end of file ++export declare const a: import("pkg").RequireInterface; + 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/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types index 89e27944a1..3b2581fc9e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types @@ -8,9 +8,9 @@ export type LocalInterface = & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types.diff index 3201686f61..384f5efc5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt index ef460683d2..777b06a355 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt @@ -1,15 +1,12 @@ -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /index.ts (2 errors) ==== +==== /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); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. 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. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff index 4e60b64db8..d1ba9c1f43 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt.diff @@ -2,18 +2,15 @@ +++ new.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).errors.txt @@= skipped -0, +0 lines =@@ - -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. +/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. + + -+==== /index.ts (2 errors) ==== ++==== /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); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. + 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. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js index 87596d3f45..9fbb7e7ce6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js @@ -32,5 +32,5 @@ 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: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff index 569896771e..8fadb84545 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).js.diff @@ -6,5 +6,5 @@ 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: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types index 89e27944a1..3b2581fc9e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types @@ -8,9 +8,9 @@ export type LocalInterface = & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types.diff index e9249cc371..1601536383 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node18).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt deleted file mode 100644 index ef460683d2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -==== /index.ts (2 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); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - 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=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt.diff deleted file mode 100644 index 0bd7200362..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /index.ts (2 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); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+ 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=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js index 87596d3f45..cca2ca8a85 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js @@ -32,5 +32,5 @@ 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: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js.diff index 3ea0a41553..128e9579b5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).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: any; -+export declare const b: any; \ No newline at end of file ++export declare const a: import("pkg").RequireInterface; + 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/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types index 89e27944a1..3b2581fc9e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types @@ -8,9 +8,9 @@ export type LocalInterface = & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types.diff index bb32c4d644..6398b28082 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt index bf0d41d6ce..2d2f2c5b8f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt @@ -1,7 +1,5 @@ /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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. @@ -32,7 +30,6 @@ /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -73,7 +70,6 @@ /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -94,7 +90,7 @@ ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -102,13 +98,9 @@ & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~~~~ !!! 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) ==== // missing with: @@ -176,7 +168,7 @@ ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (7 errors) ==== +==== /other2.ts (6 errors) ==== // wrong attribute key export type LocalInterface = & import("pkg", { with: {"bad": "require"} }).RequireInterface @@ -189,8 +181,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -297,7 +287,7 @@ ~ !!! error TS1005: ',' expected. -==== /other5.ts (7 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { with: {} }).RequireInterface ~~ @@ -309,8 +299,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. export const b = (null as any as import("pkg", { with: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt.diff deleted file mode 100644 index 8f864ae4ee..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /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 -29, +31 lines =@@ - /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -40, +41 lines =@@ - /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -20, +21 lines =@@ - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} - --==== /index.ts (2 errors) ==== -+==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -8, +8 lines =@@ - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~ - !!! 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) ==== - // missing with: -@@= skipped -70, +74 lines =@@ - ~ - !!! error TS1128: Declaration or statement expected. - --==== /other2.ts (6 errors) ==== -+==== /other2.ts (7 errors) ==== - // wrong attribute key - export type LocalInterface = - & import("pkg", { with: {"bad": "require"} }).RequireInterface -@@= skipped -13, +13 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~ - !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. - export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); -@@= skipped -106, +108 lines =@@ - ~ - !!! error TS1005: ',' expected. - --==== /other5.ts (6 errors) ==== -+==== /other5.ts (7 errors) ==== - export type LocalInterface = - & import("pkg", { with: {} }).RequireInterface - ~~ -@@= skipped -12, +12 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~ - !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js index bf9cb6507b..e8308c808a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js @@ -127,8 +127,8 @@ 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: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] // missing with: export type LocalInterface = import("pkg", { with: {} }); @@ -137,7 +137,7 @@ export declare const b: any; //// [other2.d.ts] // wrong attribute key export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] // Array instead of object-y thing @@ -152,5 +152,5 @@ export declare const a: any, Attribute1: any, RequireInterface: any; export declare const b: any, Attribute2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js.diff index c575b0d216..73d8b0a39c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).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: any; -+export declare const b: any; ++export declare const a: import("pkg").RequireInterface; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] +// missing with: export type LocalInterface = import("pkg", { with: {} }); @@ -20,7 +19,7 @@ export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "bad": "require" } }).RequireInterface; -export declare const b: import("pkg", { with: { "bad": "import" } }).ImportInterface; -+export declare const a: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; //// [other3.d.ts] +// Array instead of object-y thing @@ -39,5 +38,5 @@ export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; -export declare const a: import("pkg", { with: {} }).RequireInterface; -export declare const b: import("pkg", { with: {} }).ImportInterface; -+export declare const a: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types index 460aa831da..bc8f825a8e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types @@ -16,9 +16,9 @@ export type LocalInterface = & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -74,9 +74,9 @@ export type LocalInterface = & import("pkg", { with: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -174,9 +174,9 @@ export type LocalInterface = & import("pkg", { with: {} }).ImportInterface; export const a = (null as any as import("pkg", { with: {} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types.diff index 4b858e69bb..cab47a378e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -38,9 +38,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -69,9 +69,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt index 40e5bf1ff7..bc82a35047 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt @@ -1,6 +1,5 @@ error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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')'? @@ -34,7 +33,6 @@ error TS2468: Cannot find global value 'Promise'. /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -77,7 +75,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -99,7 +96,7 @@ error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (3 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -107,8 +104,6 @@ error TS2468: Cannot find global value 'Promise'. & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -183,7 +178,7 @@ error TS2468: Cannot find global value 'Promise'. ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (7 errors) ==== +==== /other2.ts (6 errors) ==== // wrong attribute key export type LocalInterface = & import("pkg", { with: {"bad": "require"} }).RequireInterface @@ -196,8 +191,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -308,7 +301,7 @@ error TS2468: Cannot find global value 'Promise'. ~ !!! error TS1005: ',' expected. -==== /other5.ts (7 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { with: {} }).RequireInterface ~~ @@ -320,8 +313,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. export const b = (null as any as import("pkg", { with: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff index 4f4452935c..793a63e223 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).errors.txt.diff @@ -3,13 +3,12 @@ @@= skipped -0, +0 lines =@@ +error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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 =@@ +@@= skipped -6, +8 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'. @@ -17,15 +16,7 @@ /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 -23, +24 lines =@@ - /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -9, +10 lines =@@ +@@= 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'. @@ -41,13 +32,7 @@ /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 -15, +16 lines =@@ - /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +@@= skipped -20, +21 lines =@@ /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -55,21 +40,16 @@ ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", -@@= skipped -20, +22 lines =@@ +@@= skipped -15, +16 lines =@@ ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== -+==== /index.ts (4 errors) ==== ++==== /index.ts (3 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ -@@= skipped -8, +8 lines =@@ - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. +@@= 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); @@ -81,7 +61,7 @@ // missing with: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -24, +28 lines =@@ +@@= skipped -21, +23 lines =@@ ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; @@ -90,25 +70,7 @@ ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -@@= skipped -46, +48 lines =@@ - ~ - !!! error TS1128: Declaration or statement expected. - --==== /other2.ts (6 errors) ==== -+==== /other2.ts (7 errors) ==== - // wrong attribute key - export type LocalInterface = - & import("pkg", { with: {"bad": "require"} }).RequireInterface -@@= skipped -13, +13 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~ - !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. - export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); -@@= skipped -8, +10 lines =@@ +@@= skipped -67, +69 lines =@@ ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -143,22 +105,4 @@ +!!! error TS2712: A dynamic import 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. -@@= skipped -31, +33 lines =@@ - ~ - !!! error TS1005: ',' expected. - --==== /other5.ts (6 errors) ==== -+==== /other5.ts (7 errors) ==== - export type LocalInterface = - & import("pkg", { with: {} }).RequireInterface - ~~ -@@= skipped -12, +12 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~ - !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file + !!! 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=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js index bf9cb6507b..8e46ab64f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js @@ -127,7 +127,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: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other.d.ts] // missing with: @@ -137,7 +137,7 @@ export declare const b: any; //// [other2.d.ts] // wrong attribute key export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] // Array instead of object-y thing @@ -152,5 +152,5 @@ export declare const a: any, Attribute1: any, RequireInterface: any; export declare const b: any, Attribute2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff index ec17535152..6c360e87db 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).js.diff @@ -6,7 +6,7 @@ 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: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; //// [other.d.ts] +// missing with: @@ -20,7 +20,7 @@ export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "bad": "require" } }).RequireInterface; -export declare const b: import("pkg", { with: { "bad": "import" } }).ImportInterface; -+export declare const a: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; //// [other3.d.ts] +// Array instead of object-y thing @@ -39,5 +39,5 @@ export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; -export declare const a: import("pkg", { with: {} }).RequireInterface; -export declare const b: import("pkg", { with: {} }).ImportInterface; -+export declare const a: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types index 460aa831da..bc8f825a8e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types @@ -16,9 +16,9 @@ export type LocalInterface = & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -74,9 +74,9 @@ export type LocalInterface = & import("pkg", { with: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -174,9 +174,9 @@ export type LocalInterface = & import("pkg", { with: {} }).ImportInterface; export const a = (null as any as import("pkg", { with: {} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff index 2a809639da..a7d5568ede 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node18).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -38,9 +38,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -69,9 +69,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt index 31e3fc5e45..1075b870f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt @@ -1,7 +1,5 @@ /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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. @@ -32,7 +30,6 @@ /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -76,7 +73,6 @@ /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -97,7 +93,7 @@ ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -105,13 +101,9 @@ & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~~~~ !!! 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) ==== // missing with: @@ -179,7 +171,7 @@ ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (7 errors) ==== +==== /other2.ts (6 errors) ==== // wrong attribute key export type LocalInterface = & import("pkg", { with: {"bad": "require"} }).RequireInterface @@ -192,8 +184,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -303,7 +293,7 @@ ~ !!! error TS1005: ',' expected. -==== /other5.ts (7 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { with: {} }).RequireInterface ~~ @@ -315,8 +305,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~ !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. export const b = (null as any as import("pkg", { with: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt.diff deleted file mode 100644 index 00076f23f8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /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 -29, +31 lines =@@ - /other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. - /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -43, +44 lines =@@ - /other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -20, +21 lines =@@ - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} - --==== /index.ts (2 errors) ==== -+==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -8, +8 lines =@@ - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~ - !!! 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) ==== - // missing with: -@@= skipped -70, +74 lines =@@ - ~ - !!! error TS1128: Declaration or statement expected. - --==== /other2.ts (6 errors) ==== -+==== /other2.ts (7 errors) ==== - // wrong attribute key - export type LocalInterface = - & import("pkg", { with: {"bad": "require"} }).RequireInterface -@@= skipped -13, +13 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~ - !!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. - export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); -@@= skipped -109, +111 lines =@@ - ~ - !!! error TS1005: ',' expected. - --==== /other5.ts (6 errors) ==== -+==== /other5.ts (7 errors) ==== - export type LocalInterface = - & import("pkg", { with: {} }).RequireInterface - ~~ -@@= skipped -12, +12 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~ - !!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. - export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js index bf9cb6507b..e8308c808a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js @@ -127,8 +127,8 @@ 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: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] // missing with: export type LocalInterface = import("pkg", { with: {} }); @@ -137,7 +137,7 @@ export declare const b: any; //// [other2.d.ts] // wrong attribute key export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] // Array instead of object-y thing @@ -152,5 +152,5 @@ export declare const a: any, Attribute1: any, RequireInterface: any; export declare const b: any, Attribute2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js.diff index db60556d2c..89f55162e5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).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: any; -+export declare const b: any; ++export declare const a: import("pkg").RequireInterface; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] +// missing with: export type LocalInterface = import("pkg", { with: {} }); @@ -20,7 +19,7 @@ export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "bad": "require" } }).RequireInterface; -export declare const b: import("pkg", { with: { "bad": "import" } }).ImportInterface; -+export declare const a: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; //// [other3.d.ts] +// Array instead of object-y thing @@ -39,5 +38,5 @@ export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; -export declare const a: import("pkg", { with: {} }).RequireInterface; -export declare const b: import("pkg", { with: {} }).ImportInterface; -+export declare const a: any; ++export declare const a: import("pkg").RequireInterface; +export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types index 460aa831da..bc8f825a8e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types @@ -16,9 +16,9 @@ export type LocalInterface = & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -74,9 +74,9 @@ export type LocalInterface = & import("pkg", { with: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -174,9 +174,9 @@ export type LocalInterface = & import("pkg", { with: {} }).ImportInterface; export const a = (null as any as import("pkg", { with: {} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { with: {} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { with: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types.diff index ca10fa5e46..e2fe8de04b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); @@ -38,9 +38,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); @@ -69,9 +69,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { with: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { with: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { with: {} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { with: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index a7af333c7c..550ef21197 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,5 +1,5 @@ /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -14,7 +14,7 @@ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt.diff deleted file mode 100644 index 12427fc17c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt -+++ new.nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. --/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - - -@@= skipped -13, +13 lines =@@ - !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt index a7af333c7c..550ef21197 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@ -1,5 +1,5 @@ /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -14,7 +14,7 @@ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff index dc2b00dca6..cc94414981 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt.diff @@ -2,10 +2,9 @@ +++ new.nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. --/index.ts(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,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +-/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -18,8 +17,7 @@ +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index 0643bf9338..e77140972a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,5 +1,5 @@ /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 '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/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. @@ -14,7 +14,7 @@ !!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff index e363a0237b..37f29a9c7e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt.diff @@ -2,10 +2,9 @@ +++ new.nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(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(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + /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. @@ -20,10 +19,9 @@ +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index 64265524c9..1604272f9e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,4 +1,4 @@ -/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -11,7 +11,7 @@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt.diff deleted file mode 100644 index 950ffb7404..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt -+++ new.nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -+/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. - /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - -@@= skipped -10, +10 lines =@@ - - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt index 5da57f27de..44447996ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt @@ -1,5 +1,5 @@ /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -14,7 +14,7 @@ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff index f3bb977aeb..bb22153115 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt.diff @@ -5,7 +5,7 @@ -/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. -+/index.ts(7,14): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. ++/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -21,7 +21,7 @@ +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. ++!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1454: `resolution-mode` can only be set for type-only imports. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index de6f97f9ef..e72c71d9a7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,4 +1,4 @@ -/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. @@ -11,7 +11,7 @@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff index 20f8e6ecca..a8e1f1d008 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt.diff @@ -1,23 +1,20 @@ --- old.nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ new.nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+/index.ts(6,14): error TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== -@@= skipped -10, +10 lines =@@ - +@@= 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 TS2305: Module '"./node_modules/pkg/import.js"' has no exported member 'RequireInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index eaa9cbc619..1bf72bb46a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,6 +1,6 @@ /index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -15,7 +15,7 @@ // not type-only import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt.diff deleted file mode 100644 index e0d31a405a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt -+++ new.nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. --/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - -@@= skipped -14, +14 lines =@@ - // not type-only - import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. - // not exclusively type-only \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt index eaa9cbc619..1bf72bb46a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,6 +1,6 @@ /index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(4,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -15,7 +15,7 @@ // not type-only import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff index 8706cb39ff..90eb52262e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt.diff @@ -4,10 +4,9 @@ -/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. --/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + /index.ts(4,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,10): error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. +/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. @@ -21,10 +20,9 @@ ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only - import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +@@= skipped -16, +16 lines =@@ ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 430b622f9e..e1be072618 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,6 +1,6 @@ /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 '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +/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. @@ -15,7 +15,7 @@ // not type-only import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff index e85247665d..2689bd1337 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff @@ -4,10 +4,9 @@ -/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. --/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + /index.ts(4,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,10): error TS2305: Module '"./node_modules/pkg/require"' 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. @@ -24,10 +23,9 @@ // not type-only import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + !!! 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 TS2305: Module '"./node_modules/pkg/require"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt deleted file mode 100644 index a265a80b26..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -==== /index.ts (2 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); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - 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=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt.diff deleted file mode 100644 index 0c3ce0661a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /index.ts (2 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); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+ 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=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js index 100de5460a..6c0a3531fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js @@ -32,5 +32,5 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js.diff deleted file mode 100644 index 719fb56387..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node16).js -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node16).js -@@= skipped -31, +31 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 a: any; -+export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types index 2925d32462..c7a53a5b37 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types @@ -8,9 +8,9 @@ export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types.diff index cbb019b25c..6797f2c182 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt index a265a80b26..676f67dd9e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt @@ -1,15 +1,12 @@ -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /index.ts (2 errors) ==== +==== /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); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. 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. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff index 1957cc97ed..120aa8429d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff @@ -2,18 +2,15 @@ +++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt @@= skipped -0, +0 lines =@@ - -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. +/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. + + -+==== /index.ts (2 errors) ==== ++==== /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); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. + 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. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js index 100de5460a..26d582ef14 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js @@ -32,5 +32,5 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff index 9fd6efd3a9..1296b80d51 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).js.diff @@ -1,10 +1,8 @@ --- old.nodeModulesImportTypeModeDeclarationEmit1(module=node18).js +++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node18).js -@@= skipped -31, +31 lines =@@ - +@@= 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 a: import("pkg").RequireInterface; -export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const a: any; +export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types index 2925d32462..c7a53a5b37 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types @@ -8,9 +8,9 @@ export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types.diff index 460ae4ddf9..5ebc5e7999 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt deleted file mode 100644 index a265a80b26..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -==== /index.ts (2 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); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - 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=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt.diff deleted file mode 100644 index 1db011617b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /index.ts (2 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); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. -+ 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=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js index 100de5460a..6c0a3531fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js @@ -32,5 +32,5 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js.diff deleted file mode 100644 index 24e7c5125c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js -@@= skipped -31, +31 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 a: any; -+export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types index 2925d32462..c7a53a5b37 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types @@ -8,9 +8,9 @@ export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types.diff index d243a675c8..587df8c2d7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt index 6cf43c6f83..5172f49a5c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,7 +1,5 @@ /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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. @@ -32,7 +30,6 @@ /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -73,7 +70,6 @@ /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -92,7 +88,7 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -100,13 +96,9 @@ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~~~~ !!! 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 (27 errors) ==== // missing assert: export type LocalInterface = @@ -172,7 +164,7 @@ !!! error TS2304: Cannot find name 'ImportInterface'. ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (7 errors) ==== +==== /other2.ts (6 errors) ==== // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface @@ -185,8 +177,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -290,7 +280,7 @@ !!! error TS1134: Variable declaration expected. ~ !!! error TS1005: ',' expected. -==== /other5.ts (7 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface ~~ @@ -302,8 +292,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff deleted file mode 100644 index 65c82303f8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /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 -29, +31 lines =@@ - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -40, +41 lines =@@ - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -18, +19 lines =@@ - export interface ImportInterface {} - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} --==== /index.ts (2 errors) ==== -+==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -8, +8 lines =@@ - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~ - !!! 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 (27 errors) ==== - // missing assert: - export type LocalInterface = -@@= skipped -68, +72 lines =@@ - !!! error TS2304: Cannot find name 'ImportInterface'. - ~ - !!! error TS1128: Declaration or statement expected. --==== /other2.ts (6 errors) ==== -+==== /other2.ts (7 errors) ==== - // wrong assertion key - export type LocalInterface = - & import("pkg", { assert: {"bad": "require"} }).RequireInterface -@@= skipped -13, +13 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~ - !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. - export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); -@@= skipped -103, +105 lines =@@ - !!! error TS1134: Variable declaration expected. - ~ - !!! error TS1005: ',' expected. --==== /other5.ts (6 errors) ==== -+==== /other5.ts (7 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {} }).RequireInterface - ~~ -@@= skipped -12, +12 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js index fde502bbf6..c18dc767f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js @@ -121,8 +121,8 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] // missing assert: export type LocalInterface = import("pkg", { with: {} }); @@ -131,7 +131,7 @@ export declare const b: any; //// [other2.d.ts] // wrong assertion key export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] // Array instead of object-y thing @@ -146,5 +146,5 @@ export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js.diff index 45d0093888..7da7d1c2a9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js.diff @@ -1,13 +1,8 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js -@@= skipped -120, +120 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 a: any; -+export declare const b: any; +@@= skipped -123, +123 lines =@@ + export declare const a: import("pkg").RequireInterface; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] +// missing assert: export type LocalInterface = import("pkg", { with: {} }); @@ -18,15 +13,14 @@ //// [other2.d.ts] +// wrong assertion key export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; --export declare const a: import("pkg").RequireInterface; -+export declare const a: any; + export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] +// Array instead of object-y thing export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; -@@= skipped -18, +21 lines =@@ +@@= skipped -15, +18 lines =@@ export declare const b: any; //// [other4.d.ts] export type LocalInterface = import("pkg", { with: {} }); @@ -36,6 +30,4 @@ +export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; --export declare const a: import("pkg").RequireInterface; -+export declare const a: any; - export declare const b: any; \ No newline at end of file + export declare const a: import("pkg").RequireInterface; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types index 299d11138b..c740f9eb8a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types @@ -14,9 +14,9 @@ export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -72,9 +72,9 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -172,9 +172,9 @@ export type LocalInterface = & import("pkg", { assert: {} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types.diff index 35cda76c73..8478befdce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -38,9 +38,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -69,9 +69,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt index 72d562453a..f7c0a4cb5c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,6 +1,5 @@ error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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')'? @@ -34,7 +33,6 @@ error TS2468: Cannot find global value 'Promise'. /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -77,7 +75,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -97,7 +94,7 @@ error TS2468: Cannot find global value 'Promise'. export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (3 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -105,8 +102,6 @@ error TS2468: Cannot find global value 'Promise'. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -179,7 +174,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2304: Cannot find name 'ImportInterface'. ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (7 errors) ==== +==== /other2.ts (6 errors) ==== // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface @@ -192,8 +187,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -301,7 +294,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS1134: Variable declaration expected. ~ !!! error TS1005: ',' expected. -==== /other5.ts (7 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface ~~ @@ -313,8 +306,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff index 2770839522..2ee67f2fd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff @@ -3,13 +3,12 @@ @@= skipped -0, +0 lines =@@ +error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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 =@@ +@@= skipped -6, +8 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'. @@ -17,15 +16,7 @@ /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 -23, +24 lines =@@ - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -9, +10 lines =@@ +@@= 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'. @@ -41,13 +32,7 @@ /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 -15, +16 lines =@@ - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +@@= skipped -20, +21 lines =@@ /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -55,21 +40,16 @@ ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", -@@= skipped -18, +20 lines =@@ +@@= skipped -13, +14 lines =@@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== -+==== /index.ts (4 errors) ==== ++==== /index.ts (3 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ -@@= skipped -8, +8 lines =@@ - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. +@@= 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); @@ -80,7 +60,7 @@ // missing assert: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -23, +27 lines =@@ +@@= skipped -20, +22 lines =@@ ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; @@ -89,25 +69,7 @@ ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ -@@= skipped -45, +47 lines =@@ - !!! error TS2304: Cannot find name 'ImportInterface'. - ~ - !!! error TS1128: Declaration or statement expected. --==== /other2.ts (6 errors) ==== -+==== /other2.ts (7 errors) ==== - // wrong assertion key - export type LocalInterface = - & import("pkg", { assert: {"bad": "require"} }).RequireInterface -@@= skipped -13, +13 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~ - !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. - export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); -@@= skipped -7, +9 lines =@@ +@@= 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'. @@ -142,22 +104,4 @@ +!!! error TS2712: A dynamic import 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. -@@= skipped -30, +32 lines =@@ - !!! error TS1134: Variable declaration expected. - ~ - !!! error TS1005: ',' expected. --==== /other5.ts (6 errors) ==== -+==== /other5.ts (7 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {} }).RequireInterface - ~~ -@@= skipped -12, +12 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); \ No newline at end of file + !!! 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=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js index fde502bbf6..7c4b9cd77d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js @@ -121,7 +121,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: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other.d.ts] // missing assert: @@ -131,7 +131,7 @@ export declare const b: any; //// [other2.d.ts] // wrong assertion key export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] // Array instead of object-y thing @@ -146,5 +146,5 @@ export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff index 6a54c39858..37aa4e9198 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js.diff @@ -1,12 +1,10 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).js -@@= skipped -120, +120 lines =@@ - +@@= 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 a: import("pkg").RequireInterface; -export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const a: any; +export declare const b: any; //// [other.d.ts] +// missing assert: @@ -18,15 +16,14 @@ //// [other2.d.ts] +// wrong assertion key export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; --export declare const a: import("pkg").RequireInterface; -+export declare const a: any; + export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] +// Array instead of object-y thing export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; -@@= skipped -18, +21 lines =@@ +@@= skipped -17, +20 lines =@@ export declare const b: any; //// [other4.d.ts] export type LocalInterface = import("pkg", { with: {} }); @@ -36,6 +33,4 @@ +export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; --export declare const a: import("pkg").RequireInterface; -+export declare const a: any; - export declare const b: any; \ No newline at end of file + export declare const a: import("pkg").RequireInterface; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types index 299d11138b..c740f9eb8a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types @@ -14,9 +14,9 @@ export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -72,9 +72,9 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -172,9 +172,9 @@ export type LocalInterface = & import("pkg", { assert: {} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff index ab04e95e8c..d918947324 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -38,9 +38,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -69,9 +69,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt index 174e942416..632a556e13 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,7 +1,5 @@ /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /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. @@ -32,7 +30,6 @@ /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -76,7 +73,6 @@ /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -95,7 +91,7 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -103,13 +99,9 @@ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~~~~ !!! 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 (27 errors) ==== // missing assert: export type LocalInterface = @@ -175,7 +167,7 @@ !!! error TS2304: Cannot find name 'ImportInterface'. ~ !!! error TS1128: Declaration or statement expected. -==== /other2.ts (7 errors) ==== +==== /other2.ts (6 errors) ==== // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface @@ -188,8 +180,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~~~~ !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -296,7 +286,7 @@ !!! error TS1134: Variable declaration expected. ~ !!! error TS1005: ',' expected. -==== /other5.ts (7 errors) ==== +==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface ~~ @@ -308,8 +298,6 @@ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. ~~ !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff deleted file mode 100644 index 4b9171fe95..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,85 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /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 -29, +31 lines =@@ - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other2.ts(6,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. - /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -43, +44 lines =@@ - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -+/other5.ts(5,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -@@= skipped -18, +19 lines =@@ - export interface ImportInterface {} - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} --==== /index.ts (2 errors) ==== -+==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -8, +8 lines =@@ - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~~~~ - !!! 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 (27 errors) ==== - // missing assert: - export type LocalInterface = -@@= skipped -68, +72 lines =@@ - !!! error TS2304: Cannot find name 'ImportInterface'. - ~ - !!! error TS1128: Declaration or statement expected. --==== /other2.ts (6 errors) ==== -+==== /other2.ts (7 errors) ==== - // wrong assertion key - export type LocalInterface = - & import("pkg", { assert: {"bad": "require"} }).RequireInterface -@@= skipped -13, +13 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~~~~ - !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. - export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); -@@= skipped -106, +108 lines =@@ - !!! error TS1134: Variable declaration expected. - ~ - !!! error TS1005: ',' expected. --==== /other5.ts (6 errors) ==== -+==== /other5.ts (7 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {} }).RequireInterface - ~~ -@@= skipped -12, +12 lines =@@ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); -+ ~ -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/pkg/require'. This is likely not portable. A type annotation is necessary. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js index fde502bbf6..c18dc767f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js @@ -121,8 +121,8 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: any; -export declare const b: any; +export declare const a: import("pkg").RequireInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] // missing assert: export type LocalInterface = import("pkg", { with: {} }); @@ -131,7 +131,7 @@ export declare const b: any; //// [other2.d.ts] // wrong assertion key export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] // Array instead of object-y thing @@ -146,5 +146,5 @@ export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; -export declare const a: any; +export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js.diff index 085b8660e5..bcf01af0be 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js.diff @@ -1,13 +1,8 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js -@@= skipped -120, +120 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 a: any; -+export declare const b: any; +@@= skipped -123, +123 lines =@@ + export declare const a: import("pkg").RequireInterface; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] +// missing assert: export type LocalInterface = import("pkg", { with: {} }); @@ -18,15 +13,14 @@ //// [other2.d.ts] +// wrong assertion key export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; --export declare const a: import("pkg").RequireInterface; -+export declare const a: any; + export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] +// Array instead of object-y thing export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; -@@= skipped -18, +21 lines =@@ +@@= skipped -15, +18 lines =@@ export declare const b: any; //// [other4.d.ts] export type LocalInterface = import("pkg", { with: {} }); @@ -36,6 +30,4 @@ +export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] export type LocalInterface = import("pkg", { assert: {} }).RequireInterface & import("pkg", { assert: {} }).ImportInterface; --export declare const a: import("pkg").RequireInterface; -+export declare const a: any; - export declare const b: any; \ No newline at end of file + export declare const a: import("pkg").RequireInterface; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types index 299d11138b..c740f9eb8a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types @@ -14,9 +14,9 @@ export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -72,9 +72,9 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "import"} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -172,9 +172,9 @@ export type LocalInterface = & import("pkg", { assert: {} }).ImportInterface; export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); ->a : import("./node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface +>a : import("pkg").RequireInterface +>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("pkg").RequireInterface +>null as any as import("pkg", { assert: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types.diff index 65195fcd1a..eea858a341 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).types.diff @@ -7,9 +7,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); @@ -38,9 +38,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); @@ -69,9 +69,9 @@ ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { assert: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { assert: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface -+>a : import("./node_modules/pkg/require").RequireInterface -+>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("./node_modules/pkg/require").RequireInterface -+>null as any as import("pkg", { assert: {} }).RequireInterface : import("./node_modules/pkg/require").RequireInterface ++>a : import("pkg").RequireInterface ++>(null as any as import("pkg", { assert: {} }).RequireInterface) : import("pkg").RequireInterface ++>null as any as import("pkg", { assert: {} }).RequireInterface : import("pkg").RequireInterface >null as any : any export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types index 555e8e9d86..ca0310f630 100644 --- a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types +++ b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types @@ -49,17 +49,17 @@ export { A as AA } from "./a"; >AA : any export { B as BB } from "./b"; ->B : typeof import("./b.js").B ->BB : typeof import("./b.js").B +>B : typeof import("./b").B +>BB : typeof import("./b").B === d.fixed.ts === export type { A as AA } from "./a"; >A : any ->AA : import("./a.js").A +>AA : import("./a").A export type { B as BB } from "./b"; ->B : typeof import("./b.js").B ->BB : import("./b.js").B +>B : typeof import("./b").B +>BB : import("./b").B === e.ts === import { AA, BB } from "./d"; diff --git a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types.diff b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types.diff index deac7a25e8..81ce28531b 100644 --- a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types.diff +++ b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=false).types.diff @@ -6,20 +6,20 @@ export { B as BB } from "./b"; ->B : typeof import("b").B ->BB : typeof import("b").B -+>B : typeof import("./b.js").B -+>BB : typeof import("./b.js").B ++>B : typeof import("./b").B ++>BB : typeof import("./b").B === d.fixed.ts === export type { A as AA } from "./a"; >A : any ->AA : import("a").A -+>AA : import("./a.js").A ++>AA : import("./a").A export type { B as BB } from "./b"; ->B : typeof import("b").B ->BB : import("b").B -+>B : typeof import("./b.js").B -+>BB : import("./b.js").B ++>B : typeof import("./b").B ++>BB : import("./b").B === e.ts === import { AA, BB } from "./d"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types index 555e8e9d86..ca0310f630 100644 --- a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types +++ b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types @@ -49,17 +49,17 @@ export { A as AA } from "./a"; >AA : any export { B as BB } from "./b"; ->B : typeof import("./b.js").B ->BB : typeof import("./b.js").B +>B : typeof import("./b").B +>BB : typeof import("./b").B === d.fixed.ts === export type { A as AA } from "./a"; >A : any ->AA : import("./a.js").A +>AA : import("./a").A export type { B as BB } from "./b"; ->B : typeof import("./b.js").B ->BB : import("./b.js").B +>B : typeof import("./b").B +>BB : import("./b").B === e.ts === import { AA, BB } from "./d"; diff --git a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types.diff b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types.diff index 031edc3b51..cc53c3be90 100644 --- a/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types.diff +++ b/testdata/baselines/reference/submodule/conformance/preserveValueImports_errors(isolatedmodules=true).types.diff @@ -6,20 +6,20 @@ export { B as BB } from "./b"; ->B : typeof import("b").B ->BB : typeof import("b").B -+>B : typeof import("./b.js").B -+>BB : typeof import("./b.js").B ++>B : typeof import("./b").B ++>BB : typeof import("./b").B === d.fixed.ts === export type { A as AA } from "./a"; >A : any ->AA : import("a").A -+>AA : import("./a.js").A ++>AA : import("./a").A export type { B as BB } from "./b"; ->B : typeof import("b").B ->BB : import("b").B -+>B : typeof import("./b.js").B -+>BB : import("./b.js").B ++>B : typeof import("./b").B ++>BB : import("./b").B === e.ts === import { AA, BB } from "./d"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitMonorepoBaseUrl.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitMonorepoBaseUrl.errors.txt.diff deleted file mode 100644 index f2761232f1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/declarationEmitMonorepoBaseUrl.errors.txt.diff +++ /dev/null @@ -1,61 +0,0 @@ ---- old.declarationEmitMonorepoBaseUrl.errors.txt -+++ new.declarationEmitMonorepoBaseUrl.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/packages/compiler-sfc/src/index.ts(2,17): error TS2742: The inferred type of 'resolveParserPlugins' cannot be named without a reference to '.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser'. This is likely not portable. A type annotation is necessary. -+ -+ -+==== /tsconfig.json (0 errors) ==== -+ { -+ "compilerOptions": { -+ "module": "nodenext", -+ "declaration": true, -+ "outDir": "temp", -+ "baseUrl": "." -+ } -+ } -+ -+==== /packages/compiler-core/src/index.ts (0 errors) ==== -+ import { PluginConfig } from "@babel/parser"; -+ -+==== /packages/compiler-sfc/src/index.ts (1 errors) ==== -+ import { createPlugin } from "@babel/parser"; -+ export function resolveParserPlugins() { -+ ~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2742: The inferred type of 'resolveParserPlugins' cannot be named without a reference to '.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser'. This is likely not portable. A type annotation is necessary. -+ return [createPlugin()]; -+ } -+ -+==== /node_modules/.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser/package.json (0 errors) ==== -+ { -+ "name": "@babel/parser", -+ "version": "7.23.6", -+ "main": "./lib/index.js", -+ "types": "./typings/babel-parser.d.ts" -+ } -+ -+==== /node_modules/.pnpm/@babel+parser@7.23.6/node_modules/@babel/parser/typings/babel-parser.d.ts (0 errors) ==== -+ export declare function createPlugin(): PluginConfig; -+ export declare class PluginConfig {} -+ -+==== /packages/compiler-core/package.json (0 errors) ==== -+ { -+ "name": "@vue/compiler-core", -+ "version": "3.0.0", -+ "main": "./src/index.ts", -+ "dependencies": { -+ "@babel/parser": "^7.0.0" -+ } -+ } -+ -+==== /packages/compiler-sfc/package.json (0 errors) ==== -+ { -+ "name": "@vue/compiler-sfc", -+ "version": "3.0.0", -+ "main": "./src/index.ts", -+ "dependencies": { -+ "@babel/parser": "^7.0.0", -+ "@vue/compiler-core": "^3.0.0" -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff index 539366ec75..8ba89ee226 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff @@ -5,7 +5,7 @@ >useThing : (x: Thing) => void >cbThing : (x: (x: Thing) => void) => void ->require("./index") : typeof import("index") -+>require("./index") : typeof import(".") ++>require("./index") : typeof import("./index") >require : any >"./index" : "./index" diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt.diff index ed30b40e0c..089b4260ee 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt.diff @@ -2,13 +2,13 @@ +++ new.moduleResolution_explicitNodeModulesImport_implicitAny.errors.txt @@= skipped -0, +0 lines =@@ - -+/src/index.ts(1,10): error TS2305: Module '"foo"' has no exported member 'y'. ++/src/index.ts(1,10): error TS2305: Module '"../node_modules/foo"' has no exported member 'y'. + + +==== /src/index.ts (1 errors) ==== + import { y } from "../node_modules/foo"; + ~ -+!!! error TS2305: Module '"foo"' has no exported member 'y'. ++!!! error TS2305: Module '"../node_modules/foo"' has no exported member 'y'. + +==== /node_modules/foo/index.js (0 errors) ==== + exports.x = 0; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff index aed7baaa89..cec346e587 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/node10AlternateResult_noResolution.errors.txt.diff @@ -3,7 +3,7 @@ @@= skipped -0, +0 lines =@@ -/index.ts(1,21): error TS2307: Cannot find module 'pkg' or its corresponding type declarations. - There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. -+/index.ts(1,10): error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. ++/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. ==== /node_modules/pkg/package.json (0 errors) ==== @@ -15,5 +15,5 @@ -!!! error TS2307: Cannot find module 'pkg' or its corresponding type declarations. -!!! error TS2307: There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. + ~~~ -+!!! error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. ++!!! error TS2305: Module '"pkg"' has no exported member 'pkg'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff index 56d416d7fc..cbdb934c2a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/node10Alternateresult_noTypes.errors.txt.diff @@ -11,7 +11,7 @@ -!!! error TS6504: File '/node_modules/pkg/untyped.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 -+/index.ts(1,10): error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. ++/index.ts(1,10): error TS2305: Module '"pkg"' has no exported member 'pkg'. + + ==== /node_modules/pkg/package.json (0 errors) ==== @@ -25,5 +25,5 @@ -!!! error TS7016: Could not find a declaration file for module 'pkg'. '/node_modules/pkg/untyped.js' implicitly has an 'any' type. -!!! error TS7016: There are types at '/node_modules/pkg/definitely-not-index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'. + ~~~ -+!!! error TS2305: Module '"./node_modules/pkg/definitely-not-index"' has no exported member 'pkg'. ++!!! error TS2305: Module '"pkg"' has no exported member 'pkg'. \ No newline at end of file